Skip to content
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
463 changes: 184 additions & 279 deletions grammar.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,11 @@ bool tree_sitter_rescript_external_scanner_scan(
if (lexer->lookahead == 'n') {
advance(lexer);
if (lexer->lookahead == 'd') {
// Ignore new lines before `and` keyword (recursive definition)
in_multiline_statement = true;
advance(lexer);
if (is_whitespace(lexer->lookahead)) {
// Ignore new lines before `and` keyword (recursive definition)
in_multiline_statement = true;
}
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/corpus/comments.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ switch foo {
(number))
(expression_statement
(pipe_expression
(value_identifier)
(value_name)
(comment)
(value_identifier)))
(value_name)))
(expression_statement
(switch_expression
(value_identifier)
(value_name)
(switch_match
(number)
(sequence_expression
Expand Down
3 changes: 2 additions & 1 deletion test/corpus/decorators.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,5 @@ Decorator with type
(decorator_identifier)
(decorator_arguments
(type_annotation
(type_identifier)))))
(type_constructor_path
(type_constructor))))))
Loading