| 1327 | } |
| 1328 | |
| 1329 | public ContinueStatement continueStatement() { |
| 1330 | Token position = consume(CONTINUE); |
| 1331 | |
| 1332 | String target = null; |
| 1333 | |
| 1334 | switch (la(false)) { |
| 1335 | case CR: |
| 1336 | case NL: |
| 1337 | case CRNL: |
| 1338 | case PARAGRAPH_SEPARATOR: |
| 1339 | case LINE_SEPARATOR: |
| 1340 | case SEMICOLON: |
| 1341 | case RIGHT_BRACE: |
| 1342 | break; |
| 1343 | case IDENTIFIER: |
| 1344 | target = consume(IDENTIFIER).getText(); |
| 1345 | break; |
| 1346 | default: |
| 1347 | throw new SyntaxError(laToken(false), "unexpected token: " + laToken(false).getText()); |
| 1348 | } |
| 1349 | |
| 1350 | if (!isValidContinue(target)) { |
| 1351 | if (target == null) { |
| 1352 | throw new SyntaxError(position, "continue not allowed"); |
| 1353 | } |
| 1354 | throw new SyntaxError(position, "continue " + target + " not allowed"); |
| 1355 | } |
| 1356 | semic(); |
| 1357 | return factory.continueStatement(position, target); |
| 1358 | } |
| 1359 | |
| 1360 | public BreakStatement breakStatement() { |
| 1361 | Token position = consume(BREAK); |