zilch-lang/nstar

Reject end of lines in characters

Closed this issue · 1 comments

At the moment, the lexer allows the following:

'
'

which is definetely an error. This is because of how character lexing is handled in the compiler (see https://github.com/nihil-lang/nsc/blob/6b7304210ceb0d583304a860c2dc303bb40e7aa4/lib/nsc-parser/src/Language/NStar/Syntax/Lexer.hs#L157) where MP.anySingle accepts any character. We instead want to reject any end of line character (\n or \r). We could really use MP.satisfy (not . isNewline) instead, this should be a quick fix.

The test https://github.com/nihil-lang/nsc/blob/develop/test/error_lx_eolChar.nst should pass when it is fixed.

Fixed by 033c7d7 on branch develop.