MCPcopy Create free account
hub / github.com/cschanck/single-file-java / ruleReturn

Method ruleReturn

src/main/java/org/sfj/PegLegParser.java:340–354  ·  view source on GitHub ↗
(boolean matched, boolean consumed)

Source from the content-addressed store, hash-verified

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.

Callers 15

namedMethod · 0.95
eofRuleMethod · 0.80
wsRuleMethod · 0.80
innerTimesOfMethod · 0.80
charRangeMethod · 0.80
innerStrMethod · 0.80
wsMethod · 0.80
anyOfMethod · 0.80
dictionaryOfMethod · 0.80
noneOfMethod · 0.80
seqOfMethod · 0.80
firstOfMethod · 0.80

Calls 2

tossTopFrameMethod · 0.95
resetToLastFrameMethod · 0.95

Tested by

no test coverage detected