From 0563e64fdd8c8ce3b97d58909697ff7f61c29adb Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Thu, 4 Dec 2014 18:25:12 +0200 Subject: [PATCH 2/5] Shellvars: allow wrapping builtin arguments to multiple lines --- lenses/shellvars.aug | 2 +- lenses/tests/test_shellvars.aug | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug index 60091a9..645d6ed 100644 --- a/lenses/shellvars.aug +++ b/lenses/shellvars.aug @@ -44,7 +44,7 @@ module Shellvars = let anyquot = (char|dquot|squot|dollar_assign|dollar_arithm)+ | bquot | dbquot - let to_semicol_re = /[^#; \t\n][^#;\n]+[^#; \t\n]|[^#; \t\n]+/ + let to_semicol_re = /([^#; \t\n\\]|\\\\.)(([^#;\n\\]|\\\\(.|\n))*([^#; \t\n\\]|\\\\.))?/ let sto_to_semicol = store to_semicol_re let sto_to_semicol_quot = diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug index e4fd79f..65c2927 100644 --- a/lenses/tests/test_shellvars.aug +++ b/lenses/tests/test_shellvars.aug @@ -165,6 +165,10 @@ unset ONBOOT # We do not want this var { "@builtin" = "exit" } { "@builtin" = "exit" { "args" = "2" } } + (* Allow wrapping builtin arguments to multiple lines *) + test Shellvars.lns get "ulimit -c \\\nunlimited\n" = + { "@builtin" = "ulimit" { "args" = "-c \\\nunlimited" } } + (* Test semicolons *) test lns get "VAR1=\"this;is;a;test\"\nVAR2=this;\n" = { "VAR1" = "\"this;is;a;test\"" } -- 1.8.3.1