コード例 #1
0
        public override WhileStatementNode VisitWhileStatement([NotNull] WhileStatementContext context)
        {
            var expr = VisitExpr(context.expr());

            var block     = context.block().Invoke(VisitBlock);
            var statement = context.statement().Invoke(VisitStatement);

            return(new WhileStatementNode(expr, block, statement, GetLocation(context)));
        }
コード例 #2
0
        public override void EnterWhileStatement([NotNull] WhileStatementContext context)
        {
            WhileStatement whileStatement = new WhileStatement(Parent, context);

            ExpressionListener expressionListener = new ExpressionListener(whileStatement);

            context.parExpression().expression().EnterRule(expressionListener);
            whileStatement.Condition = expressionListener.GetResult();

            StatementListener statementListener = new StatementListener(whileStatement);

            context.statement().EnterRule(statementListener);
            whileStatement.Statements = statementListener.Result;

            Result.Add(whileStatement);
        }