gash: resurrect.
This commit is contained in:
parent
0f5b538c3a
commit
13cb50af60
18
gash/peg.scm
18
gash/peg.scm
|
@ -307,27 +307,15 @@
|
|||
;; (('assignment a b)
|
||||
;; `(assignment ,(transform a) ,(map transform b)))
|
||||
|
||||
|
||||
(('for-clause name sequence (and body ('pipeline _ ...)))
|
||||
`(for ,(transform name) (lambda _ ,(transform sequence)) (lambda _ ,(transform body))))
|
||||
(('for-clause name expr body)
|
||||
`(for ,(transform name) (lambda _ ,(transform expr)) (lambda _ ,@(map transform body))))
|
||||
(('sequence o)
|
||||
`(sequence ,@(fold-right (lambda (o r)
|
||||
(cons
|
||||
(match o
|
||||
(('substitution x) (transform o))
|
||||
(_ `(list ,(transform o))))
|
||||
r))
|
||||
'() o)))
|
||||
`(sequence (string-split ,(transform o) #\space)))
|
||||
(('sequence o ...)
|
||||
`(sequence ,@(fold-right (lambda (o r)
|
||||
(cons
|
||||
(match o
|
||||
(('substitution x) (transform o))
|
||||
(_ `(list ,(transform o))))
|
||||
r))
|
||||
'() o)))
|
||||
`(sequence (quote ,(map transform o))))
|
||||
|
||||
(('substitution o) `(substitution ,(transform o)))
|
||||
(('if-clause expr then) `(if-clause ,(transform expr) ,(transform then)))
|
||||
(('if-clause expr then else) `(if-clause ,(transform expr) ,(transform then) ,(transform else)))
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
glob
|
||||
if-clause
|
||||
ignore-error
|
||||
literal
|
||||
pipeline
|
||||
run
|
||||
script
|
||||
|
@ -144,6 +145,9 @@
|
|||
(define (xtrace o)
|
||||
(o))
|
||||
|
||||
(define (literal o)
|
||||
o)
|
||||
|
||||
(define (word . o)
|
||||
(define (flatten o)
|
||||
(match o
|
||||
|
|
3
test.sh
3
test.sh
|
@ -6,7 +6,8 @@ SHELL=bin/gash
|
|||
for f in test/*.sh; do
|
||||
echo -n "$f: "
|
||||
b=test/$(basename $f .sh)
|
||||
$SHELL --geesh -e $f
|
||||
# $SHELL --geesh -e $f
|
||||
$SHELL -e $f
|
||||
r=$?
|
||||
if [ -f $b.exit ]; then
|
||||
e=$(cat $b.exit)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
for file in `echo ar.o arscan.o`; do
|
||||
echo compiling ${file}...
|
||||
echo compiling $file...
|
||||
done
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
echo foo "bar" '"baz"' \"bla\"
|
Loading…
Reference in New Issue