コード例 #1
0
        // Returns NExprBitOr or any of subproduction nodes
        public Node ExprBitOr()
        {
            Node resultingNode = ExprBitAnd();

            while (CurrentToken == TokenCategory.BIT_OR || CurrentToken == TokenCategory.XOR)
            {
                NExprBitOr tmp = new NExprBitOr();
                tmp.Add(resultingNode);
                resultingNode = tmp;
                switch (CurrentToken)
                {
                case TokenCategory.BIT_OR: {
                    resultingNode.AnchorToken = Expect(TokenCategory.BIT_OR);
                    resultingNode.Add(ExprBitAnd());
                    break;
                }

                case TokenCategory.XOR: {
                    resultingNode.AnchorToken = Expect(TokenCategory.XOR);
                    resultingNode.Add(ExprBitAnd());
                    break;
                }
                    // Default case would be unreachable
                }
            }
            return(resultingNode);
        }
コード例 #2
0
        public string Visit(NExprBitOr nExprBitOr)
        {
            string retVal = "";

            if (nExprBitOr.children.Count == 1)
            {
                retVal += Visit((dynamic)nExprBitOr[0]);
            }
            else
            {
                switch (nExprBitOr.AnchorToken.Lexeme)
                {
                case "^": {
                    retVal += Visit((dynamic)nExprBitOr[0]);
                    retVal += Visit((dynamic)nExprBitOr[1]);
                    retVal += "\t\txor\n";
                    break;
                }

                case "|": {
                    retVal += Visit((dynamic)nExprBitOr[0]);
                    retVal += Visit((dynamic)nExprBitOr[1]);
                    retVal += "\t\tor\n";
                    break;
                }
                }
            }
            return(retVal);
        }
コード例 #3
0
//------------------------------------------------------------
        public void Visit(NExprBitOr node)
        {
            Console.WriteLine($"+++++++++++++++ NExprBitOr ++++++++++++++++");

            //VisitChildren(node);
        }
コード例 #4
0
 public void Visit(NExprBitOr nExprBitOr)
 {
     GenericChildVisitor(nExprBitOr);
 }