diff --git a/lib/parser.js b/lib/parser.js index 3aba332..d88fa8c 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -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'); } @@ -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];