Make reference operators more consistent
* geesh/lexer.scm (get-parameter-expression): Use '#f' to signal an omitted optional word instead of just omitting the word in the resulting form. * tests/lexer.scm: Add a test for omitted optional words.
This commit is contained in:
parent
c802fd2fca
commit
0afb2523f7
|
@ -296,7 +296,7 @@ leading '$')."
|
|||
(match (get-char port)
|
||||
(#\} (match `(,parameter ,operator ,word)
|
||||
((p #f #f) `(<sh-ref> ,p))
|
||||
((p o #f) `(,o ,p))
|
||||
((p o #f) `(,o ,p #f))
|
||||
((p o w) `(,o ,p ,w)))))))))))
|
||||
|
||||
(define (get-parameter-expansion port)
|
||||
|
|
|
@ -161,6 +161,10 @@
|
|||
("#" . <sh-ref-skip-min>)
|
||||
("##" . <sh-ref-skip-max>)))
|
||||
|
||||
(test-equal "Recognizes a parameter expansion operator without default"
|
||||
'((WORD (0 . 7) (<sh-ref-or> "foo" #f)))
|
||||
(tokenize "${foo-}"))
|
||||
|
||||
(test-equal "Splits multidigit parameter name without braces"
|
||||
'((WORD (0 . 3) ((<sh-ref> "1") "2")))
|
||||
(tokenize "$12"))
|
||||
|
|
Loading…
Reference in New Issue