simplify scanner

pull/625/head^2
Nikolaj Sidorenco 2024-04-30 22:37:58 +07:00
parent 632077a079
commit d819d6c35c
No known key found for this signature in database
3 changed files with 12 additions and 9 deletions

@ -10,6 +10,10 @@ trim_trailing_whitespace = true
indent_style = space
indent_size = 2
[*.fs]
indent_style = space
indent_size = 2
[*.js]
indent_style = space
indent_size = 2

@ -1,3 +1,3 @@
do
while true do
while true do
while b do
while b do

@ -229,13 +229,6 @@ bool tree_sitter_fsharp_external_scanner_scan(void *payload, TSLexer *lexer,
}
if (found_end_of_line) {
if ((valid_symbols[DEDENT] || (!valid_symbols[NEWLINE])) &&
indent_length < current_indent_length && !found_bracket_end) {
array_pop(&scanner->indents);
lexer->result_symbol = DEDENT;
return true;
}
if (indent_length == current_indent_length && indent_length > 0 &&
!found_start_of_infix_op && !found_bracket_end) {
if (valid_symbols[NEWLINE] && !error_recovery_mode) {
@ -243,6 +236,12 @@ bool tree_sitter_fsharp_external_scanner_scan(void *payload, TSLexer *lexer,
return true;
}
}
if (indent_length < current_indent_length && !found_bracket_end) {
array_pop(&scanner->indents);
lexer->result_symbol = DEDENT;
return true;
}
}
}