feat: support not operator, #575

This commit is contained in:
Harttle
2023-01-03 01:34:03 +08:00
committed by Harttle
parent aafaa0b4f9
commit 3f21382d43
7 changed files with 74 additions and 33 deletions
+9 -11
View File
@@ -26,20 +26,18 @@ export class Tokenizer {
}
* readExpressionTokens (): IterableIterator<Token> {
const operand = this.readValue()
if (!operand) return
yield operand
while (this.p < this.N) {
const operator = this.readOperator()
if (!operator) return
if (operator) {
yield operator
continue
}
const operand = this.readValue()
if (!operand) return
yield operator
yield operand
if (operand) {
yield operand
continue
}
return
}
}
readOperator (): OperatorToken | undefined {