- final var inputStream = CharStreams.fromString(cpsPathSource);
- final var cpsPathLexer = new CpsPathLexer(inputStream);
- final var cpsPathParser = new CpsPathParser(new CommonTokenStream(cpsPathLexer));
- cpsPathParser.addErrorListener(new BaseErrorListener() {
- @Override
- public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
- final int charPositionInLine, final String msg, final RecognitionException e) {
- throw new IllegalStateException("failed to parse at line " + line + " due to " + msg, e);
- }
- });
- final var cpsPathBuilder = new CpsPathBuilder();
- cpsPathParser.addParseListener(cpsPathBuilder);
- cpsPathParser.cpsPath();
- return cpsPathBuilder.build();