diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/BaseTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/BaseTest.java index ac1b0a670..53ec93aa9 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/BaseTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/BaseTest.java @@ -770,7 +770,7 @@ public abstract class BaseTest { +")\n" + "\n" + "type TreeShapeListener struct {\n" - + " *antlr4.BaseParseTreeListener\n" + + " *parser.Base\n" + "}\n" + "\n" + "func NewTreeShapeListener() *TreeShapeListener {\n" @@ -780,9 +780,8 @@ public abstract class BaseTest { + "func (this *TreeShapeListener) EnterEveryRule(ctx antlr4.ParserRuleContext) {\n" + " for i := 0; i\\ @@ -84,13 +85,29 @@ import "antlr4" type Visitor interface { antlr4.ParseTreeVisitor -#. - Visit(ctx antlr4.ParserRuleContext) + Visit(ctx *Context) interface{\} }; separator="\n"> } >> +BaseVisitorFile(file, header) ::= << + +package parser // + +import "antlr4" + +type BaseVisitor struct { + *antlr4.BaseParseTreeVisitor +} + +Visitor) Visit(ctx *Context) interface{\} { + return v.VisitChildren(ctx) +\}}; separator="\n"> +>> + Parser(parser, funcs, atn, sempredFuncs, superClass) ::= << @@ -126,12 +143,13 @@ func New(input antlr4.TokenStream) * { parser.RuleNames = ruleNames parser.LiteralNames = literalNames parser.SymbolicNames = symbolicNames - parser.GrammarFileName = "" return parser } + + const( EOF = antlr4.TokenEOF @@ -713,33 +731,26 @@ func New(parser antlr4.Parser, ctx antlr4.ParserRuleContext) *> - ListenerDispatchMethod(method) ::= << func (s *) EnterExitRule(listener antlr4.ParseTreeListener) { listener.(Listener).EnterExit(s) } - >> - VisitorDispatchMethod(method) ::= << -func (s *) Accept(Visitor antlr4.ParseTreeVisitor) interface{} { +func (s *) Accept(visitor antlr4.ParseTreeVisitor) interface{} { - switch t := listener.(type) { - case Listener: + switch t := visitor.(type) { + case Visitor: return t.Visit(s) default: return t.VisitChildren(s) } } - >> - - - AttributeDecl(d) ::= "p. = null" /** If we don't know location of label def x, use this template */