MCPcopy Create free account
hub / github.com/dynjs/dynjs / breakStatement

Method breakStatement

src/main/java/org/dynjs/parser/js/Parser.java:1360–1389  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1358 }
1359
1360 public BreakStatement breakStatement() {
1361 Token position = consume(BREAK);
1362
1363 String target = null;
1364
1365 switch (la(false)) {
1366 case CR:
1367 case NL:
1368 case CRNL:
1369 case PARAGRAPH_SEPARATOR:
1370 case LINE_SEPARATOR:
1371 case SEMICOLON:
1372 case RIGHT_BRACE:
1373 break;
1374 case IDENTIFIER:
1375 target = consume(IDENTIFIER).getText();
1376 break;
1377 default:
1378 throw new SyntaxError(laToken(false), "unexpected token: " + laToken(false).getText());
1379 }
1380
1381 if (!isValidBreak(target)) {
1382 if (target == null) {
1383 throw new SyntaxError(position, "break not allowed");
1384 }
1385 throw new SyntaxError(position, "break " + target + " not allowed");
1386 }
1387 semic();
1388 return factory.breakStatement(position, target);
1389 }
1390
1391 public ReturnStatement returnStatement() {
1392 Token position = consume(RETURN);

Callers 1

statementMethod · 0.95

Calls 6

consumeMethod · 0.95
laMethod · 0.95
laTokenMethod · 0.95
isValidBreakMethod · 0.95
semicMethod · 0.95
getTextMethod · 0.45

Tested by

no test coverage detected