Flatten AST form for multiple assignments
* geesh/parser.scm (make-parser): Instead of using a nested list for assignments, use a flat list. * tests/parser.scm: Adjust existing test for this (which checks a single assignment) and add a second test which checks multiple assignments.
This commit is contained in:
parent
2f5d074ca3
commit
2b05199562
|
@ -383,7 +383,7 @@ the same number of times.)"
|
|||
: (let*-values (((redirects assignments*) (partition io-redirect? $1))
|
||||
((assignments) (map split-assignment assignments*)))
|
||||
(match redirects
|
||||
(() `(<sh-set!> ,assignments))
|
||||
(() `(<sh-set!> ,@assignments))
|
||||
(_ `(<sh-with-redirects> ,redirects
|
||||
,(if (null? assignments)
|
||||
#f
|
||||
|
|
|
@ -65,9 +65,13 @@
|
|||
(parse "2>&1"))
|
||||
|
||||
(test-equal "Parses assignments"
|
||||
'(<sh-set!> (("FOO" "bar")))
|
||||
'(<sh-set!> ("FOO" "bar"))
|
||||
(parse "FOO=bar"))
|
||||
|
||||
(test-equal "Parses multiple assignments"
|
||||
'(<sh-set!> ("FOO" "bar") ("BAZ" "quux"))
|
||||
(parse "FOO=bar BAZ=quux"))
|
||||
|
||||
;; Boolean expressions
|
||||
|
||||
(test-equal "Parses disjunctions"
|
||||
|
|
Loading…
Reference in New Issue