예제 #1
0
        public void Process(FunctionDefinitionNode function)
        {
            SyntaxTreeDelegator      childrenDelegator = new SyntaxTreeDelegator();
            StatementChildrenVisitor statementVisitor  = new StatementChildrenVisitor(_delegator, childrenDelegator);

            childrenDelegator.StatementVisitor  = statementVisitor;
            childrenDelegator.ExpressionVisitor = this;
            function.Body.VisitStatements(statementVisitor);
        }
예제 #2
0
        public void Process(FunctionDefinitionNode function)
        {
            SyntaxTreeDelegator visitor            = new SyntaxTreeDelegator();
            StatementDelegator  statementDelegator = new StatementDelegator();

            statementDelegator.DeclarationVisitor = this;
            visitor.StatementVisitor = statementDelegator;

            SyntaxTreeDelegator      childrenVisitor          = new SyntaxTreeDelegator();
            StatementChildrenVisitor statementChildrenVisitor = new StatementChildrenVisitor(visitor, childrenVisitor);

            childrenVisitor.StatementVisitor = statementChildrenVisitor;

            function.Body.VisitStatements(statementChildrenVisitor);
        }
예제 #3
0
        public void Process(FunctionDefinitionNode function)
        {
            SyntaxTreeDelegator syntaxTreeDelegator = new SyntaxTreeDelegator();
            ExpressionDelegator expressionDelegator = new ExpressionDelegator();

            expressionDelegator.UnaryOperationVisitor = this;
            syntaxTreeDelegator.ExpressionVisitor     = expressionDelegator;

            SyntaxTreeDelegator      childrenVisitor          = new SyntaxTreeDelegator();
            StatementChildrenVisitor statementChildrenVisitor =
                new StatementChildrenVisitor(syntaxTreeDelegator, childrenVisitor);
            ExpressionChildrenVisitor expressionChildrenVisitor
                = new ExpressionChildrenVisitor(syntaxTreeDelegator, null, childrenVisitor);

            childrenVisitor.StatementVisitor  = statementChildrenVisitor;
            childrenVisitor.ExpressionVisitor = expressionChildrenVisitor;

            function.Body.VisitStatements(statementChildrenVisitor);
        }
        public void Process()
        {
            SyntaxTreeDelegator      syntaxTreeDelegator      = new SyntaxTreeDelegator();
            StatementDelegator       statementDelegator       = new StatementDelegator();
            ExpressionDelegator      expressionDelegator      = new ExpressionDelegator();
            BasicExpressionDelegator basicExpressionDelegator = new BasicExpressionDelegator();

            syntaxTreeDelegator.StatementVisitor       = statementDelegator;
            statementDelegator.ReturnVisitor           = this;
            syntaxTreeDelegator.ExpressionVisitor      = expressionDelegator;
            expressionDelegator.BasicVisitor           = basicExpressionDelegator;
            basicExpressionDelegator.AssignmentVisitor = this;

            SyntaxTreeDelegator      childrenVisitor          = new SyntaxTreeDelegator();
            StatementChildrenVisitor statementChildrenVisitor =
                new StatementChildrenVisitor(syntaxTreeDelegator, childrenVisitor);

            childrenVisitor.StatementVisitor  = statementChildrenVisitor;
            childrenVisitor.ExpressionVisitor = new ExpressionChildrenVisitor(syntaxTreeDelegator, null, childrenVisitor);

            _function.Body.VisitStatements(statementChildrenVisitor);
        }
예제 #5
0
        public void Process(FunctionDefinitionNode function)
        {
            SyntaxTreeDelegator visitor            = new SyntaxTreeDelegator();
            StatementDelegator  statementDelegator = new StatementDelegator();

            visitor.StatementVisitor = statementDelegator;
            statementDelegator.DeclarationVisitor = this;

            SyntaxTreeDelegator      childrenVisitor          = new SyntaxTreeDelegator();
            StatementChildrenVisitor statementChildrenVisitor = new StatementChildrenVisitor(visitor, childrenVisitor);

            childrenVisitor.StatementVisitor = statementChildrenVisitor;

            // Populate lvalue list
            function.Body.AcceptStatementVisitor(statementChildrenVisitor);

            // Validate usage of all lvalues.
            foreach (LValue lvalue in _lvalues)
            {
                _lValueAssignmentValidator.Validate(lvalue, function);
            }
        }
        public ProcessReplacementsVisitorChain(IReplacementSource source, IReplacementListener listener, bool isPostOrder = false)
        {
            ExpressionReplacementsVisitor        = new ProcessExpressionReplacementsVisitor(source, listener);
            StatementReplacementsVisitor         = new ProcessStatementReplacementsVisitor(source, listener);
            TopLevelStatementReplacementsVisitor = new ProcessTopLevelStatementReplacementsVisitor(source, listener);

            ReplacementVisitor = new SyntaxTreeDelegator();
            ReplacementVisitor.ExpressionVisitor = ExpressionReplacementsVisitor;
            ReplacementVisitor.StatementVisitor  = StatementReplacementsVisitor;
            ReplacementVisitor.TopLevelVisitor   = TopLevelStatementReplacementsVisitor;

            ChildrenVisitor           = new SyntaxTreeDelegator();
            ExpressionChildrenVisitor = new ExpressionChildrenVisitor(
                preOrderVisitor: isPostOrder ? null : ReplacementVisitor,
                postOrderVisitor: isPostOrder ? ReplacementVisitor : null,
                childrenVisitor: ChildrenVisitor);
            StatementChildrenVisitor         = new StatementChildrenVisitor(ReplacementVisitor, ChildrenVisitor);
            TopLevelStatementChildrenVisitor = new TopLevelStatementChildrenVisitor(ReplacementVisitor, ChildrenVisitor);

            ChildrenVisitor.ExpressionVisitor = ExpressionChildrenVisitor;
            ChildrenVisitor.StatementVisitor  = StatementChildrenVisitor;
            ChildrenVisitor.TopLevelVisitor   = TopLevelStatementChildrenVisitor;
        }