nesting delimited
This commit is contained in:
parent
d1c268cd6a
commit
8b1a499d74
|
@ -102,7 +102,13 @@ copyleft.
|
|||
(('simple-command ('word s)) (list (transform s)))
|
||||
(('simple-command ('word s1) ('word s2)) (list (transform s1) (transform s2)))
|
||||
(('simple-command ('word s1) (('word s2) ...)) (cons (transform s1) (map transform s2)))
|
||||
(('literal s) s)
|
||||
(('literal s) (transform s))
|
||||
(('singlequotes s) (string-concatenate (list "'" s "'")))
|
||||
(('doublequotes s) (string-concatenate (list "\"" s "\"")))
|
||||
(('backticks s) (string-concatenate (list "`" s "`")))
|
||||
(('delim ('singlequotes s ...)) (string-concatenate (map transform s)))
|
||||
(('delim ('doublequotes s ...)) (string-concatenate (map transform s)))
|
||||
(('delim ('backticks s ...)) (string-concatenate (map transform s)))
|
||||
((('pipe _) command ...) (map transform command))
|
||||
(((('pipe _) command) ...) (map transform command))
|
||||
((_ o) (transform o))
|
||||
|
|
|
@ -64,7 +64,13 @@
|
|||
assign < '='
|
||||
literal <-- (subst / delim / (![0-9] (![()] !io-op !sp !nl !break !pipe !assign .)+) / ([0-9]+ &separator)) literal*
|
||||
subst <-- '$' ('$' / '*' / '@' / [0-9] / identifier / ([{] (![}] .)+ [}]))
|
||||
delim <- (['] (!['] .)* [']) / ([\"] (![\"] .)* [\"]) / ([`] (![`] .)* [`])
|
||||
delim <-- singlequotes / doublequotes / backticks
|
||||
sq < [']
|
||||
dq < [\"]
|
||||
bt < [`]
|
||||
singlequotes <-- (sq (doublequotes / backticks / (!sq .))* sq)
|
||||
doublequotes <-- (dq (singlequotes / backticks / (!dq .))* dq)
|
||||
backticks <-- (bt (singlequotes / doublequotes / (!bt .))* bt)
|
||||
separator <-- (sp* break !semi ws*) / ws*
|
||||
break <-- amp / semi
|
||||
sequential-sep <-- (semi ws*) / ws+
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
echo 'foo "bar"'
|
|
@ -1 +1 @@
|
|||
$(ls)
|
||||
echo "$(ls)"
|
||||
|
|
Loading…
Reference in New Issue