Skip to content

Commit

Permalink
fix: advance whitespace if did_advance
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Sep 21, 2023
1 parent bdcd56c commit fd4e40d
Showing 1 changed file with 2 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 @@ -178,6 +178,7 @@ static inline bool scan_bare_dollar(TSLexer *lexer) {
lexer->result_symbol = BARE_DOLLAR;
lexer->mark_end(lexer);
return iswspace(lexer->lookahead) || lexer->eof(lexer);
lexer->lookahead == '\"';
}

return false;
Expand Down Expand Up @@ -291,7 +292,7 @@ static bool scan_heredoc_content(Scanner *scanner, TSLexer *lexer,
// an alternative is to check the starting column of the
// heredoc body and track that statefully
while (iswspace(lexer->lookahead)) {
skip(lexer);
did_advance ? advance(lexer) : skip(lexer);
}
if (end_type != SIMPLE_HEREDOC_BODY) {
lexer->result_symbol = middle_type;
Expand All @@ -316,8 +317,6 @@ static bool scan_heredoc_content(Scanner *scanner, TSLexer *lexer,
}

static bool scan(Scanner *scanner, TSLexer *lexer, const bool *valid_symbols) {
/* printf("scan! lookahead: %c, valid_symbols[EXPANSION_WORD]: %d\n", */
/* lexer->lookahead, valid_symbols[EXPANSION_WORD]); */
if (valid_symbols[CONCAT] && !in_error_recovery(valid_symbols)) {
if (!(lexer->lookahead == 0 || iswspace(lexer->lookahead) ||
lexer->lookahead == '>' || lexer->lookahead == '<' ||
Expand Down

0 comments on commit fd4e40d

Please sign in to comment.