From 5a6709aba6d6b2afaad088dde3830bc5b162a7fe Mon Sep 17 00:00:00 2001 From: Terence Parr Date: Wed, 20 Nov 2013 14:28:51 -0800 Subject: [PATCH] update changes file, tweak parser interp test to use new api --- CHANGES.txt | 25 +++++++++++++++++++ .../antlr/v4/test/TestParserInterpreter.java | 4 +-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 968738940..9529c0cec 100644 --- a/CHANGES.txt +++ b/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) diff --git a/tool/test/org/antlr/v4/test/TestParserInterpreter.java b/tool/test/org/antlr/v4/test/TestParserInterpreter.java index 1a956a39d..80a2c526a 100644 --- a/tool/test/org/antlr/v4/test/TestParserInterpreter.java +++ b/tool/test/org/antlr/v4/test/TestParserInterpreter.java @@ -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));