Skip to content

Commit

Permalink
fix: update exp-p
Browse files Browse the repository at this point in the history
  • Loading branch information
adyfk committed Dec 18, 2023
1 parent fb5845f commit 54ed386
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ExpressionParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,6 @@ export class ExpressionParser {

value = objectValue;
state.nextToken();
} else if (state.variables.hasOwnProperty(token)) {
value = state.variables[token];
state.nextToken();
} else if (this.functions.hasOwnProperty(token)) {
value = this.parseFunction(state);
} else if (this.operators.hasOwnProperty(token)) {
Expand All @@ -246,7 +243,9 @@ export class ExpressionParser {
const factor = this.parseFactor(state);
value = operator(0, factor);
} else {
throw new Error('Invalid expression');
// } else if (state.variables.hasOwnProperty(token)) {
value = state.variables[token];
state.nextToken();
}

return value;
Expand Down Expand Up @@ -310,7 +309,6 @@ export class ExpressionParser {
},
variables: tempVariables,
};

const result = this.parseExpression(state);

if (state.currentToken !== undefined) {
Expand Down
1 change: 1 addition & 0 deletions src/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createParser, FunctionMap } from '../'

describe('example', () => {

it('basic operator', () => {
const parser = createParser({
})
Expand Down

0 comments on commit 54ed386

Please sign in to comment.