Dispatch accept() for terminal nodes to visitor
This commit is contained in:
parent
0375f8318a
commit
80b3ec8c62
|
@ -80,7 +80,9 @@ public interface ParseTree extends SyntaxTree {
|
|||
public int getChildCount() { return 0; }
|
||||
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) { return null; }
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
return visitor.visitTerminal(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toStringTree(Parser parser) {
|
||||
|
@ -117,6 +119,11 @@ public interface ParseTree extends SyntaxTree {
|
|||
public ErrorNodeImpl(Symbol token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
return visitor.visitErrorNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
// the following methods narrow the return type; they are not additional methods
|
||||
|
|
Loading…
Reference in New Issue