Skip to content

Commit

Permalink
fix tokenising validation
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresrhys authored Jan 7, 2017
1 parent 82b067b commit 3731986
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function constructAST (tokens) {
//... note the aggregator name
const aggregator = token.value;
token = tokens[++current];
if (token.type !== 'paren' && token.value !== '(') {
if (token.type !== 'paren' || token.value !== '(') {
throw new Error('aggregators must be followed by opening parenthesis');
}

Expand Down Expand Up @@ -230,7 +230,7 @@ function constructAST (tokens) {
if (token.type === 'function') {
const func = token.value;
token = tokens[++current];
if (token.type !== 'paren' && token.value !== '(') {
if (token.type !== 'paren' || token.value !== '(') {
throw new Error('functions must be followed by opening parenthesis');
}
token = tokens[++current];
Expand Down

0 comments on commit 3731986

Please sign in to comment.