Пример #1
0
 // Block ---
 // StmtList sl;
 public IrStmt visit(AstBlock n)
 {
     return n.sl.accept(this);
 }
Пример #2
0
 public void visit(AstBlock n)
 {
 }
Пример #3
0
 /* throws ParseException */
 /* final */
 public static AstStmt astStmt()
 {
     AstExp e1, e2; AstStmt s, s1, s2; AstExpList el; AstStmtList sl;
     jj_consume_token(AstRegExpId.kw56);
     switch ((jj_ntk == AstRegExpId.UNDEFINED)?jj_ntk_fn():jj_ntk) {
     case AstRegExpId.kwBlock:
       jj_consume_token(AstRegExpId.kwBlock);
       sl = astStmtList();
                                s = new AstBlock(sl);
       break;
     case AstRegExpId.kwAssign:
       jj_consume_token(AstRegExpId.kwAssign);
       e1 = astExp();
       e2 = astExp();
                                s = new AstAssign(e1,e2);
       break;
     case AstRegExpId.kwCallStmt:
       jj_consume_token(AstRegExpId.kwCallStmt);
       e1 = astExp();
       e2 = astExp();
       el = astExpList();
                                s = new AstCallStmt(e1,(AstId)e2,el);
       break;
     case AstRegExpId.kwIf:
       jj_consume_token(AstRegExpId.kwIf);
       e1 = astExp();
       s1 = astStmt();
       s2 = astStmt();
                                s = new AstIf(e1,s1,s2);
       break;
     case AstRegExpId.kwWhile:
       jj_consume_token(AstRegExpId.kwWhile);
       e1 = astExp();
       s1 = astStmt();
                                s = new AstWhile(e1,s1);
       break;
     case AstRegExpId.kwPrint:
       jj_consume_token(AstRegExpId.kwPrint);
       e1 = astExp();
                                s = new AstPrint(e1);
       break;
     case AstRegExpId.kwReturn:
       jj_consume_token(AstRegExpId.kwReturn);
       e1 = astExp();
                                s = new AstReturn(e1);
       break;
     case AstRegExpId.kwNullStmt:
       jj_consume_token(AstRegExpId.kwNullStmt);
                                s = null;
       break;
     default:
       jj_la1[8] = jj_gen;
       jj_consume_token(AstRegExpId.UNDEFINED);
       throw new AstParseException();
     }
     jj_consume_token(AstRegExpId.kw57);
     {if (true) return s;}
     throw new Error("Missing return statement in function");
 }
Пример #4
0
 /* throws Exception */
 // Block ---
 // StmtList sl;
 public void visit(AstBlock n)
 {
     n.sl.accept(this);
 }