From 538a158df806336142b4f2b79d89a42d68170610 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Fri, 9 Jun 2023 19:52:31 -0300 Subject: [PATCH 1/2] fix scanne and keyword --- src/scanner.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/scanner.c b/src/scanner.c index b02d8b9..11cdc7e 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -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; + } } } } From a73ed5f7bc370c03716752e155d370944e4c526c Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Sun, 27 Aug 2023 22:55:53 -0300 Subject: [PATCH 2/2] add test --- test/corpus/expressions.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/corpus/expressions.txt b/test/corpus/expressions.txt index 2764643..df78fc9 100644 --- a/test/corpus/expressions.txt +++ b/test/corpus/expressions.txt @@ -1364,6 +1364,8 @@ Subscript expressions myArray[42] myObj["foo"] +andd[0] +andd[1] -------------------------------------------------------------------------------- @@ -1376,7 +1378,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