ExpressionParser { static Parser<Expression> newArrayWithoutExplicitLength(Parser<Expression> expr) { return Parsers.sequence( term("new").next(TypeLiteralParser.ARRAY_TYPE_LITERAL), Parsers.between(term("{"), expr.sepBy(term(",")), term("}")), (type, values) -> new NewArrayExpression(type.elementType, null, values)); }  static Parser<Expression> expression(
      Parser<DefBody> classBody, Parser<Statement> statement); static Parser<Expression> arrayInitializer(Parser<Expression> expr);  }
@Test public void testNewArrayWithoutExplicitLength() { Parser<Expression> parser = ExpressionParser.newArrayWithoutExplicitLength(ExpressionParser.IDENTIFIER); TerminalParserTest.assertResult(parser, "new int[]{}", NewArrayExpression.class, "new int[] {}"); TerminalParserTest.assertResult(parser, "new int[]{a,b,c}", NewArrayExpression.class, "new int[] {a, b, c}"); TerminalParserTest.assertFailure(parser, "new int[]", 1, 10); }