aboutsummaryrefslogtreecommitdiffstats
path: root/main/augeas/0008-Shellvars-case-support-quotes-and-spaces-in-pattern-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/augeas/0008-Shellvars-case-support-quotes-and-spaces-in-pattern-.patch')
-rw-r--r--main/augeas/0008-Shellvars-case-support-quotes-and-spaces-in-pattern-.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/main/augeas/0008-Shellvars-case-support-quotes-and-spaces-in-pattern-.patch b/main/augeas/0008-Shellvars-case-support-quotes-and-spaces-in-pattern-.patch
new file mode 100644
index 0000000000..2988f43cc4
--- /dev/null
+++ b/main/augeas/0008-Shellvars-case-support-quotes-and-spaces-in-pattern-.patch
@@ -0,0 +1,56 @@
+From 2468b3af35eefd019b6cb75836a6fb274cfc20bc Mon Sep 17 00:00:00 2001
+From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+Date: Mon, 8 Dec 2014 15:17:46 +0200
+Subject: [PATCH 08/15] Shellvars: case: support quotes and spaces in pattern
+ lists
+
+---
+ lenses/shellvars.aug | 2 +-
+ lenses/tests/test_shellvars.aug | 18 ++++++++++++++++++
+ 2 files changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug
+index 4dca315..dc6d4f3 100644
+--- a/lenses/shellvars.aug
++++ b/lenses/shellvars.aug
+@@ -140,7 +140,7 @@ module Shellvars =
+
+ let case (entry:lens) (entry_noeol:lens) =
+ let case_entry = [ label "@case_entry"
+- . Util.indent . store /[^ \t\n\)]+/
++ . Util.indent . sto_to_semicol
+ . Util.del_str ")" . eol
+ . entry* . entry_noeol?
+ . Util.indent . Util.del_str ";;" . eol ] in
+diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug
+index 6b2210e..9484754 100644
+--- a/lenses/tests/test_shellvars.aug
++++ b/lenses/tests/test_shellvars.aug
+@@ -562,6 +562,24 @@ fi\n" =
+ test Shellvars.lns get "for x in \"$@\"; do y=$x; done\n" =
+ { "@for" = "x in \"$@\"" { "y" = "$x" } }
+
++ (* case: support quotes and spaces in pattern lists *)
++ test lns get "case $ARG in
++ \"foo bar\")
++ Foo=0
++ ;;
++ baz | quux)
++ Foo=1
++ ;;
++esac\n" =
++ { "@case" = "$ARG"
++ { "@case_entry" = "\"foo bar\""
++ { "Foo" = "0" }
++ }
++ { "@case_entry" = "baz | quux"
++ { "Foo" = "1" }
++ }
++ }
++
+ (* Local Variables: *)
+ (* mode: caml *)
+ (* End: *)
+--
+2.1.0
+