blob: 624fb7b8f0c48244cfc4ddb63cc82812c15da17e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
From c39d0c16a8cf540816df94b28f428e3ef3ce2579 Mon Sep 17 00:00:00 2001
From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Date: Thu, 4 Dec 2014 18:25:12 +0200
Subject: [PATCH 06/19] Shellvars: allow wrapping builtin arguments to multiple
lines
---
lenses/shellvars.aug | 4 +---
lenses/tests/test_shellvars.aug | 5 +++++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug
index 78b1d16..227e2a3 100644
--- a/lenses/shellvars.aug
+++ b/lenses/shellvars.aug
@@ -46,9 +46,7 @@ module Shellvars =
let dollar_arithm = /\$\(\([^\)#\n]*\)\)/
let anyquot = (char|dquot|squot|dollar_assign|dollar_arithm)+ | bquot | dbquot
-
- let to_semicol_re = /[^#; \t\n][^#;\n]+[^#; \t\n]|[^#; \t\n]+/
- let sto_to_semicol = store to_semicol_re
+ let sto_to_semicol = store (anyquot . (Rx.space . anyquot)*)
let sto_to_semicol_quot =
let no_semicol_re = /[^"'#;\n]/
diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug
index 065130a..bf92735 100644
--- a/lenses/tests/test_shellvars.aug
+++ b/lenses/tests/test_shellvars.aug
@@ -165,6 +165,11 @@ 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\nulimit \\\n -x 123\n" =
+ { "@builtin" = "ulimit" { "args" = "-c \\\nunlimited" } }
+ { "@builtin" = "ulimit" { "args" = "\\\n -x 123" } }
+
(* Test semicolons *)
test lns get "VAR1=\"this;is;a;test\"\nVAR2=this;\n" =
{ "VAR1" = "\"this;is;a;test\"" }
--
2.5.0
|