示例#1
0
        private Expression Insert(Expression hash, SyntaxNode node)
        {
            var element = node.Accept(Compiler);
            var type    = node.Token.Type;

            return(type == TokenType.kDSTAR ? MergeHash(hash, element) : MergeAssoc(hash, element));
        }
        private InvocationArgument CreateInvocationArgument(SyntaxNode argument)
        {
            var kind       = argument.Token.Type.GetArgumentKind();
            var expression = argument.Accept(Compiler);

            return(new InvocationArgument(kind, expression));
        }
示例#3
0
        public virtual SyntaxNode Visit(SyntaxNode node)
        {
            if (node != null)
            {
                return(node.Accept(this));
            }

            return(null);
        }
示例#4
0
        public virtual TResult Visit(SyntaxNode node)
        {
            if (node != null)
            {
                return(node.Accept(this));
            }

            return(default(TResult));
        }
            private void BindNode(SyntaxNode node)
            {
                _binder._cancellationToken.ThrowIfCancellationRequested();

                // use NodeBinder to determine semantic info for this node.
                var info = node.Accept(_nodeBinder);

                // remember semantic info
                _binder.SetSemanticInfo(node, info);
            }
示例#6
0
        private void button1_Click(object sender, EventArgs e)
        {
            lstLog.Items.Clear();
            DoParse();

            if (_program != null)
            {
                //richInputBox.Text = "";

                _program.Accept(new ContextVisitor());

                //_program.Accept(new SemanticCheckVisitor());

                //_program.Accept(new ScopeCheckVisitor());
                //_program.Accept(new TypeCheckVisitor());

                /*richInputBox.Text = (string)*///
                _program.Accept(new CodeGenVisitor());
            }
            //richInputBox.Text = "Test";
        }
示例#7
0
        public override void Visit(SyntaxNode node)
        {
            if (node != null)
            {
                _recursionDepth++;
                StackGuard.EnsureSufficientExecutionStack(_recursionDepth);

                node.Accept(this);

                _recursionDepth--;
            }
        }
示例#8
0
        public Expression Compile(SyntaxNode node)
        {
            var scope = CurrentScope;
            var body  = node.Accept(this);

            body = scope.CompileBody(body);

            return(Block(
                       CallFrame.Expressions.Push(scope.CallFrame),
                       TryFinally(
                           body,
                           CallFrame.Expressions.Pop()
                           )
                       ));
        }
示例#9
0
            protected override void DefaultVisit(SyntaxNode node)
            {
                // if you can, ask your parent instead
                for (var parent = node.Parent; parent != null; parent = parent.Parent)
                {
                    if (parent is SyntaxNode parentNode)
                    {
                        parentNode.Accept(this);
                        break;  // okay, done now
                    }
                }

                // reached the top?  Look for as-operators too
                if (node.Parent == null)
                {
                    node.Accept(_asBuilder);
                }
            }
            private void VisitInScope(SyntaxNode node, ScopeKind kind)
            {
                if (node == null)
                {
                    return;
                }

                var oldScopeKind = _binder._scopeKind;

                _binder._scopeKind = kind;
                try
                {
                    node.Accept(this);
                }
                finally
                {
                    _binder._scopeKind = oldScopeKind;
                }
            }
示例#11
0
 public virtual void Visit(SyntaxNode?node)
 {
     node?.Accept(this);
 }
 protected override void DefaultVisit(SyntaxNode node)
 {
     // if we get here, fall back to normal expression binding.
     node.Accept(_treeBinder);
 }
示例#13
0
 public virtual T Visit(SyntaxNode syntaxNode)
 {
     return(syntaxNode != null?syntaxNode.Accept(this) : default(T));
 }
示例#14
0
 public virtual void Visit(SyntaxNode node) => node.Accept(this);
示例#15
0
 void HandleExpr(SyntaxNode n)
 {
     n.Accept(new ExprBuilder(this));
 }
示例#16
0
 public void Visit(SyntaxNode node)
 {
     Debug.Assert(node != null, "null");
     node.Accept(this);
 }
 public virtual void Visit(SyntaxNode node)
 {
     if (node != null)
         node.Accept(this);
 }
示例#18
0
 public override void Visit(SyntaxNode node)
 {
     node?.Accept(this);
 }
示例#19
0
        public LiteValue Eval(SyntaxNode Node)
        {
            var V = new EvalVisitor();

            return(Node.Accept(V, Env_));
        }
示例#20
0
 private BoundExpression BuildExpression(SyntaxNode syntax)
 {
     return (BoundExpression)syntax.Accept(this);
 }
示例#21
0
 public void Visit(SyntaxNode node)
 {
     node.Accept(this);
 }