Skip to content

Commit f17e804

Browse files
d-alonsoinaki-amatria
authored andcommitted
Consume end_of_statement
instead of skipping. This makes the `end_of_statement` parsed tokens hold the correct location information (except comments, which are not consumed so that they can also be consumed as `comment` tokens).
1 parent 82abe50 commit f17e804

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/scanner.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static bool scan_end_of_statement(Scanner *scanner, TSLexer *lexer) {
224224

225225
// Semicolons and EOF always end the statement
226226
if (lexer->eof(lexer)) {
227-
skip(lexer);
227+
advance(lexer);
228228
lexer->result_symbol = END_OF_STATEMENT;
229229
return true;
230230
}
@@ -238,13 +238,13 @@ static bool scan_end_of_statement(Scanner *scanner, TSLexer *lexer) {
238238
// '\r' to cover unix, MSDOS and old style Macintosh.
239239
// Handle comments here too, but don't consume them
240240
if (lexer->lookahead == '\r') {
241-
skip(lexer);
241+
advance(lexer);
242242
if (lexer->lookahead == '\n') {
243-
skip(lexer);
243+
advance(lexer);
244244
}
245245
} else {
246246
if (lexer->lookahead == '\n') {
247-
skip(lexer);
247+
advance(lexer);
248248
} else if (lexer->lookahead != '!') {
249249
// Not a newline and not a comment, so not an
250250
// end-of-statement

0 commit comments

Comments
 (0)