You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Trildar Was unable to reproduce; I think line comment should consume one newline. Will be interested in seeing a failing sample. Added these test cases though:
(deftesttest-0880
(let [rec (lex/make-parsers (assoc lex/haskell-style :trim-newlinefalse))]
(lex/with-parsers rec
(let [in "foo bar -- this is a line comment\n\n\nbaz"
s1 (parse (many1 lex/identifier) in)]
(fact"line comment consumes until the end of the line"
(:input s1) => (seq"\n\nbaz")
(:value s1) => ["foo""bar"]
(:ok s1) => true
(:empty s1) => false)))))
(deftesttest-0885
(let [rec (lex/make-parsers (assoc lex/haskell-style :trim-newlinefalse))]
(lex/with-parsers rec
(let [in "foo bar -- this is a line comment\n\n\nbaz"
s1 (parse (<*> (many1 lex/identifier)
(skip-many white-space)
(many1 lex/identifier)) in)]
(fact"explicit whitespace removal with :trim-newline false"
(:input s1) => empty?
(:value s1) => [["foo""bar"] nil ["baz"]]
(:ok s1) => true
(:empty s1) => false)))))
(deftesttest-0890
(let [rec (lex/make-parsers lex/haskell-style)]
(lex/with-parsers rec
(let [in "foo bar -- this is a line comment\n\n\nbaz\nfoobar"
s1 (parse (many1 lex/identifier) in)]
(fact"line comment is treated as whitespace"
(:input s1) => empty?
(:value s1) => ["foo""bar""baz""foobar"]
(:ok s1) => true
(:empty s1) => false)))))
This causes inconsistent behaviour between parsing lines with trailing comments and lines without comments.
The text was updated successfully, but these errors were encountered: