Skip to content
Merged
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
8 changes: 8 additions & 0 deletions src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ void tree_sitter_rescript_external_scanner_deserialize(void* state, const char *

static void advance(TSLexer *lexer) { lexer->advance(lexer, false); }

static bool is_inline_whitespace(int32_t c) {
return c == ' ' || c == '\t';
}

static void scan_whitespace(TSLexer *lexer, bool skip) {
while (iswspace(lexer->lookahead) && !lexer->eof(lexer)) {
lexer->advance(lexer, skip);
Expand Down Expand Up @@ -133,6 +137,10 @@ bool tree_sitter_rescript_external_scanner_scan(
ScannerState* state = (ScannerState*)payload;
const in_string = state->in_quotes || state->in_backticks;

while (is_inline_whitespace(lexer->lookahead) && !in_string) {
advance(lexer);
}

if (valid_symbols[TEMPLATE_CHARS]) {
lexer->result_symbol = TEMPLATE_CHARS;
for (bool has_content = false;; has_content = true) {
Expand Down