예제 #1
0
        protected override void InitChildren(ParseTreeNode treeNode)
        {
            if (treeNode.FirstChild.FirstChild.AstNode is DeclarationNode)
            {
                Declaration = treeNode.FirstChild.FirstChild.AstNode as DeclarationNode;
                Assign      = treeNode.FirstChild.LastChild.AstNode as AssignNode;
            }
            else
            {
                Declaration = treeNode.FirstChild.AstNode as DeclarationNode;
                Assign      = treeNode.LastChild.AstNode as AssignNode;
            }

            Name      = Declaration.Name;
            TypeToken = Declaration.Name;
            AsString  = "VariableDeclaration";
        }
예제 #2
0
        public override void Init(ParsingContext context, ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            if (treeNode.ChildNodes[0].AstNode is UoFieldExpressionNode)
            {
                Field  = (UoFieldExpressionNode)treeNode.ChildNodes[0].AstNode;
                Assign = (AssignNode)treeNode.ChildNodes[1].AstNode;
            }
            else if (treeNode.ChildNodes[0].AstNode is UnaryAssign)
            {
                Field  = ((UnaryAssign)treeNode.ChildNodes[0].AstNode).Field;
                Assign = (UnaryAssign)treeNode.ChildNodes[0].AstNode;
            }

            ChildNodes.Add(Field);
            ChildNodes.Add(Assign);
            Field.Parent = Assign.Parent = this;
        }