| 338 | public RuleReturn<V> getLastSuccessfulReturn() { return lastSuccessfulReturn; } |
| 339 | |
| 340 | private RuleReturn<V> ruleReturn(boolean matched, boolean consumed) { |
| 341 | RuleReturn<V> ret = lastReturn = new RuleReturn<>(this, matched, consumed); |
| 342 | if (consumed) { tossTopFrame(); } else { resetToLastFrame(); } |
| 343 | if (matched && consumed) { |
| 344 | if (ret.matchLen + ret.match.srcPos > farthestSuccessfulPos.srcPos) { |
| 345 | farthestSuccessfulPos.srcPos = ret.match.srcPos + ret.matchLen; |
| 346 | farthestSuccessfulPos.line = ret.match.line; |
| 347 | farthestSuccessfulPos.linePos = ret.match.linePos + ret.matchLen; |
| 348 | } |
| 349 | if ((lastSuccessfulReturn == null) || (ret.match.srcPos > lastSuccessfulReturn.match.srcPos)) { |
| 350 | lastSuccessfulReturn = ret; |
| 351 | } |
| 352 | } |
| 353 | return ret; |
| 354 | } |
| 355 | |
| 356 | /** |
| 357 | * Rule return. |