Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 5 additions & 2 deletions src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,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)) {
Comment thread
aspeddro marked this conversation as resolved.
// Ignore new lines before `and` keyword (recursive definition)
in_multiline_statement = true;
}
}
}
} else if (lexer->lookahead == 'e') {
Expand Down
13 changes: 12 additions & 1 deletion test/corpus/expressions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,8 @@ Subscript expressions

myArray[42]
myObj["foo"]
andd[0]
andd[1]

--------------------------------------------------------------------------------

Expand All @@ -1620,7 +1622,16 @@ myObj["foo"]
(subscript_expression
(value_identifier)
(string
(string_fragment)))))
(string_fragment))))

(expression_statement
(subscript_expression
(value_identifier)
(number)))
(expression_statement
(subscript_expression
(value_identifier)
(number))))

================================================================================
Variants
Expand Down
Loading