I'm trying to convert my grammar from v3 to v4 and having some trouble finding all the right pieces.
In v3 to process a String, I used:
public static DataExtractor create(String dataspec) {
CharStream stream = new ANTLRStringStream(dataspec);
DataSpecificationLexer lexer = new DataSpecificationLexer(stream);
CommonTokenStream tokens = new CommonTokenStream(lexer);
DataSpecificationParser parser = new DataSpecificationParser(tokens);
return parser.dataspec();
}
How do I change this to work in v4?
CharStreams#fromString
in the class. This helps even more if one only got a String and wants it to be lexed and parsed. But thank you for the hint :) – Leal