From 9f90d5144292a040412e1fcf5cc328848e6f6ac8 Mon Sep 17 00:00:00 2001 From: Andrew Brampton Date: Fri, 6 Oct 2017 08:01:17 -0700 Subject: [PATCH] Placed the CommonSetStuff code inside a scope, this is to avoid two _lt variables in the same scope. This happens with the mysql grammar: `build: previous declaration at mysql/mysql_parser.go:12215:6` --- .../antlr/v4/tool/templates/codegen/Go/Go.stg | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg index b1835e4e7..626f28070 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg @@ -777,29 +777,31 @@ MatchSet(m, expr, capture) ::= "" MatchNotSet(m, expr, capture) ::= "" CommonSetStuff(m, expr, capture, invert) ::= << -p.SetState() - - -var _lt = p.GetTokenStream().LT(1) - - = _lt}; separator="\n"> - - - - - - -if \<= 0 || if !() { +{ + p.SetState() - var _ri = p.GetErrorHandler().RecoverInline(p) - = _ri}; separator="\n"> - - p.GetErrorHandler().RecoverInline(p) + var _lt = p.GetTokenStream().LT(1) + + = _lt}; separator="\n"> + -} else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() + + + + + if \<= 0 || if !() { + + var _ri = p.GetErrorHandler().RecoverInline(p) + + = _ri}; separator="\n"> + + p.GetErrorHandler().RecoverInline(p) + + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } } >>