Exemple #1
0
 public void Visit(ExprAddNode node)
 {
     foreach (var subnode in node)
     {
         Visit((dynamic)subnode);
     }
 }
        public Node ExprAdd()
        {
            var node1 = ExprMul();

            while (CurrentToken == TokenCategory.PLUS || CurrentToken == TokenCategory.NEG)
            {
                var node2 = new ExprAddNode();
                if (CurrentToken == TokenCategory.NEG)
                {
                    node2.AnchorToken = Expect(TokenCategory.NEG);
                }
                else
                {
                    node2.AnchorToken = Expect(TokenCategory.PLUS);
                }
                node2.Add(node1);
                node2.Add(ExprMul());
                node1 = node2;
            }
            return(node1);
        }