示例#1
0
        /* throws ParseException */
        private static AstToken jj_consume_token(AstParserConstants.AstRegExpId kind)
        {
            AstToken oldToken;
            if ((oldToken = token).next != null)
                token = token.next;
            else
                token = token.next = AstParserTokenManager.getNextToken();
            jj_ntk = AstRegExpId.UNDEFINED;

            if (token.kind == kind)
            {
                jj_gen++;
                return token;
            }
            token = oldToken;
            jj_kind = kind;
            throw generateParseException();
        }
示例#2
0
 public static AstToken newToken(AstParserConstants.AstRegExpId ofKind)
 {
     return newToken(ofKind, null);
 }
示例#3
0
 /**
  * Constructs a new token for the specified Image and Kind.
  */
 public AstToken(AstParserConstants.AstRegExpId kind, string image)
 {
     this.kind = kind;
     this.image = image;
 }
示例#4
0
 /**
  * Returns a new Token object, by default. However, if you want, you
  * can create and return subclass objects based on the value of ofKind.
  * Simply add the cases to the switch for all those special cases.
  * For example, if you have a subclass of Token called IDToken that
  * you want to create if ofKind is ID, simply add something like :
  *
  *    case MyParserConstants.ID : return new IDToken(ofKind, image);
  *
  * to the following switch statement. Then you can cast matchedToken
  * variable to the appropriate type and use sit in your lexical actions.
  */
 public static AstToken newToken(AstParserConstants.AstRegExpId ofKind, String image)
 {
     switch (ofKind)
     {
         default: return new AstToken(ofKind, image);
     }
 }
示例#5
0
 /**
  * Constructs a new token for the specified Image.
  */
 public AstToken(AstParserConstants.AstRegExpId kind)
     : this(kind, null)
 {
 }