From 3b15f1697346dd951da88a9fb6088c7fb2451d70 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 3 Jul 2019 12:01:02 -0700 Subject: [PATCH] Fix CRLF handling in external scanner --- corpus/crlf.txt | 13 +++++++++++++ src/scanner.cc | 1 + 2 files changed, 14 insertions(+) create mode 100644 corpus/crlf.txt diff --git a/corpus/crlf.txt b/corpus/crlf.txt new file mode 100644 index 0000000..b3d6cde --- /dev/null +++ b/corpus/crlf.txt @@ -0,0 +1,13 @@ +================================ +Variables with CRLF line endings +================================ + +A=one + +B=two + +--- + +(program + (variable_assignment (variable_name) (word)) + (variable_assignment (variable_name) (word))) diff --git a/src/scanner.cc b/src/scanner.cc index ed9fb8c..1faf40c 100644 --- a/src/scanner.cc +++ b/src/scanner.cc @@ -213,6 +213,7 @@ struct Scanner { if ( lexer->lookahead == ' ' || lexer->lookahead == '\t' || + lexer->lookahead == '\r' || (lexer->lookahead == '\n' && !valid_symbols[NEWLINE]) ) { skip(lexer);