Fix reading multi-line quoted here-documents
* geesh/lexer.scm (get-quoted-here-doc): Use the correct line-reading procedure when looping. * tests/lexer.scm: Add test.
This commit is contained in:
parent
48ee11a6fb
commit
8b945a77a9
|
@ -561,7 +561,7 @@ marks the end of the here-document."
|
|||
(let ((line* (string-trim-right line #\newline)))
|
||||
(if (string=? line* end)
|
||||
`(<sh-quote> ,(string-concatenate-reverse acc))
|
||||
(loop (get-line port) (cons line acc)))))))
|
||||
(loop (read-line port 'concat) (cons line acc)))))))
|
||||
|
||||
(define (get-unquoted-here-doc end port)
|
||||
"Get an unquoted here-document string from @var{port}, where
|
||||
|
|
|
@ -299,6 +299,10 @@
|
|||
'(HERE-DOC (0 . 7) (<sh-quote> "$x\n"))
|
||||
(get-here-doc* "eof" "$x\neof" #:quoted? #t))
|
||||
|
||||
(test-equal "Lexes a multi-line quoted here-document"
|
||||
'(HERE-DOC (0 . 8) (<sh-quote> "a\nb\n"))
|
||||
(get-here-doc* "eof" "a\nb\neof" #:quoted? #t))
|
||||
|
||||
(test-equal "Lexes a here-document with tab trimming"
|
||||
'(HERE-DOC (0 . 15) (<sh-quote> "foo\nbar\n"))
|
||||
(get-here-doc* "eof" "\tfoo\n\tbar\n\teof" #:trim-tabs? #t))
|
||||
|
|
Loading…
Reference in New Issue