public TestResult<V> testWithRecovery(Rule rule, String input) { return new TestResult<V>(new RecoveringParseRunner<V>(rule).run(input)); }
public TestResult<V> testWithRecovery(Rule rule, InputBuffer inputBuffer) { return new TestResult<V>(new RecoveringParseRunner<V>(rule).run(inputBuffer)); }
@Override public void parseQueryParameters(String nativeQuery, Recognizer journaler) { QueryParser parser = Parboiled.createParser( QueryParser.class, journaler ); new RecoveringParseRunner<Recognizer>( parser.Query() ).run( nativeQuery ); } }
/** * Create a new RecoveringParseRunner 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 RecoveringParseRunner<V>(rule).run(input); }
@Override public void parse(Snapshot snapshot, Task task, SourceModificationEvent sme) throws ParseException { logger.fine("Parsing..."); this.snapshot = snapshot; RecoveringParseRunner runner = new RecoveringParseRunner(parboiled.cfgProps()); parboiled.reset(); parbResult = runner.run(snapshot.getText().toString()); logParsingResult(); }
public static ExpressionList parse (String input) { if (parser == null) parser = Parboiled.createParser(PluralPropertyParser.class); ParsingResult<Object> result = new RecoveringParseRunner<Object>(parser.Translate()).run(input); Object e = result.valueStack.pop(); return (ExpressionList) e; }
@Override public MongoDBQueryDescriptor parseNativeQuery(String nativeQuery) { NativeQueryParser localParser = NATIVE_QUERY_PARSER.newInstance(); ParsingResult<MongoDBQueryDescriptorBuilder> parseResult = new RecoveringParseRunner<MongoDBQueryDescriptorBuilder>( localParser.Query() ) .run( nativeQuery ); if ( parseResult.hasErrors() ) { throw new IllegalArgumentException( "Unsupported native query: " + ErrorUtils.printParseErrors( parseResult.parseErrors ) ); } return parseResult.resultValue.build(); }
@Override public MongoDBQueryDescriptor parseNativeQuery(String nativeQuery) { NativeQueryParser localParser = NATIVE_QUERY_PARSER.newInstance(); ParsingResult<MongoDBQueryDescriptorBuilder> parseResult = new RecoveringParseRunner<MongoDBQueryDescriptorBuilder>( localParser.Query() ) .run( nativeQuery ); if ( parseResult.hasErrors() ) { throw new IllegalArgumentException( "Unsupported native query: " + ErrorUtils.printParseErrors( parseResult.parseErrors ) ); } return parseResult.resultValue.build(); }