This commit is contained in:
Terence Parr 2012-11-03 08:47:32 -07:00
parent a828b99b59
commit 675776267f
4 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@ public class ExtractInheritance extends JavaLRBaseListener {
*/ */
@Override @Override
public void enterNormalClassDeclaration(JavaLRParser.NormalClassDeclarationContext ctx) { public void enterNormalClassDeclaration(JavaLRParser.NormalClassDeclarationContext ctx) {
TerminalNode<Token> id = ctx.Identifier(); TerminalNode id = ctx.Identifier();
String sup = null; String sup = null;
if ( ctx.type()!=null ) { if ( ctx.type()!=null ) {
sup = ctx.type().getText(); sup = ctx.type().getText();
@ -41,7 +41,7 @@ public class ExtractInheritance extends JavaLRBaseListener {
@Override @Override
public void enterNormalInterfaceDeclaration(JavaLRParser.NormalInterfaceDeclarationContext ctx) { public void enterNormalInterfaceDeclaration(JavaLRParser.NormalInterfaceDeclarationContext ctx) {
TerminalNode<Token> id = ctx.Identifier(); TerminalNode id = ctx.Identifier();
System.out.println("###### interface "+id); System.out.println("###### interface "+id);
String args = null; String args = null;
if ( ctx.typeList()!=null ) { if ( ctx.typeList()!=null ) {

View File

@ -26,7 +26,7 @@ public class GenHierarchy {
JavaLRLexer lexer = new JavaLRLexer(input); JavaLRLexer lexer = new JavaLRLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer); CommonTokenStream tokens = new CommonTokenStream(lexer);
JavaLRParser parser = new JavaLRParser(tokens); JavaLRParser parser = new JavaLRParser(tokens);
ParserRuleContext<Token> tree = parser.compilationUnit(); // parse ParserRuleContext tree = parser.compilationUnit(); // parse
ParseTreeWalker walker = new ParseTreeWalker(); // create standard walker ParseTreeWalker walker = new ParseTreeWalker(); // create standard walker
ExtractInheritance extractor = new ExtractInheritance(parser); ExtractInheritance extractor = new ExtractInheritance(parser);

View File

@ -129,7 +129,7 @@ class TestJava {
if ( diag ) parser.addErrorListener(new DiagnosticErrorListener()); if ( diag ) parser.addErrorListener(new DiagnosticErrorListener());
if ( SLL ) parser.getInterpreter().setPredictionMode(PredictionMode.SLL); if ( SLL ) parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
// start parsing at the compilationUnit rule // start parsing at the compilationUnit rule
ParserRuleContext<Token> tree = parser.compilationUnit(); ParserRuleContext tree = parser.compilationUnit();
if ( showTree ) tree.inspect(parser); if ( showTree ) tree.inspect(parser);
if ( printTree ) System.out.println(tree.toStringTree(parser)); if ( printTree ) System.out.println(tree.toStringTree(parser));

View File

@ -263,7 +263,7 @@ class TestJavaLR {
if ( SLL ) parser.getInterpreter().setPredictionMode(PredictionMode.SLL); if ( SLL ) parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
// start parsing at the compilationUnit rule // start parsing at the compilationUnit rule
ParserRuleContext<Token> t = parser.compilationUnit(); ParserRuleContext t = parser.compilationUnit();
if ( notree ) parser.setBuildParseTree(false); if ( notree ) parser.setBuildParseTree(false);
if ( gui ) t.inspect(parser); if ( gui ) t.inspect(parser);
if ( printTree ) System.out.println(t.toStringTree(parser)); if ( printTree ) System.out.println(t.toStringTree(parser));