Merge pull request #1498 from parrt/fix-1299

Fixes #1299. matching a set didn't properly notify error strategy of a successful match
This commit is contained in:
Terence Parr 2016-12-13 08:30:49 -08:00 committed by GitHub
commit ec5f2ecf31
8 changed files with 16 additions and 4 deletions

View File

@ -720,6 +720,7 @@ if ( <if(invert)><m.varName> \<= 0 || <else>!<endif>(<expr>) ) {
<if(m.labels)><m.labels:{l | <labelref(l)> = }><endif>ErrorHandler.RecoverInline(this); <if(m.labels)><m.labels:{l | <labelref(l)> = }><endif>ErrorHandler.RecoverInline(this);
} }
else { else {
ErrorHandler.ReportMatch(this);
Consume(); Consume();
} }
>> >>

View File

@ -816,7 +816,9 @@ setState(<m.stateNumber>);
<capture> <capture>
if (<if (invert)><m.varName> == 0 || <m.varName> == Token::EOF || <else>!<endif>(<expr>)) { if (<if (invert)><m.varName> == 0 || <m.varName> == Token::EOF || <else>!<endif>(<expr>)) {
<if (m.labels)><m.labels: {l | <labelref(l)> = }><endif>_errHandler->recoverInline(this); <if (m.labels)><m.labels: {l | <labelref(l)> = }><endif>_errHandler->recoverInline(this);
} else { }
else {
_errHandler->reportMatch(this);
consume(); consume();
} }
>> >>

View File

@ -405,7 +405,7 @@ func (p *<parser.name>) <currentRule.name; format="cap">(<currentRule.args:{a |
<endif> <endif>
} }
}() }()
<if(currentRule.hasLookaheadBlock)> <if(currentRule.hasLookaheadBlock)>
var _alt int var _alt int
<endif> <endif>
@ -808,6 +808,7 @@ var _lt = p.GetTokenStream().LT(1)<! TODO: Should LT be called always like Invok
p.GetErrorHandler().RecoverInline(p) p.GetErrorHandler().RecoverInline(p)
<endif> <endif>
} else { } else {
p.GetErrorHandler().ReportMatch(p)
p.Consume() p.Consume()
} }
>> >>

View File

@ -643,7 +643,10 @@ setState(<m.stateNumber>);
<capture> <capture>
if ( <if(invert)><m.varName> \<= 0 || <else>!<endif>(<expr>) ) { if ( <if(invert)><m.varName> \<= 0 || <else>!<endif>(<expr>) ) {
<if(m.labels)><m.labels:{l | <labelref(l)> = (Token)}><endif>_errHandler.recoverInline(this); <if(m.labels)><m.labels:{l | <labelref(l)> = (Token)}><endif>_errHandler.recoverInline(this);
} else { }
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume(); consume();
} }
>> >>

View File

@ -523,6 +523,7 @@ this.state = <m.stateNumber>;
<if(m.labels)><m.labels:{l | <labelref(l)> = }><endif>this._errHandler.recoverInline(this); <if(m.labels)><m.labels:{l | <labelref(l)> = }><endif>this._errHandler.recoverInline(this);
} }
else { else {
this._errHandler.reportMatch(this);
this.consume(); this.consume();
} }
>> >>

View File

@ -493,6 +493,7 @@ self.state = <m.stateNumber>
<if(invert)>if <m.varName> \<= 0 or <expr><else>if not(<expr>)<endif>: <if(invert)>if <m.varName> \<= 0 or <expr><else>if not(<expr>)<endif>:
<if(m.labels)><m.labels:{l | <labelref(l)> = }><else> <endif>self._errHandler.recoverInline(self) <if(m.labels)><m.labels:{l | <labelref(l)> = }><else> <endif>self._errHandler.recoverInline(self)
else: else:
self._errHandler.reportMatch(self)
self.consume() self.consume()
>> >>

View File

@ -501,6 +501,7 @@ self.state = <m.stateNumber>
<if(invert)>if <m.varName> \<= 0 or <expr><else>if not(<expr>)<endif>: <if(invert)>if <m.varName> \<= 0 or <expr><else>if not(<expr>)<endif>:
<if(m.labels)><m.labels:{l | <labelref(l)> = }><else> <endif>self._errHandler.recoverInline(self) <if(m.labels)><m.labels:{l | <labelref(l)> = }><else> <endif>self._errHandler.recoverInline(self)
else: else:
self._errHandler.reportMatch(self)
self.consume() self.consume()
>> >>

View File

@ -696,7 +696,9 @@ setState(<m.stateNumber>)
<capture> <capture>
if (<if(invert)><m.varName> \<= 0 || <else>!<endif>(<expr>)) { if (<if(invert)><m.varName> \<= 0 || <else>!<endif>(<expr>)) {
<if(m.labels)><m.labels:{l | <labelref(l)> = }><endif>try _errHandler.recoverInline(self)<if(m.labels)> as Token<endif> <if(m.labels)><m.labels:{l | <labelref(l)> = }><endif>try _errHandler.recoverInline(self)<if(m.labels)> as Token<endif>
} else { }
else {
_errHandler.reportMatch(self)
try consume() try consume()
} }
>> >>