~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to xml/text-edit/src/org/netbeans/modules/xml/text/syntax/javacc/Token.java

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
ImportĀ upstreamĀ versionĀ 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
 
2
/*
 
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
4
 *
 
5
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 
6
 *
 
7
 * The contents of this file are subject to the terms of either the GNU
 
8
 * General Public License Version 2 only ("GPL") or the Common
 
9
 * Development and Distribution License("CDDL") (collectively, the
 
10
 * "License"). You may not use this file except in compliance with the
 
11
 * License. You can obtain a copy of the License at
 
12
 * http://www.netbeans.org/cddl-gplv2.html
 
13
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
 
14
 * specific language governing permissions and limitations under the
 
15
 * License.  When distributing the software, include this License Header
 
16
 * Notice in each file and include the License file at
 
17
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
 
18
 * particular file as subject to the "Classpath" exception as provided
 
19
 * by Sun in the GPL Version 2 section of the License file that
 
20
 * accompanied this code. If applicable, add the following below the
 
21
 * License Header, with the fields enclosed by brackets [] replaced by
 
22
 * your own identifying information:
 
23
 * "Portions Copyrighted [year] [name of copyright owner]"
 
24
 *
 
25
 * Contributor(s):
 
26
 *
 
27
 * The Original Software is NetBeans. The Initial Developer of the Original
 
28
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
 
29
 * Microsystems, Inc. All Rights Reserved.
 
30
 *
 
31
 * If you wish your version of this file to be governed by only the CDDL
 
32
 * or only the GPL Version 2, indicate your decision by adding
 
33
 * "[Contributor] elects to include this software in this distribution
 
34
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
 
35
 * single choice of license, a recipient has the option to distribute
 
36
 * your version of this file under either the CDDL, the GPL Version 2 or
 
37
 * to extend the choice of license to its licensees as provided above.
 
38
 * However, if you add GPL Version 2 code and therefore, elected the GPL
 
39
 * Version 2 license, then the option applies only if the new code is
 
40
 * made subject to such option by the copyright holder.
 
41
 */
 
42
 
 
43
package org.netbeans.modules.xml.text.syntax.javacc;
 
44
 
 
45
/**
 
46
 * Describes the input token stream.
 
47
 */
 
48
 
 
49
public class Token {
 
50
 
 
51
  /**
 
52
   * An integer that describes the kind of this token.  This numbering
 
53
   * system is determined by JavaCCParser, and a table of these numbers is
 
54
   * stored in the file ...Constants.java.
 
55
   */
 
56
  public int kind;
 
57
 
 
58
  /**
 
59
   * beginLine and beginColumn describe the position of the first character
 
60
   * of this token; endLine and endColumn describe the position of the
 
61
   * last character of this token.
 
62
   */
 
63
  public int beginLine, beginColumn, endLine, endColumn;
 
64
 
 
65
  /**
 
66
   * The string image of the token.
 
67
   */
 
68
  public String image;
 
69
 
 
70
  /**
 
71
   * A reference to the next regular (non-special) token from the input
 
72
   * stream.  If this is the last token from the input stream, or if the
 
73
   * token manager has not read tokens beyond this one, this field is
 
74
   * set to null.  This is true only if this token is also a regular
 
75
   * token.  Otherwise, see below for a description of the contents of
 
76
   * this field.
 
77
   */
 
78
  public Token next;
 
79
 
 
80
  /**
 
81
   * This field is used to access special tokens that occur prior to this
 
82
   * token, but after the immediately preceding regular (non-special) token.
 
83
   * If there are no such special tokens, this field is set to null.
 
84
   * When there are more than one such special token, this field refers
 
85
   * to the last of these special tokens, which in turn refers to the next
 
86
   * previous special token through its specialToken field, and so on
 
87
   * until the first special token (whose specialToken field is null).
 
88
   * The next fields of special tokens refer to other special tokens that
 
89
   * immediately follow it (without an intervening regular token).  If there
 
90
   * is no such token, this field is null.
 
91
   */
 
92
  public Token specialToken;
 
93
 
 
94
  /**
 
95
   * Returns the image.
 
96
   */
 
97
  public String toString()
 
98
  {
 
99
     return image;
 
100
  }
 
101
 
 
102
  /**
 
103
   * Returns a new Token object, by default. However, if you want, you
 
104
   * can create and return subclass objects based on the value of ofKind.
 
105
   * Simply add the cases to the switch for all those special cases.
 
106
   * For example, if you have a subclass of Token called IDToken that
 
107
   * you want to create if ofKind is ID, simlpy add something like :
 
108
   *
 
109
   *    case MyParserConstants.ID : return new IDToken();
 
110
   *
 
111
   * to the following switch statement. Then you can cast matchedToken
 
112
   * variable to the appropriate type and use it in your lexical actions.
 
113
   */
 
114
  public static final Token newToken(int ofKind)
 
115
  {
 
116
     switch(ofKind)
 
117
     {
 
118
       default : return new Token();
 
119
     }
 
120
  }
 
121
 
 
122
}