simplify scanner.c

This commit is contained in:
mhoffm
2021-06-17 23:55:09 +02:00
parent 1f9321bdee
commit 29b4c866b4

View File

@@ -137,13 +137,8 @@ bool scanner_scan(Scanner *scanner, TSLexer *lexer, const bool *valid_symbols) {
}
// handle escape sequences in direct surrounding quoted contexts
if (valid_symbols[TEMPLATE_LITERAL_CHUNK] && scanner->quoted_context_depth > 0) {
if (valid_symbols[TEMPLATE_LITERAL_CHUNK] && scanner->in_quoted_context) {
switch (lexer->lookahead) {
case '"':
case '\n':
case '\r':
case '\t':
return false;
case '\\':
advance(lexer);
switch (lexer->lookahead) {
@@ -166,8 +161,6 @@ bool scanner_scan(Scanner *scanner, TSLexer *lexer, const bool *valid_symbols) {
default:
return false;
}
case '$':
// handled above
default:
return accept_and_advance(lexer, TEMPLATE_LITERAL_CHUNK);
}