@Test public void testToJavaRegexWithUnmatchedBrackets() { assertThat(toJavaRegex("["), equalTo("\\[")); assertThat(toJavaRegex("Literal["), equalTo("Literal\\[")); assertThat(toJavaRegex("Literal]"), equalTo("Literal\\]")); }
public static String toJavaRegex(String wildcard) { GroupWildcard parser = Parboiled.createParser(GroupWildcard.class); BasicParseRunner<String> runner = new BasicParseRunner<>(parser.TopLevel()); ParsingResult<String> result = runner.run(wildcard); if (!result.matched) { throw new IllegalArgumentException("Unhandled input: " + wildcard); } return result.resultValue; }
GroupWildcard extends BaseParser<String> { public static String toJavaRegex(String wildcard) { GroupWildcard parser = Parboiled.createParser(GroupWildcard.class); BasicParseRunner<String> runner = new BasicParseRunner<>(parser.TopLevel()); ParsingResult<String> result = runner.run(wildcard); if (!result.matched) { throw new IllegalArgumentException("Unhandled input: " + wildcard); } return result.resultValue; } }
GroupWildcard extends BaseParser<String> { public static String toJavaRegex(String wildcard) { GroupWildcard parser = Parboiled.createParser(GroupWildcard.class); BasicParseRunner<String> runner = new BasicParseRunner<>(parser.TopLevel()); ParsingResult<String> result = runner.run(wildcard); if (!result.matched) { throw new IllegalArgumentException("Unhandled input: " + wildcard); } return result.resultValue; }  }
GroupWildcard extends BaseParser<String> { public static String toJavaRegex(String wildcard) { GroupWildcard parser = Parboiled.createParser(GroupWildcard.class); BasicParseRunner<String> runner = new BasicParseRunner<>(parser.TopLevel()); ParsingResult<String> result = runner.run(wildcard); if (!result.matched) { throw new IllegalArgumentException("Unhandled input: " + wildcard); } return result.resultValue; }  static String toJavaRegex(String wildcard); }
GroupWildcard extends BaseParser<String> { public static String toJavaRegex(String wildcard) { GroupWildcard parser = Parboiled.createParser(GroupWildcard.class); BasicParseRunner<String> runner = new BasicParseRunner<>(parser.TopLevel()); ParsingResult<String> result = runner.run(wildcard); if (!result.matched) { throw new IllegalArgumentException("Unhandled input: " + wildcard); } return result.resultValue; }  static String toJavaRegex(String wildcard);  }