protected ParsingResult<V> runLocatingMatch(InputBuffer inputBuffer) { ParseRunner<V> locatingRunner = new ErrorLocatingParseRunner<V>(getRootMatcher()) .withValueStack(getValueStack()); return locatingRunner.run(inputBuffer); }
public ParsingResult<V> run(InputBuffer inputBuffer) { checkArgNotNull(inputBuffer, "inputBuffer"); resetValueStack(); errorIndex = 0; // run without fast string matching to properly get the error location MatcherContext<V> rootContext = createRootContext(inputBuffer, this, false); boolean matched = match(rootContext); if (!matched) { getParseErrors().add(new BasicParseError(inputBuffer, errorIndex, null)); } return createParsingResult(matched, rootContext); }
private boolean performLocatingRun(InputBuffer inputBuffer) { resetValueStack(); ParseRunner<V> locatingRunner = new ErrorLocatingParseRunner<V>(rootMatcherWithoutPTB, getInnerHandler()) .withParseErrors(getParseErrors()) .withValueStack(getValueStack()); lastParsingResult = locatingRunner.run(inputBuffer); errorIndex = lastParsingResult.matched ? -1 : getParseErrors().remove(getParseErrors().size() - 1).getStartIndex(); return lastParsingResult.matched; }
private boolean notTestNot(MatcherContext context) { return !(context.getMatcher() instanceof TestNotMatcher) && (context.getParent() == null || notTestNot(context.getParent())); } }
public boolean match(MatcherContext<?> context) { if (inner == null && context.getMatcher().match(context) || inner != null && inner.match(context)) { if (errorIndex < context.getCurrentIndex() && notTestNot(context)) { errorIndex = context.getCurrentIndex(); } return true; } return false; }