示例#1
0
 protected String hvalue() throws ParseException {
   StringBuffer retval = new StringBuffer();
   while (lexer.hasMoreChars()) {
     char la = lexer.lookAhead(0);
     // Look for a character that can terminate a URL.
     if (la == '+'
         || la == '?'
         || la == ':'
         || la == '['
         || la == ']'
         || la == '/'
         || la == '$'
         || la == '_'
         || la == '-'
         || la == '"'
         || la == '!'
         || la == '~'
         || la == '*'
         || la == '.'
         || la == '('
         || la == ')'
         || Lexer.isAlpha(la)
         || Lexer.isDigit(la)) {
       lexer.consume(1);
       retval.append(la);
     } else if (la == '%') {
       retval.append(escaped());
     } else break;
   }
   return retval.toString();
 }
示例#2
0
  /**
   * Parser for telephone subscriber.
   *
   * @return the parsed telephone number.
   */
  public final TelephoneNumber parseTelephoneNumber() throws ParseException {
    TelephoneNumber tn;

    if (debug) dbg_enter("telephone_subscriber");
    lexer.selectLexer("charLexer");
    try {
      char c = lexer.lookAhead(0);
      if (c == '+') tn = global_phone_number();
      else if (Lexer.isAlpha(c)
          || Lexer.isDigit(c)
          || c == '-'
          || c == '*'
          || c == '.'
          || c == '('
          || c == ')'
          || c == '#') {
        tn = local_phone_number();
      } else throw createParseException("unexpected char " + c);
      return tn;
    } finally {
      if (debug) dbg_leave("telephone_subscriber");
    }
  }
示例#3
0
 protected static boolean isUnreserved(char next) {
   return Lexer.isAlpha(next) || Lexer.isDigit(next) || isMark(next);
 }