protected void parsePatchPath()

in scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/patch/PatchOperationPath.java [51:72]


  protected void parsePatchPath(String patchPath) throws FilterParseException {
    FilterLexer l = new FilterLexer(new ANTLRInputStream(patchPath));
    FilterParser p = new FilterParser(new CommonTokenStream(l));
    p.setBuildParseTree(true);

    p.addErrorListener(new BaseErrorListener() {
      @Override
      public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
        throw new IllegalStateException("failed to parse at line " + line + " due to " + msg, e);
      }
    });

    try {
      ParseTree tree = p.patchPath();
      PatchPathListener patchPathListener = new PatchPathListener();
      ParseTreeWalker.DEFAULT.walk(patchPathListener, tree);

      this.valuePathExpression = patchPathListener.getValuePathExpression();
    } catch (IllegalStateException e) {
      throw new FilterParseException(e);
    }
  }