public void parseInput()

in src/main/java/org/apache/log4j/rule/InFixToPostFix.java [230:288]


    public void parseInput(String input, LinkedList linkedList) {
      /*
     Operators:
         !
         !=
         ==
         ~=
         ||
         &&
         like
         exists
         <
         <=
         >
         >=
      */
      //for operators, handle multi-char matches before single-char matches
      //order does not matter for keywords
      List keywords = LoggingEventFieldResolver.KEYWORD_LIST;
      //remove PROP. from the keyword list...it is a keyword in that list, but is handled separately here from the other keywords since its name is not fixed
      keywords.remove("PROP.");
      int pos = 0;
      while (pos < input.length()) {
        if (nextValueIs(input, pos, "'") || nextValueIs(input, pos, "\"")) {
          pos = handleQuotedString(input, pos, linkedList);
        }
        if (nextValueIs(input, pos, "PROP.")) {
          pos = handleProperty(input, pos, linkedList);
        }
        boolean operatorFound = false;
        for (Iterator iter = operators.iterator();iter.hasNext();) {
          String operator = (String)iter.next();
          if (nextValueIs(input, pos, operator)) {
            operatorFound = true;
            pos = handle(pos, linkedList, operator);
          }
        }
        boolean keywordFound = false;
        for (Iterator iter = keywords.iterator();iter.hasNext();) {
          String keyword = (String)iter.next();
          if (nextValueIs(input, pos, keyword)) {
            keywordFound = true;
            pos = handle(pos, linkedList, keyword);
          }
        }
        if (operatorFound || keywordFound) {
          continue;
        }
        if (nextValueIs(input, pos, ")")) {
          pos = handle(pos, linkedList, ")");
        } else if (nextValueIs(input, pos, "(")) {
          pos = handle(pos, linkedList, "(");
        } else if (nextValueIs(input, pos, " ")) {
          pos++;
        } else {
          pos = handleText(input, pos, linkedList);
        }
      }
    }