Fix empty range for ternary question mark
skip() was used after the qmark token, which resets the start position:
@@ -172,19 +172,19 @@ static bool scan_ternary_qmark(TSLexer *lexer) {
/* Optional chaining. */
if (lexer->lookahead == '.') return false;
+ lexer->mark_end(lexer);
+ lexer->result_symbol = TERNARY_QMARK;
+
/* TypeScript optional arguments contain the ?: sequence, possibly
with whitespace. */
for(;;) {
if (!iswspace(lexer->lookahead)) break;
- skip(lexer);
+ advance(lexer);
}
if (lexer->lookahead == ':') return false;
if (lexer->lookahead == ')') return false;
if (lexer->lookahead == ',') return false;
- lexer->mark_end(lexer);
- lexer->result_symbol = TERNARY_QMARK;
-
if (lexer->lookahead == '.') {
advance(lexer);
if (iswdigit(lexer->lookahead)) return true;
