StatementParser { static Parser<Statement> throwStatement(Parser<Expression> thrown) { return between(term("throw"), thrown, term(";")).map(ThrowStatement::new); }    }
@Test public void testThrowStatement() { Parser<Statement> parser = StatementParser.throwStatement(ExpressionParser.IDENTIFIER); TerminalParserTest.assertResult(parser, "throw foo;", ThrowStatement.class, "throw foo;"); }