1e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
2e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru/*
3e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru *  Copyright 2004 the mime4j project
4e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru *
5e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru *  Licensed under the Apache License, Version 2.0 (the "License");
6e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru *  you may not use this file except in compliance with the License.
7e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru *  You may obtain a copy of the License at
8e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru *
9e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru *      http://www.apache.org/licenses/LICENSE-2.0
10e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru *
11e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru *  Unless required by applicable law or agreed to in writing, software
12e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru *  distributed under the License is distributed on an "AS IS" BASIS,
13e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru *  See the License for the specific language governing permissions and
15e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru *  limitations under the License.
16e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru */
17e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Querupackage org.apache.james.mime4j.field.contenttype.parser;
18e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru
19e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru/**
20e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru * Describes the input token stream.
21e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru */
22e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru
23e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Querupublic class Token {
24e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru
25e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  /**
26e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * An integer that describes the kind of this token.  This numbering
27e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * system is determined by JavaCCParser, and a table of these numbers is
28e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * stored in the file ...Constants.java.
29e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   */
30e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  public int kind;
31e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru
32e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  /**
33e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * beginLine and beginColumn describe the position of the first character
34e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * of this token; endLine and endColumn describe the position of the
35e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * last character of this token.
36e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   */
37e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  public int beginLine, beginColumn, endLine, endColumn;
38e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru
39e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  /**
40e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * The string image of the token.
41e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   */
42e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  public String image;
43e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru
44e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  /**
45e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * A reference to the next regular (non-special) token from the input
46e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * stream.  If this is the last token from the input stream, or if the
47e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * token manager has not read tokens beyond this one, this field is
48e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * set to null.  This is true only if this token is also a regular
49e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * token.  Otherwise, see below for a description of the contents of
50e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * this field.
51e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   */
52e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  public Token next;
53e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru
54e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  /**
55e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * This field is used to access special tokens that occur prior to this
56e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * token, but after the immediately preceding regular (non-special) token.
57e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * If there are no such special tokens, this field is set to null.
58e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * When there are more than one such special token, this field refers
59e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * to the last of these special tokens, which in turn refers to the next
60e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * previous special token through its specialToken field, and so on
61e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * until the first special token (whose specialToken field is null).
62e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * The next fields of special tokens refer to other special tokens that
63e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * immediately follow it (without an intervening regular token).  If there
64e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * is no such token, this field is null.
65e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   */
66e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  public Token specialToken;
67e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru
68e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  /**
69e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * Returns the image.
70e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   */
71e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  public String toString()
72e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  {
73e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru     return image;
74e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  }
75e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru
76e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  /**
77e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * Returns a new Token object, by default. However, if you want, you
78e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * can create and return subclass objects based on the value of ofKind.
79e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * Simply add the cases to the switch for all those special cases.
80e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * For example, if you have a subclass of Token called IDToken that
81e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * you want to create if ofKind is ID, simlpy add something like :
82e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   *
83e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   *    case MyParserConstants.ID : return new IDToken();
84e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   *
85e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * to the following switch statement. Then you can cast matchedToken
86e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   * variable to the appropriate type and use it in your lexical actions.
87e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru   */
88e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  public static final Token newToken(int ofKind)
89e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  {
90e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru     switch(ofKind)
91e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru     {
92e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru       default : return new Token();
93e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru     }
94e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru  }
95e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru
96e858128e970bdead5d5a096d9b5d941b2f5efadeJean-Baptiste Queru}
97