Exemple #1
0
            // Add code to this case clause.
            public void AddCode(ast.Statement statement)
            {
                // First time?
                if (Code == null)
                {
                    Code = new ast.CodeBlock(statement.Bookmark, TriState.No);
                }

                Code.AddStatement(statement);
            }
Exemple #2
0
 // Parse a single statement
 ast.CodeBlock ParseStatement()
 {
     if (t.token == Token.openBrace)
     {
         return(ParseStatementBlock(TriState.Maybe));
     }
     else
     {
         var stmt = new ast.CodeBlock(t.GetBookmark(), TriState.Maybe);
         stmt.AddStatement(ParseSingleStatement());
         return(stmt);
     }
 }
Exemple #3
0
        // Parse series of statements into a statement block
        public void ParseStatements(ast.CodeBlock block)
        {
            while (t.token != Token.closeBrace && t.token != Token.eof)
            {
                // Skip redundant semicolons
                if (t.token == Token.semicolon)
                {
                    t.Next();
                    continue;
                }

                // Add the next statement
                block.AddStatement(ParseSingleStatement());
            }
        }
Exemple #4
0
 // Parse a single statement
 ast.CodeBlock ParseStatement()
 {
     if (t.token == Token.openBrace)
     {
         return ParseStatementBlock(TriState.Maybe);
     }
     else
     {
         var stmt = new ast.CodeBlock(t.GetBookmark(), TriState.Maybe);
         stmt.AddStatement(ParseSingleStatement());
         return stmt;
     }
 }