Checkin for Seaspider and Parser generator script.
[oweals/gnunet.git] / src / monkey / seaspider / org / gnunet / seaspider / parser / Token.java
1 package org.gnunet.seaspider.parser;
2 /* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
3 /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
4 /**
5  * Describes the input token stream.
6  */
7
8 public class Token implements java.io.Serializable {
9
10   /**
11    * The version identifier for this Serializable class.
12    * Increment only if the <i>serialized</i> form of the
13    * class changes.
14    */
15   private static final long serialVersionUID = 1L;
16
17   /**
18    * An integer that describes the kind of this token.  This numbering
19    * system is determined by JavaCCParser, and a table of these numbers is
20    * stored in the file ...Constants.java.
21    */
22   public int kind;
23
24   /** The line number of the first character of this Token. */
25   public int beginLine;
26   /** The column number of the first character of this Token. */
27   public int beginColumn;
28   /** The line number of the last character of this Token. */
29   public int endLine;
30   /** The column number of the last character of this Token. */
31   public int endColumn;
32
33   /**
34    * The string image of the token.
35    */
36   public String image;
37
38   /**
39    * A reference to the next regular (non-special) token from the input
40    * stream.  If this is the last token from the input stream, or if the
41    * token manager has not read tokens beyond this one, this field is
42    * set to null.  This is true only if this token is also a regular
43    * token.  Otherwise, see below for a description of the contents of
44    * this field.
45    */
46   public Token next;
47
48   /**
49    * This field is used to access special tokens that occur prior to this
50    * token, but after the immediately preceding regular (non-special) token.
51    * If there are no such special tokens, this field is set to null.
52    * When there are more than one such special token, this field refers
53    * to the last of these special tokens, which in turn refers to the next
54    * previous special token through its specialToken field, and so on
55    * until the first special token (whose specialToken field is null).
56    * The next fields of special tokens refer to other special tokens that
57    * immediately follow it (without an intervening regular token).  If there
58    * is no such token, this field is null.
59    */
60   public Token specialToken;
61
62   /**
63    * An optional attribute value of the Token.
64    * Tokens which are not used as syntactic sugar will often contain
65    * meaningful values that will be used later on by the compiler or
66    * interpreter. This attribute value is often different from the image.
67    * Any subclass of Token that actually wants to return a non-null value can
68    * override this method as appropriate.
69    */
70   public Object getValue() {
71     return null;
72   }
73
74   /**
75    * No-argument constructor
76    */
77   public Token() {}
78
79   /**
80    * Constructs a new token for the specified Image.
81    */
82   public Token(int kind)
83   {
84     this(kind, null);
85   }
86
87   /**
88    * Constructs a new token for the specified Image and Kind.
89    */
90   public Token(int kind, String image)
91   {
92     this.kind = kind;
93     this.image = image;
94   }
95
96   /**
97    * Returns the image.
98    */
99   public String toString()
100   {
101     return image;
102   }
103
104   /**
105    * Returns a new Token object, by default. However, if you want, you
106    * can create and return subclass objects based on the value of ofKind.
107    * Simply add the cases to the switch for all those special cases.
108    * For example, if you have a subclass of Token called IDToken that
109    * you want to create if ofKind is ID, simply add something like :
110    *
111    *    case MyParserConstants.ID : return new IDToken(ofKind, image);
112    *
113    * to the following switch statement. Then you can cast matchedToken
114    * variable to the appropriate type and use sit in your lexical actions.
115    */
116   public static Token newToken(int ofKind, String image)
117   {
118     switch(ofKind)
119     {
120       default : return new Token(ofKind, image);
121     }
122   }
123
124   public static Token newToken(int ofKind)
125   {
126     return newToken(ofKind, null);
127   }
128
129 }
130 /* JavaCC - OriginalChecksum=6145f5d5b504ccb4f95e09f2ce3e748a (do not edit this line) */