Fix whitespace skipping in scanner
Once again, implicit fall-through is the devil.
This commit is contained in:
parent
61f03a116c
commit
751929a058
|
@ -29,6 +29,7 @@ static void skip_whitespace(TSLexer *lexer) {
|
||||||
case '\n':
|
case '\n':
|
||||||
case '\r':
|
case '\r':
|
||||||
lexer->advance(lexer, true);
|
lexer->advance(lexer, true);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ Comment with slashes
|
||||||
(source_file
|
(source_file
|
||||||
(comment))
|
(comment))
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Comment with asterisks
|
Comment with asterisks
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -90,3 +89,42 @@ Comment end-delimiter only
|
||||||
(ERROR
|
(ERROR
|
||||||
(operator)
|
(operator)
|
||||||
(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)))
|
||||||
|
|
Loading…
Reference in a new issue