Skip to content

Commit 876bdd9

Browse files
author
jonas.ong
committed
fix not operator parsing
1 parent c9ac9ed commit 876bdd9

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

src/tokenizer/tokenizer.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -462,23 +462,12 @@ export class Tokenizer {
462462
if (specialIdent !== undefined) {
463463
/* Merge multi-token operators, like 'is not', 'not in' */
464464
const previousToken = this.tokens[this.tokens.length - 1];
465-
switch (specialIdent) {
466-
case TokenType.NOT:
467-
if (previousToken.type === TokenType.IS) {
468-
this.overwriteToken(TokenType.ISNOT);
469-
} else {
470-
this.addToken(specialIdent);
471-
}
472-
return;
473-
case TokenType.IN:
474-
if (previousToken.type === TokenType.NOT) {
475-
this.overwriteToken(TokenType.NOTIN);
476-
} else {
477-
this.addToken(specialIdent);
478-
}
479-
return;
480-
default:
481-
this.addToken(specialIdent);
465+
if (specialIdent === TokenType.NOT && previousToken?.type === TokenType.IS) {
466+
this.overwriteToken(TokenType.ISNOT);
467+
} else if (specialIdent === TokenType.IN && previousToken?.type === TokenType.NOT) {
468+
this.overwriteToken(TokenType.NOTIN);
469+
} else {
470+
this.addToken(specialIdent);
482471
}
483472
} else {
484473
this.addToken(TokenType.NAME);

0 commit comments

Comments
 (0)