/** * Create a new BasicParseRunner instance with the given rule and input text and returns the result of * its {@link #run(String)} method invocation. * * @param rule the parser rule to run * @param input the input text to run on * @return the ParsingResult for the parsing run * @deprecated As of 0.11.0 you should use the "regular" constructor and one of the "run" methods rather than * this static method. This method will be removed in one of the coming releases. */ @Deprecated public static <V> ParsingResult<V> run(Rule rule, String input) { checkArgNotNull(rule, "rule"); checkArgNotNull(input, "input"); return new BasicParseRunner<V>(rule).run(input); }
public ParsingResult<V> run(InputBuffer inputBuffer) { checkArgNotNull(inputBuffer, "inputBuffer"); resetValueStack(); MatcherContext<V> rootContext = createRootContext(inputBuffer, this, true); boolean matched = rootContext.runMatcher(); return createParsingResult(matched, rootContext); }
protected ParsingResult<V> runBasicMatch(InputBuffer inputBuffer) { ParseRunner<V> basicRunner = new BasicParseRunner<V>(getRootMatcher()) .withParseErrors(getParseErrors()) .withValueStack(getValueStack()); return basicRunner.run(inputBuffer); }
protected <T> ParsingResult<T> parse(Rule rule, String input) { ParseRunner<T> handler = new BasicParseRunner<T>(rule); return handler.run(input); } }
@Override public Node parse(Environment environment, ResourceReference resource) { ResourceService resourceService = environment.getResourceEnvironment().getResourceService(); BasicParseRunner<Node> runner = new BasicParseRunner<Node>( ParserContext.instance(resource, configuration, configuration.getAddonParserProviders(), Charset charset = resourceMetadata.getCharset() .or(environment.getResourceEnvironment().getDefaultInputCharset()); ParsingResult<Node> result = runner.run(readAllText(resourceMetadata.load(), charset)); if (result.hasErrors()) { throw new ParseException(toMessage(result.parseErrors));
ParseRunner<V> basicRunner = new BasicParseRunner<V>(getRootMatcher()) .withParseErrors(getParseErrors()) .withValueStack(getValueStack()); lastParsingResult = basicRunner.run(inputBuffer);
@Override public Node parse(Environment environment, ResourceReference resource) { ResourceService resourceService = environment.getResourceEnvironment().getResourceService(); BasicParseRunner<Node> runner = new BasicParseRunner<Node>( ParserContext.instance(resource, configuration, configuration.getAddonParserProviders(), Charset charset = resourceMetadata.getCharset() .or(environment.getResourceEnvironment().getDefaultInputCharset()); ParsingResult<Node> result = runner.run(readAllText(resourceMetadata.load(), charset)); if (result.hasErrors()) { throw new ParseException(toMessage(result.parseErrors));