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`

This commit is contained in:
Andrew Brampton 2017-10-06 08:01:17 -07:00
parent e6d60007e7
commit 9f90d51442
No known key found for this signature in database
GPG Key ID: 4E469B362BA353D0
1 changed files with 22 additions and 20 deletions

View File

@ -777,29 +777,31 @@ MatchSet(m, expr, capture) ::= "<CommonSetStuff(m, expr, capture, false)>"
MatchNotSet(m, expr, capture) ::= "<CommonSetStuff(m, expr, capture, true)>"
CommonSetStuff(m, expr, capture, invert) ::= <<
p.SetState(<m.stateNumber>)
<if(m.labels)>
var _lt = p.GetTokenStream().LT(1)<! TODO: Should LT be called always like InvokeRule and MatchToken? !>
<m.labels:{l | <labelref(l)> = _lt}; separator="\n">
<endif>
<if(capture)>
<capture>
<endif>
<if(invert)>if <m.varName> \<= 0 || <expr> <else>if !(<expr>)<endif> {
{
p.SetState(<m.stateNumber>)
<if(m.labels)>
var _ri = p.GetErrorHandler().RecoverInline(p)
<m.labels:{l | <labelref(l)> = _ri}; separator="\n">
<else>
p.GetErrorHandler().RecoverInline(p)
var _lt = p.GetTokenStream().LT(1)<! TODO: Should LT be called always like InvokeRule and MatchToken? !>
<m.labels:{l | <labelref(l)> = _lt}; separator="\n">
<endif>
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
<if(capture)>
<capture>
<endif>
<if(invert)>if <m.varName> \<= 0 || <expr> <else>if !(<expr>)<endif> {
<if(m.labels)>
var _ri = p.GetErrorHandler().RecoverInline(p)
<m.labels:{l | <labelref(l)> = _ri}; separator="\n">
<else>
p.GetErrorHandler().RecoverInline(p)
<endif>
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
}
>>