From 6141f6134e8ee32a154c5ee2c8e7249f8e3aca7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= Date: Wed, 16 Apr 2014 08:06:32 +0200 Subject: [PATCH] Allow continued lines inside quoted value (GH issue #104) (cherry picked from commit 3b88ba6d897ab62dfa14cd9b627a5d497e45e3c1) Conflicts: NEWS lenses/tests/test_httpd.aug --- lenses/httpd.aug | 10 ++++++++-- lenses/tests/test_httpd.aug | 10 ++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lenses/httpd.aug b/lenses/httpd.aug index caea9b6..979ff40 100644 --- a/lenses/httpd.aug +++ b/lenses/httpd.aug @@ -61,8 +61,14 @@ let indent = Util.indent (* borrowed from shellvars.aug *) let char_arg_dir = /[^ '"\t\r\n]|\\\\"|\\\\'/ let char_arg_sec = /[^ '"\t\r\n>]|\\\\"|\\\\'/ -let dquot = /"([^"\\\r\n]|\\\\.)*"/ -let squot = /'([^'\\\r\n]|\\\\.)*'/ +let cdot = /\\\\./ +let cl = /\\\\\n/ +let dquot = + let no_dquot = /[^"\\\r\n]/ + in /"/ . (no_dquot|cdot|cl)* . /"/ +let squot = + let no_squot = /[^'\\\r\n]/ + in /'/ . (no_squot|cdot|cl)* . /'/ (****************************************************************** * Attributes diff --git a/lenses/tests/test_httpd.aug b/lenses/tests/test_httpd.aug index af6cdc1..14347f1 100644 --- a/lenses/tests/test_httpd.aug +++ b/lenses/tests/test_httpd.aug @@ -339,3 +339,13 @@ test Httpd.lns get conf2 = { } } +(* Test: Httpd.lns + Newlines inside quoted value (GH issue #104) *) +test Httpd.lns get "Single 'Foo\\ +bar' +Double \"Foo\\ +bar\"\n" = + { "directive" = "Single" + { "arg" = "'Foo\\\nbar'" } } + { "directive" = "Double" + { "arg" = "\"Foo\\\nbar\"" } }