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

Method arrayLiteral

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

Source from the content-addressed store, hash-verified

489 }
490
491 public ArrayLiteralExpression arrayLiteral() {
492 Token start = consume(LEFT_BRACKET);
493 List<Expression> exprs = new ArrayList<>();
494
495 while (la() != RIGHT_BRACKET) {
496 if (la() == COMMA) {
497 // System.err.println("comma");
498 consume();
499 exprs.add(null);
500 continue;
501 } else {
502 // System.err.println("not comma");
503 exprs.add(assignmentExpression());
504 if (la() == COMMA) {
505 // System.err.println("followed by comma");
506 consume();
507 } else {
508 // System.err.println("followed by not comma");
509 break;
510 }
511 }
512 }
513
514 consume(RIGHT_BRACKET);
515
516 // System.err.println("ARRAY: " + exprs);
517
518 return factory.arrayLiteral(start, exprs);
519 }
520
521 public Expression assignmentExpression() {
522 return assignmentExpression(false);

Callers 1

primaryExpressionMethod · 0.95

Calls 4

consumeMethod · 0.95
laMethod · 0.95
assignmentExpressionMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected