update changes file, tweak parser interp test to use new api
This commit is contained in:
parent
f4bb91d758
commit
5a6709aba6
25
CHANGES.txt
25
CHANGES.txt
|
@ -1,5 +1,30 @@
|
|||
ANTLR v4 Honey Badger
|
||||
|
||||
November 20, 2013
|
||||
|
||||
* Sam added method stuff like expr() that calls expr(0). Makes it possible
|
||||
to call expr rule from TestRig (grun).
|
||||
|
||||
November 14, 2013
|
||||
|
||||
* Added Sam's ParserInterpreter implementation that uses ATN after
|
||||
deserialization.
|
||||
|
||||
LexerGrammar lg = new LexerGrammar(
|
||||
"lexer grammar L;\n" +
|
||||
"A : 'a' ;\n" +
|
||||
"B : 'b' ;\n" +
|
||||
"C : 'c' ;\n");
|
||||
Grammar g = new Grammar(
|
||||
"parser grammar T;\n" +
|
||||
"s : (A{;}|B)* C ;\n",
|
||||
lg);
|
||||
|
||||
LexerInterpreter lexEngine = lg.createLexerInterpreter(new ANTLRInputStream(input));
|
||||
CommonTokenStream tokens = new CommonTokenStream(lexEngine);
|
||||
ParserInterpreter parser = g.createParserInterpreter(tokens);
|
||||
ParseTree t = parser.parse(g.rules.get(startRule).index);
|
||||
|
||||
November 13, 2013
|
||||
|
||||
* move getChildren() from Tree into Trees (to avoid breaking change)
|
||||
|
|
|
@ -201,9 +201,7 @@ public class TestParserInterpreter extends BaseTest {
|
|||
{
|
||||
LexerInterpreter lexEngine = lg.createLexerInterpreter(new ANTLRInputStream(input));
|
||||
CommonTokenStream tokens = new CommonTokenStream(lexEngine);
|
||||
|
||||
ATN atn = createATN(g, true);
|
||||
ParserInterpreter parser = new ParserInterpreter(g.fileName, Arrays.asList(g.getTokenNames()), Arrays.asList(g.getRuleNames()), atn, tokens);
|
||||
ParserInterpreter parser = g.createParserInterpreter(tokens);
|
||||
ParseTree t = parser.parse(g.rules.get(startRule).index);
|
||||
System.out.println("parse tree: "+t.toStringTree(parser));
|
||||
assertEquals(parseTree, t.toStringTree(parser));
|
||||
|
|
Loading…
Reference in New Issue