Пример #1
0
  private void handleKeywordState(char c, List<Token> tokenList, StringBuffer buf) {

    if (Character.isJavaIdentifierPart(c)) {
      buf.append(c);
    } else if (c == CURLY_LEFT) {
      addValuedToken(Token.SIMPLE_KEYWORD, buf, tokenList);
      state = TokenizerState.OPTION_STATE;
    } else if (c == CoreConstants.LEFT_PARENTHESIS_CHAR) {
      addValuedToken(Token.COMPOSITE_KEYWORD, buf, tokenList);
      state = TokenizerState.LITERAL_STATE;
    } else if (c == CoreConstants.PERCENT_CHAR) {
      addValuedToken(Token.SIMPLE_KEYWORD, buf, tokenList);
      tokenList.add(Token.PERCENT_TOKEN);
      state = TokenizerState.FORMAT_MODIFIER_STATE;
    } else if (c == CoreConstants.RIGHT_PARENTHESIS_CHAR) {
      addValuedToken(Token.SIMPLE_KEYWORD, buf, tokenList);
      state = TokenizerState.RIGHT_PARENTHESIS_STATE;
    } else {
      addValuedToken(Token.SIMPLE_KEYWORD, buf, tokenList);
      if (c == ESCAPE_CHAR) {
        if ((pointer < patternLength)) {
          char next = pattern.charAt(pointer++);
          escapeUtil.escape("%()", buf, next, pointer);
        }
      } else {
        buf.append(c);
      }
      state = TokenizerState.LITERAL_STATE;
    }
  }
Пример #2
0
 void optionEscape(String escapeChars, StringBuffer buf) {
   if ((pointer < patternLength)) {
     char next = pattern.charAt(pointer++);
     optionEscapeUtil.escape(escapeChars, buf, next, pointer);
   }
 }