Fix whitespace skipping in scanner

Once again, implicit fall-through is the devil.
This commit is contained in:
Bruno BELANYI 2022-06-02 22:27:00 +02:00
parent 61f03a116c
commit 751929a058
2 changed files with 40 additions and 1 deletions

View file

@ -29,6 +29,7 @@ static void skip_whitespace(TSLexer *lexer) {
case '\n':
case '\r':
lexer->advance(lexer, true);
break;
default:
return;
}

View file

@ -42,7 +42,6 @@ Comment with slashes
(source_file
(comment))
================================================================================
Comment with asterisks
================================================================================
@ -90,3 +89,42 @@ Comment end-delimiter only
(ERROR
(operator)
(operator)))
================================================================================
Comment in real code
================================================================================
let
/* This is a comment */
var a := 12
/* This is an other comment */
var b := 27
/* Yet another comment */
in
/* This is the final comment */
(a + b) <> 42
/* Sike! This is the *actual* final comment */
end
--------------------------------------------------------------------------------
(source_file
(let_expression
(comment)
(variable_declaration
(identifier)
(integer_literal))
(comment)
(variable_declaration
(identifier)
(integer_literal))
(comment)
(comment)
(binary_expression
(sequence_expression
(binary_expression
(identifier)
(operator)
(identifier)))
(operator)
(integer_literal))
(comment)))