PageRenderTime 36ms CodeModel.GetById 18ms app.highlight 8ms RepoModel.GetById 7ms app.codeStats 0ms

/jEdit/tags/jedit-4-1-pre5/bsh/Token.java

#
Java | 82 lines | 19 code | 10 blank | 53 comment | 0 complexity | 3f0c02d89488e183d406b0e27bfc601e MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
 1/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
 2package bsh;
 3
 4/**
 5 * Describes the input token stream.
 6 */
 7
 8// Note: bsh added serializable
 9class Token implements java.io.Serializable {
10
11  /**
12   * An integer that describes the kind of this token.  This numbering
13   * system is determined by JavaCCParser, and a table of these numbers is
14   * stored in the file ...Constants.java.
15   */
16  public int kind;
17
18  /**
19   * beginLine and beginColumn describe the position of the first character
20   * of this token; endLine and endColumn describe the position of the
21   * last character of this token.
22   */
23  public int beginLine, beginColumn, endLine, endColumn;
24
25  /**
26   * The string image of the token.
27   */
28  public String image;
29
30  /**
31   * A reference to the next regular (non-special) token from the input
32   * stream.  If this is the last token from the input stream, or if the
33   * token manager has not read tokens beyond this one, this field is
34   * set to null.  This is true only if this token is also a regular
35   * token.  Otherwise, see below for a description of the contents of
36   * this field.
37   */
38  public Token next;
39
40  /**
41   * This field is used to access special tokens that occur prior to this
42   * token, but after the immediately preceding regular (non-special) token.
43   * If there are no such special tokens, this field is set to null.
44   * When there are more than one such special token, this field refers
45   * to the last of these special tokens, which in turn refers to the next
46   * previous special token through its specialToken field, and so on
47   * until the first special token (whose specialToken field is null).
48   * The next fields of special tokens refer to other special tokens that
49   * immediately follow it (without an intervening regular token).  If there
50   * is no such token, this field is null.
51   */
52  public Token specialToken;
53
54  /**
55   * Returns the image.
56   */
57  public final String toString()
58  {
59     return image;
60  }
61
62  /**
63   * Returns a new Token object, by default. However, if you want, you
64   * can create and return subclass objects based on the value of ofKind.
65   * Simply add the cases to the switch for all those special cases.
66   * For example, if you have a subclass of Token called IDToken that
67   * you want to create if ofKind is ID, simlpy add something like :
68   *
69   *    case MyParserConstants.ID : return new IDToken();
70   *
71   * to the following switch statement. Then you can cast matchedToken
72   * variable to the appropriate type and use it in your lexical actions.
73   */
74  public static final Token newToken(int ofKind)
75  {
76     switch(ofKind)
77     {
78       default : return new Token();
79     }
80  }
81
82}