mirror of
https://github.com/jamiebuilds/the-super-tiny-compiler.git
synced 2024-10-27 20:34:08 +00:00
Fix closing paren parsing logic
This commit is contained in:
parent
900750c78e
commit
8a18ac0a3c
@ -99,8 +99,8 @@ function parser(tokens) {
|
|||||||
token = tokens[++current];
|
token = tokens[++current];
|
||||||
|
|
||||||
while (
|
while (
|
||||||
token.type !== 'paren' ||
|
(token.type !== 'paren') ||
|
||||||
token.value !== ')'
|
(token.type === 'paren' && token.value !== ')')
|
||||||
) {
|
) {
|
||||||
node.params.push(walk());
|
node.params.push(walk());
|
||||||
token = tokens[current];
|
token = tokens[current];
|
||||||
|
@ -577,8 +577,8 @@ function parser(tokens) {
|
|||||||
// token with a `type` of `'paren'` and a `value` of a closing
|
// token with a `type` of `'paren'` and a `value` of a closing
|
||||||
// parenthesis.
|
// parenthesis.
|
||||||
while (
|
while (
|
||||||
token.type !== 'paren' ||
|
(token.type !== 'paren') ||
|
||||||
token.value !== ')'
|
(token.type === 'paren' && token.value !== ')')
|
||||||
) {
|
) {
|
||||||
// we'll call the `walk` function which will return a `node` and we'll
|
// we'll call the `walk` function which will return a `node` and we'll
|
||||||
// push it into our `node.params`.
|
// push it into our `node.params`.
|
||||||
|
Loading…
Reference in New Issue
Block a user