StatementParser { static Parser<Statement> thisCall(Parser<Expression> expr) { return between(phrase("this ("), expr.sepBy(term(",")), phrase(") ;")) .map(ThisCallStatement::new); }    }
@Test public void testThisCallStatement() { Parser<Statement> parser = StatementParser.thisCall(ExpressionParser.IDENTIFIER); TerminalParserTest.assertResult(parser, "this();", ThisCallStatement.class, "this();"); TerminalParserTest.assertResult(parser, "this(foo);", ThisCallStatement.class, "this(foo);"); TerminalParserTest.assertResult(parser, "this(foo,bar);", ThisCallStatement.class, "this(foo, bar);"); }