Support elif.
This commit is contained in:
parent
90325b22a2
commit
9a96816b5d
5
check.sh
5
check.sh
|
@ -45,6 +45,11 @@ tests="
|
||||||
10-if
|
10-if
|
||||||
10-if-false
|
10-if-false
|
||||||
10-if-word-variable
|
10-if-word-variable
|
||||||
|
10-if-multiple
|
||||||
|
10-if-else
|
||||||
|
10-else-multiple
|
||||||
|
10-if-elif
|
||||||
|
|
||||||
11-for
|
11-for
|
||||||
11-for-split-sequence
|
11-for-split-sequence
|
||||||
|
|
||||||
|
|
|
@ -350,6 +350,8 @@
|
||||||
(('substitution o) `(substitution ,(transform o)))
|
(('substitution o) `(substitution ,(transform o)))
|
||||||
(('if-clause expr then) `(if-clause ,(transform expr) ,(transform then)))
|
(('if-clause expr then) `(if-clause ,(transform expr) ,(transform then)))
|
||||||
(('if-clause expr then else) `(if-clause ,(transform expr) ,(transform then) ,(transform else)))
|
(('if-clause expr then else) `(if-clause ,(transform expr) ,(transform then) ,(transform else)))
|
||||||
|
(('elif-part expr then) `(if-clause ,(transform expr) ,(transform then)))
|
||||||
|
(('elif-part expr then else) `(if-clause ,(transform expr) ,(transform then) ,(transform else)))
|
||||||
(('then-part o ...) `(begin ,@(map transform o)))
|
(('then-part o ...) `(begin ,@(map transform o)))
|
||||||
(('else-part o ...) `(begin ,@(map transform o)))
|
(('else-part o ...) `(begin ,@(map transform o)))
|
||||||
(('word 'singlequotes) "")
|
(('word 'singlequotes) "")
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
if false; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo one
|
||||||
|
echo two
|
||||||
|
fi
|
|
@ -0,0 +1,2 @@
|
||||||
|
one
|
||||||
|
two
|
|
@ -0,0 +1,8 @@
|
||||||
|
if false; then
|
||||||
|
exit 1
|
||||||
|
elif false; then
|
||||||
|
exit 2
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 1
|
|
@ -0,0 +1,6 @@
|
||||||
|
if false; then
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 1
|
|
@ -0,0 +1,4 @@
|
||||||
|
if true; then
|
||||||
|
echo one
|
||||||
|
echo two
|
||||||
|
fi
|
|
@ -0,0 +1,2 @@
|
||||||
|
one
|
||||||
|
two
|
Loading…
Reference in New Issue