DeclarationParser { static Parser<DefBody> body(Parser<Member> member) { Parser<Member> empty = term(";").retn(null); return Parsers.between(term("{"), empty.or(member).many().map(DeclarationParser::removeNulls), term("}")) .map(DefBody::new); }  static Parser<Program> program(); static Program parse(String source); static Program parse(URL url);  }
@Test public void testBody() { Parser<DefBody> parser = DeclarationParser.body(FIELD); TerminalParserTest.assertResult(parser, "{}", DefBody.class, "{}"); TerminalParserTest.assertResult(parser, "{int f;}", DefBody.class, "{int f;}"); TerminalParserTest.assertResult(parser, "{int f=foo; int g;}", DefBody.class, "{int f = foo; int g;}"); TerminalParserTest.assertResult(parser, "{;int f=foo;;; int g;;}", DefBody.class, "{int f = foo; int g;}"); }