~oontvoo/+junk/test_hw

« back to all changes in this revision

Viewing changes to src/jminusminus/Parser.java

  • Committer: vnguyen
  • Date: 2013-05-09 20:11:19 UTC
  • Revision ID: oontvoo@hotmail.com-20130509201119-0kha5n03ca929puk
- add DoUntil, DoUnless
- implement Logical OR

Show diffs side-by-side

added added

removed removed

Lines of Context:
907
907
        else if (have(DO))
908
908
        {
909
909
            JStatement statement = statement();
910
 
            mustBe(WHILE);
911
 
            JExpression test = parExpression();
912
 
            mustBe(SEMI);
913
 
            return buildStmt(DO, line, statement, test);
 
910
 
 
911
            if (have(WHILE))
 
912
            {
 
913
                JExpression test = parExpression();
 
914
                mustBe(SEMI);
 
915
                return buildStmt(DO, line, statement, test);
 
916
            }
 
917
            else if (have(UNLESS))
 
918
            {
 
919
                JExpression test = parExpression();
 
920
                mustBe(SEMI);
 
921
                return buildStmt(UNLESS, line, statement, test);
 
922
            }
 
923
            else
 
924
            {
 
925
                mustBe(UNTIL);
 
926
                JExpression test = parExpression();
 
927
                mustBe(SEMI);
 
928
                return buildStmt(UNTIL, line, statement, test);
 
929
            }
914
930
        }
915
931
        else if (have(TRY))
916
932
        {
1434
1450
                || expr instanceof JPostIncrementOp
1435
1451
                || expr instanceof JMessageExpression
1436
1452
                || expr instanceof JSuperConstruction
1437
 
                || expr instanceof JThisConstruction || expr instanceof JNewOp
 
1453
                || expr instanceof JThisConstruction
 
1454
                || expr instanceof JNewOp
1438
1455
                || expr instanceof JNewArrayOp) {
1439
1456
            // So as not to save on stack
1440
1457
            expr.isStatementExpression = true;
2259
2276
       // Do-While
2260
2277
       ret.put(DO, JDoWhileStatement.BUILDER);
2261
2278
       
 
2279
       // Do-Unless
 
2280
       ret.put(UNLESS, JUnlessStatement.BUILDER);
2262
2281
 
 
2282
       // Do-Until
 
2283
       ret.put(UNTIL, JDoUntilStatement.BUILDER);
2263
2284
       return ret;
2264
2285
    }
2265
2286