Fix AST for redirects and assignments

This should have been in 2b05199562, but
it was overlooked.

* geesh/parser.scm (make-parser): Splice in arguments in the redirect
case (to be consistent with the non-redirect case).
* tests/parser.scm: Add a test for this.
This commit is contained in:
Timothy Sample 2018-11-15 14:28:55 -05:00
parent 870c10b37a
commit 48e122c42f
2 changed files with 6 additions and 1 deletions

View File

@ -490,7 +490,7 @@ the same number of times.)"
(_ `(<sh-with-redirects> ,redirects
,(if (null? assignments)
#f
`(<sh-set!> ,assignments))))))
`(<sh-set!> ,@assignments))))))
(cmd-name cmd-suffix)
: (let-values (((redirects args) (partition io-redirect? $2)))
(match redirects

View File

@ -99,6 +99,11 @@
'(<sh-set!> ("FOO" "bar") ("BAZ" "quux"))
(parse "FOO=bar BAZ=quux"))
(test-equal "Parses redirects with assignments but no command"
'(<sh-with-redirects> ((> 2 "bar"))
(<sh-set!> ("FOO" "bar")))
(parse "FOO=bar 2>bar"))
;; Boolean expressions
(test-equal "Parses disjunctions"