Пример #1
0
 public void Visit(ExprMulNode node)
 {
     foreach (var subnode in node)
     {
         Visit((dynamic)subnode);
     }
 }
Пример #2
0
        public Node ExprMul()
        {
            var node1 = ExprUnary();

            while (firstOfExprMul.Contains(CurrentToken))
            {
                var node2 = new ExprMulNode();
                switch (CurrentToken)
                {
                case TokenCategory.MUL:
                    node2.AnchorToken = Expect(TokenCategory.MUL);
                    break;

                case TokenCategory.MOD:
                    node2.AnchorToken = Expect(TokenCategory.MOD);
                    break;

                case TokenCategory.DIV:
                    node2.AnchorToken = Expect(TokenCategory.DIV);
                    break;

                default:
                    throw new SyntaxError(firstOfExprMul, tokenStream.Current);
                }
                node2.Add(node1);
                node2.Add(ExprUnary());
                node1 = node2;
            }
            return(node1);
        }