Skip to content

Commit b1a9d5e

Browse files
committed
fix: handle '\r\n' in comment
1 parent e5d2133 commit b1a9d5e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/parser.c

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/scanner.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
enum TokenType { BRACKET_ARGUMENT, BRACKET_COMMENT, LINE_COMMENT };
55

6+
static void mark_end(TSLexer *lexer) {
7+
lexer->mark_end(lexer);
8+
}
9+
610
static void skip(TSLexer *lexer) {
711
lexer->advance(lexer, true);
812
}
@@ -68,7 +72,7 @@ static bool scan(UNUSED void *payload, TSLexer *lexer, bool const *valid_symbols
6872
lexer->result_symbol = BRACKET_COMMENT;
6973
return true;
7074
} else {
71-
while (lexer->lookahead != '\n' && lexer->lookahead != '\0') {
75+
while (lexer->lookahead != '\r' && lexer->lookahead != '\n' && lexer->lookahead != '\0') {
7276
advance(lexer);
7377
}
7478
lexer->result_symbol = LINE_COMMENT;

0 commit comments

Comments
 (0)