mirror of
https://github.com/jamiebuilds/the-super-tiny-compiler.git
synced 2024-10-27 20:34:08 +00:00
replaced while loop condition with an effecient equivalent in parser function
This commit is contained in:
parent
4f7a85a9f8
commit
4248c7c465
@ -649,10 +649,7 @@ function parser(tokens) {
|
|||||||
// So we create a `while` loop that will continue until it encounters a
|
// So we create a `while` loop that will continue until it encounters a
|
||||||
// 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.value !== ')') {
|
||||||
(token.type !== 'paren') ||
|
|
||||||
(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`.
|
||||||
node.params.push(walk());
|
node.params.push(walk());
|
||||||
|
Loading…
Reference in New Issue
Block a user