Fix CRLF handling in external scanner

This commit is contained in:
Max Brunsfeld 2019-07-03 12:01:02 -07:00
parent 7b6777bc56
commit 3b15f16973
2 changed files with 14 additions and 0 deletions

13
corpus/crlf.txt Normal file
View File

@ -0,0 +1,13 @@
================================
Variables with CRLF line endings
================================
A=one
B=two
---
(program
(variable_assignment (variable_name) (word))
(variable_assignment (variable_name) (word)))

1
src/scanner.cc vendored
View File

@ -213,6 +213,7 @@ struct Scanner {
if ( if (
lexer->lookahead == ' ' || lexer->lookahead == ' ' ||
lexer->lookahead == '\t' || lexer->lookahead == '\t' ||
lexer->lookahead == '\r' ||
(lexer->lookahead == '\n' && !valid_symbols[NEWLINE]) (lexer->lookahead == '\n' && !valid_symbols[NEWLINE])
) { ) {
skip(lexer); skip(lexer);