protected bool EvaluatePredicate(ICharStream input, int ruleIndex, int predIndex, bool speculative)
{
// assume true if no recognizer was provided
if (recog == null)
{
return true;
}
if (!speculative)
{
return recog.Sempred(null, ruleIndex, predIndex);
}
int savedCharPositionInLine = charPositionInLine;
int savedLine = thisLine;
int index = input.Index;
int marker = input.Mark();
try
{
Consume(input);
return recog.Sempred(null, ruleIndex, predIndex);
}
finally
{
charPositionInLine = savedCharPositionInLine;
thisLine = savedLine;
input.Seek(index);
input.Release(marker);
}
}