StatementParser { static Parser<ParameterDef> parameter(Parser<Modifier> mod) { return Parsers.sequence( mod.many(), TypeLiteralParser.TYPE_LITERAL, term("...").succeeds(), Terminals.Identifier.PARSER, ParameterDef::new); }    }
@Test public void testParameter() { Parser<ParameterDef> parser = StatementParser.parameter(StatementParser.SYSTEM_MODIFIER); TerminalParserTest.assertResult(parser, "int f", ParameterDef.class, "int f"); TerminalParserTest.assertResult(parser, "final int[] f", ParameterDef.class, "final int[] f"); TerminalParserTest.assertResult(parser, "static final int[] f", ParameterDef.class, "static final int[] f"); TerminalParserTest.assertResult(parser, "final int[]... f", ParameterDef.class, "final int[]... f"); TerminalParserTest.assertResult(parser, "final List<Integer>... f", ParameterDef.class, "final List<Integer>... f"); TerminalParserTest.assertResult(parser, "final int... f", ParameterDef.class, "final int... f"); }