@Test public void should_report_error_at_several_paths() { Rule subRule1 = new MutableParsingRule("subRule1").is("foo"); Rule subRule2 = new MutableParsingRule("subRule2").is("bar"); Rule rule = new MutableParsingRule("rule").is(GrammarOperators.firstOf(subRule1, subRule2)); ParseRunner runner = new ParseRunner(rule); ParsingResult result = runner.parse("baz".toCharArray()); assertThat(result.isMatched()).isFalse(); ParseError parseError = result.getParseError(); System.out.println(new ParseErrorFormatter().format(parseError)); assertThat(parseError.getErrorIndex()).isEqualTo(0); }
public ParsingResult parse(char[] input) { return Machine.parse(input, compiledGrammar); }
ParseRunner { public ParsingResult parse(char[] input) { return Machine.parse(input, compiledGrammar); } }
ParseRunner { public ParsingResult parse(char[] input) { return Machine.parse(input, compiledGrammar); } ParseRunner(Rule rule); }
ParseRunner { public ParsingResult parse(char[] input) { return Machine.parse(input, compiledGrammar); } ParseRunner(Rule rule); ParsingResult parse(char[] input); }
ParseRunner { public ParsingResult parse(char[] input) { return Machine.parse(input, compiledGrammar); } ParseRunner(Rule rule); ParsingResult parse(char[] input);  }