Merge pull request #2047 from bramp/commonsetstuff

[Go] Placed the CommonSetStuff code inside a scope
This commit is contained in:
Terence Parr 2017-10-12 09:42:32 -07:00 committed by GitHub
commit 8778ad65c4
1 changed files with 22 additions and 20 deletions

View File

@ -777,19 +777,20 @@ 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)>
{
p.SetState(<m.stateNumber>)
<if(m.labels)>
var _lt = p.GetTokenStream().LT(1)<! TODO: Should LT be called always like InvokeRule and MatchToken? !>
var _lt = p.GetTokenStream().LT(1)<! TODO: Should LT be called always like InvokeRule and MatchToken? !>
<m.labels:{l | <labelref(l)> = _lt}; separator="\n">
<m.labels:{l | <labelref(l)> = _lt}; separator="\n">
<endif>
<if(capture)>
<capture>
<endif>
<if(capture)>
<capture>
<endif>
<if(invert)>if <m.varName> \<= 0 || <expr> <else>if !(<expr>)<endif> {
<endif>
<if(invert)>if <m.varName> \<= 0 || <expr> <else>if !(<expr>)<endif> {
<if(m.labels)>
var _ri = p.GetErrorHandler().RecoverInline(p)
@ -797,9 +798,10 @@ var _lt = p.GetTokenStream().LT(1)<! TODO: Should LT be called always like Invok
<else>
p.GetErrorHandler().RecoverInline(p)
<endif>
} else {
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
}
>>