コード例 #1
0
ファイル: Chset.java プロジェクト: ungly/opengse
 /**
  * Creates a new character set which matches a character if that character matches either the
  * {@code left} or {@code right} character sets.
  *
  * <p>left | right
  *
  * @param left The left source character set.
  * @param right The right source character set.
  */
 public static Chset union(Chset left, Chset right) {
   Chset n = left.clone();
   for (Range r : right.ranges) {
     n.set(r);
   }
   return n;
 }
コード例 #2
0
ファイル: Chset.java プロジェクト: ungly/opengse
 /**
  * Creates a new character set which matches a character if that character matches the {@code
  * left} character set but does not match the {@code right} character set.
  *
  * <p>left - right
  *
  * @param left The left source character set.
  * @param right The right source character set.
  */
 public static Chset difference(Chset left, Chset right) {
   Chset n = left.clone();
   for (Range r : right.ranges) {
     n.clear(r);
   }
   return n;
 }
コード例 #3
0
  static {
    /**
     * The id part of the session cookie is expected to be web escaped Base64 encoded, so uses
     * a-zA-Z0-9_-, instead of a-zA-Z0-9+/
     */
    Chset typeCharSet = Chset.union(Chset.ALNUM, new Chset("_-"));
    Chset idCharSet = Chset.union(Chset.ALNUM, new Chset("_-"));
    Parser<SessionCookie> servertype = typeCharSet.plus().action(new ServerTypeAction());
    Parser<SessionCookie> id = idCharSet.plus().action(new IdAction());
    Parser<SessionCookie> pair = Parser.sequence(servertype, new Chset('='), id);
    pair = Parser.sequence(servertype, pair);
    Parser<SessionCookie> extrapair = Parser.sequence(new Chset(':'), pair);

    PARSER = Parser.sequence(pair, extrapair.star());
  }