Skip to content

Commit

Permalink
fix: conflict with indentifiers starting with 'e'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nsidorenco committed Jul 29, 2024
1 parent 77e60fb commit 28b43d0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,9 @@ bool tree_sitter_fsharp_external_scanner_scan(void *payload, TSLexer *lexer,
}
} else if (lexer->lookahead == 'e' &&
(valid_symbols[ELSE] || valid_symbols[ELIF] ||
valid_symbols[DEDENT] || valid_symbols[END])) {
lexer->mark_end(lexer);
int16_t token_indent_level = lexer->get_column(lexer);
valid_symbols[END] || valid_symbols[DEDENT])) {
advance(lexer);
int16_t token_indent_level = lexer->get_column(lexer);
if (lexer->lookahead == 'l') {
advance(lexer);
if (lexer->lookahead == 's' &&
Expand Down
38 changes: 38 additions & 0 deletions test/corpus/expr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3214,3 +3214,41 @@ do
(identifier))))
(long_identifier_or_op
(identifier))))))))))

================================================================================
if-then-else follow by identifier starting with 'e'
================================================================================

let f x =
let a = if b then 0 else 1
exit b

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

(file
(value_declaration
(function_or_value_defn
(function_declaration_left
(identifier)
(argument_patterns
(long_identifier
(identifier))))
(declaration_expression
(function_or_value_defn
(value_declaration_left
(identifier_pattern
(long_identifier_or_op
(identifier))))
(if_expression
(long_identifier_or_op
(identifier))
(const
(int))
(const
(int))))
(application_expression
(long_identifier_or_op
(identifier))
(long_identifier_or_op
(long_identifier
(identifier))))))))

0 comments on commit 28b43d0

Please sign in to comment.