Coverage Report - org.webslinger.rules.Token
 
Classes in this File Line Coverage Branch Coverage Complexity
Token
60%
3/5
100%
1/1
1
 
 1  
 package org.webslinger.rules;
 2  
 
 3  
 import org.webslinger.javacc.GenericToken;
 4  
 
 5  
 /**
 6  
  * Describes the input token stream.
 7  
  */
 8  
 
 9  5209
 public class Token extends GenericToken {
 10  
 
 11  
   /**
 12  
    * A reference to the next regular (non-special) token from the input
 13  
    * stream.  If this is the last token from the input stream, or if the
 14  
    * token manager has not read tokens beyond this one, this field is
 15  
    * set to null.  This is true only if this token is also a regular
 16  
    * token.  Otherwise, see below for a description of the contents of
 17  
    * this field.
 18  
    */
 19  
   public Token next;
 20  
 
 21  
   /**
 22  
    * This field is used to access special tokens that occur prior to this
 23  
    * token, but after the immediately preceding regular (non-special) token.
 24  
    * If there are no such special tokens, this field is set to null.
 25  
    * When there are more than one such special token, this field refers
 26  
    * to the last of these special tokens, which in turn refers to the next
 27  
    * previous special token through its specialToken field, and so on
 28  
    * until the first special token (whose specialToken field is null).
 29  
    * The next fields of special tokens refer to other special tokens that
 30  
    * immediately follow it (without an intervening regular token).  If there
 31  
    * is no such token, this field is null.
 32  
    */
 33  
   public Token specialToken;
 34  
 
 35  
   public GenericToken getNextToken() {
 36  0
       return next;
 37  
   }
 38  
 
 39  
   public GenericToken getSpecialToken() {
 40  0
       return specialToken;
 41  
   }
 42  
 
 43  
   /**
 44  
    * Returns a new Token object, by default. However, if you want, you
 45  
    * can create and return subclass objects based on the value of ofKind.
 46  
    * Simply add the cases to the switch for all those special cases.
 47  
    * For example, if you have a subclass of Token called IDToken that
 48  
    * you want to create if ofKind is ID, simlpy add something like :
 49  
    *
 50  
    *    case MyParserConstants.ID : return new IDToken();
 51  
    *
 52  
    * to the following switch statement. Then you can cast matchedToken
 53  
    * variable to the appropriate type and use it in your lexical actions.
 54  
    */
 55  
   public static final Token newToken(int ofKind)
 56  
   {
 57  5187
      switch(ofKind)
 58  
      {
 59  5187
        default : return new Token();
 60  
      }
 61  
   }
 62  
 }