Пример #1
0
        public blockAST parseBlock()
        {
            listStatementsAST temp   = null;
            listStatementsAST result = null;
            statementAST      parS;

            accept(sym.COR_A, "{");
            Boolean ind = false;

            while (currentToken.sym == sym.ID)
            {
                if (ind == false)
                {
                    parS = parseStat();
                    temp = new unStatementAST(parS);
                    ind  = true;
                }
                else
                {
                    parS   = parseStat();
                    temp   = new unStatementAST(parS);
                    result = new varStatementAST(result, temp);
                }
            }
            accept(sym.COR_C, "}");
            if (ind == false)
            {
                return(new blockSinStatementAST());
            }
            else
            {
                if (result == null)
                {
                    return(new blockConStatementAST(temp));
                }
                else
                {
                    return(new blockConStatementAST(result));
                }
            }
        }
Пример #2
0
 Object VisitVarStatementAST(varStatementAST var, object arg)
 {
     int numaux = ((Integer)arg).intValue(); printtab(numaux); System.out.println(c.getClass().getName());  if(c.- !=null)  c.-.visit(this,new Integer(numaux+1)); else{printtab(numaux+1);  Console.WriteLine(“NULL”);} return null;
 }
Пример #3
0
        public blockAST parseBlock()
        {
            listStatementsAST temp=null;
            listStatementsAST result=null;
            statementAST parS;
            accept(sym.COR_A, "{");
            Boolean ind =false;
            while (currentToken.sym == sym.ID)
            {
                if (ind == false)
                {
                    parS = parseStat();
                    temp = new unStatementAST(parS);
                    ind = true;
                }
                else
                {
                    parS = parseStat();
                    temp = new unStatementAST(parS);
                    result = new varStatementAST(result,temp);
                }
            }
            accept(sym.COR_C, "}");
            if (ind == false)
            {
                return new blockSinStatementAST();

            }
            else
            {
                if (result == null) {
                    return new blockConStatementAST(temp);
                }
                else return new blockConStatementAST(result);

            }
        }