Selaa lähdekoodia

Handle nested expressions

master
Dylan Baker 7 vuotta sitten
vanhempi
commit
a6b691807d
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. 3
    1
      src/parser.js

+ 3
- 1
src/parser.js Näytä tiedosto

28
     functionCallNode.args = []
28
     functionCallNode.args = []
29
     functionCallNode.subtree = []
29
     functionCallNode.subtree = []
30
 
30
 
31
-    while (!tokenTypesToEndTheLoop.includes(this.tokens.peek().type)) {
31
+    while (this.tokens.peek().type != tokenTypes.CPAREN) {
32
       if (this.tokens.peek().type === tokenTypes.ATTRIBUTE) {
32
       if (this.tokens.peek().type === tokenTypes.ATTRIBUTE) {
33
         functionCallNode.args.push(this.attribute())
33
         functionCallNode.args.push(this.attribute())
34
+      } else if (this.tokens.peek().type === tokenTypes.OPAREN) {
35
+        functionCallNode.subtree = this.expr()
34
       }
36
       }
35
     }
37
     }
36
 
38
 

Loading…
Peruuta
Tallenna