Exemplo n.º 1
0
        public override void Init(Irony.Ast.AstContext context, Irony.Parsing.ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            var nodes = treeNode.ChildNodes;

            if (nodes.Count != 2)
            {
                throw new Exception("MtBind expects 2 children (received {0}).".SafeFormat(nodes.Count));
            }

            // AstNodeInterpreter, from Irony
            _targetName = AddChild(string.Empty, nodes[0]) as AstNode;
            if (_targetName == null)
            {
                throw new Exception("No identifier for Bind!");
            }

            // An arbitrary Mt node
            _expression = AddChild(string.Empty, nodes[1]) as MtAstNode;
            if (_expression == null)
            {
                throw new Exception("No expression for Bind!");
            }
        }
Exemplo n.º 2
0
        public override void Init(Irony.Ast.AstContext context, Irony.Parsing.ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            var nodes = treeNode.ChildNodes;
            if (nodes.Count != 2)
            {
                throw new Exception("MtBind expects 2 children (received {0}).".SafeFormat(nodes.Count));
            }

            // AstNodeInterpreter, from Irony
            _targetName = AddChild(string.Empty, nodes[0]) as AstNode;
            if (_targetName == null)
            {
                throw new Exception("No identifier for Bind!");
            }

            // An arbitrary Mt node
            _expression = AddChild(string.Empty, nodes[1]) as MtAstNode;
            if (_expression == null)
            {
                throw new Exception("No expression for Bind!");
            }
        }