JavaCCParserImpl extends BaseJavaCCParserImpl implements ParserImpl { @Override protected void error(String expected) { error(expected, friendlyName(lookahead(1))); } JavaCCParserImpl(String srcInfo, Reader stream); @Override List<SyntaxError> errors(); @Override String getSrcInfo();  }
@Test public void testError() { final Parser parser = new StandardParser(PARSER_IMPL_FACTORY); final String source = " + "FooBar = foo | bar(int hey, final String[] yeah) whatever = int"; final ParseResult result = parser.parse(new StringSource("ParserTest", source)); assertEquals( new ParseResult(new Doc( "ParserTest", Pkg._Pkg(list(_JavaEOLComment(" list(new DataType(NO_COMMENTS, NO_ANNOTATIONS, "FooBar", NO_FORMAL_TYPE_ARGUMENTS, NO_EXTENDS, NO_IMPLEMENTS, list( new Constructor(NO_COMMENTS, "foo", Util .<Arg> list()), new Constructor(NO_COMMENTS, "bar", list(new Arg(Util .<ArgModifier> list(), _Primitive(_IntType()), "hey"), new Arg( list(_Final()), _Ref(_ArrayType(_Ref(_ClassType( "String", NO_ACTUAL_TYPE_ARGUMENTS)))), "yeah"))))), new DataType(NO_COMMENTS, NO_ANNOTATIONS, "whatever", NO_FORMAL_TYPE_ARGUMENTS, NO_EXTENDS, NO_IMPLEMENTS, list(new Constructor(NO_COMMENTS, "BAD_IDENTIFIER_int@1", Util .<Arg> list()))))), list(SyntaxError._UnexpectedToken("a constructor name", "'int'", 2))).toString(), result.toString()); }