コード例 #1
0
 public override void EnterSubStatement([NotNull] SBP.SubStatementContext context)
 {
     if (m_enteredLoopStatement)
     {
         m_scopeStack.Peek().SetupForLoop();
         m_enteredLoopStatement = false;
     }
     m_scopeStack.Push(new ProcedureParsingScope(m_scopeStack.Peek(), "sub", ProcedureParsingScope.ScopeType.SubStatement));
 }
コード例 #2
0
        public override void ExitSubStatement([NotNull] SBP.SubStatementContext context)
        {
            var sub = m_scopeStack.Pop();

            if (sub.StatementCount == 1)   // Just a single statement (not block)
            {
                // Add the sub-statement scope (containing the single statement)
                m_scopeStack.Peek().AddSubStatement(sub);
            }
            else if (sub.StatementCount == 0)   // Must be a block statement then.
            {
                // Add the block scope saved as a sub-expression in the sub-statement scope.
                m_scopeStack.Peek().AddSubStatement(sub.GetSubExpressions()[0]);
            }
        }