Blame SOURCES/0029-Allow-continued-lines-inside-quoted-value-GH-issue-1.patch

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