From 8a18ac0a3cb6e679a0d0dcce3e820ce2c954ddfc Mon Sep 17 00:00:00 2001 From: James Kyle Date: Thu, 31 Mar 2016 08:41:54 -0700 Subject: [PATCH] Fix closing paren parsing logic --- super-tiny-compiler-unannotated.js | 4 ++-- super-tiny-compiler.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/super-tiny-compiler-unannotated.js b/super-tiny-compiler-unannotated.js index 6b98eb8..6fb0a9c 100644 --- a/super-tiny-compiler-unannotated.js +++ b/super-tiny-compiler-unannotated.js @@ -99,8 +99,8 @@ function parser(tokens) { token = tokens[++current]; while ( - token.type !== 'paren' || - token.value !== ')' + (token.type !== 'paren') || + (token.type === 'paren' && token.value !== ')') ) { node.params.push(walk()); token = tokens[current]; diff --git a/super-tiny-compiler.js b/super-tiny-compiler.js index 8ceefe9..16effec 100644 --- a/super-tiny-compiler.js +++ b/super-tiny-compiler.js @@ -577,8 +577,8 @@ function parser(tokens) { // token with a `type` of `'paren'` and a `value` of a closing // parenthesis. while ( - token.type !== 'paren' || - token.value !== ')' + (token.type !== 'paren') || + (token.type === 'paren' && token.value !== ')') ) { // we'll call the `walk` function which will return a `node` and we'll // push it into our `node.params`.