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