Esempio n. 1
0
        private BlockStmt ParseBlock()
        {
            Match(TokenType.KwBegin);
            BlockStmt block = new BlockStmt(AcceptedToken);

            while (true)
            {
                try
                {
                    block.Statements.Add(ParseStatement());
                    if (Accept(TokenType.LineTerm))
                    {
                        if (Accept(TokenType.KwEnd))
                        {
                            break;
                        }
                    }
                    else
                    {
                        Match(TokenType.KwEnd);
                        break;
                    }
                }
                catch (Exception e)
                {
                    Errors.AddError(e.Message, ErrorType.SyntaxError, CurrentToken.Line, CurrentToken.Column);
                    SkipToNextStatement();
                    if (CurrentToken.Type == TokenType.EOF)
                    {
                        break;
                    }
                }
            }
            return(block);
        }
Esempio n. 2
0
 private void Visit(BlockStmt block)
 {
     foreach (var statement in block.Statements)
     {
         Visit((dynamic)statement);
     }
 }
Esempio n. 3
0
 private void Visit(BlockStmt block)
 {
     CurrentMethodIL.BeginScope();
     foreach (var statement in block.Statements)
     {
         Visit((dynamic)statement);
     }
     CurrentMethodIL.EndScope();
 }
Esempio n. 4
0
 private void Visit(BlockStmt blockStmt, bool enterScope = true)
 {
     if (enterScope)
     {
         Symbols.EnterScope();
     }
     foreach (dynamic statement in blockStmt.Statements)
     {
         Visit(statement);
     }
     if (enterScope)
     {
         Symbols.LeaveScope();
     }
 }