001: /* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */
002: /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null */
003: package org.netbeans.modules.css.parser;
004:
005: /**
006: * Describes the input token stream.
007: */
008:
009: public class Token {
010:
011: /**
012: * An integer that describes the kind of this token. This numbering
013: * system is determined by JavaCCParser, and a table of these numbers is
014: * stored in the file ...Constants.java.
015: */
016: public int kind;
017:
018: //marek
019: public int offset;
020:
021: /** The line number of the first character of this Token. */
022: public int beginLine;
023: /** The column number of the first character of this Token. */
024: public int beginColumn;
025: /** The line number of the last character of this Token. */
026: public int endLine;
027: /** The column number of the last character of this Token. */
028: public int endColumn;
029:
030: /**
031: * The string image of the token.
032: */
033: public String image;
034:
035: /**
036: * A reference to the next regular (non-special) token from the input
037: * stream. If this is the last token from the input stream, or if the
038: * token manager has not read tokens beyond this one, this field is
039: * set to null. This is true only if this token is also a regular
040: * token. Otherwise, see below for a description of the contents of
041: * this field.
042: */
043: public Token next;
044:
045: /**
046: * This field is used to access special tokens that occur prior to this
047: * token, but after the immediately preceding regular (non-special) token.
048: * If there are no such special tokens, this field is set to null.
049: * When there are more than one such special token, this field refers
050: * to the last of these special tokens, which in turn refers to the next
051: * previous special token through its specialToken field, and so on
052: * until the first special token (whose specialToken field is null).
053: * The next fields of special tokens refer to other special tokens that
054: * immediately follow it (without an intervening regular token). If there
055: * is no such token, this field is null.
056: */
057: public Token specialToken;
058:
059: /**
060: * An optional attribute value of the Token.
061: * Tokens which are not used as syntactic sugar will often contain
062: * meaningful values that will be used later on by the compiler or
063: * interpreter. This attribute value is often different from the image.
064: * Any subclass of Token that actually wants to return a non-null value can
065: * override this method as appropriate.
066: */
067: public Object getValue() {
068: return null;
069: }
070:
071: /**
072: * No-argument contructor
073: */
074: public Token() {
075: }
076:
077: /**
078: * Constructs a new token for the specified Image.
079: */
080: public Token(int kind) {
081: this (kind, null);
082: }
083:
084: /**
085: * Constructs a new token for the specified Image and Kind.
086: */
087: public Token(int kind, String image) {
088: this .kind = kind;
089: this .image = image;
090: }
091:
092: /**
093: * Returns the image.
094: */
095: public String toString() {
096: return "Token( " + offset + "; '" + image + "')";
097: }
098:
099: /**
100: * Returns a new Token object, by default. However, if you want, you
101: * can create and return subclass objects based on the value of ofKind.
102: * Simply add the cases to the switch for all those special cases.
103: * For example, if you have a subclass of Token called IDToken that
104: * you want to create if ofKind is ID, simply add something like :
105: *
106: * case MyParserConstants.ID : return new IDToken(ofKind, image);
107: *
108: * to the following switch statement. Then you can cast matchedToken
109: * variable to the appropriate type and use sit in your lexical actions.
110: */
111: public static Token newToken(int ofKind, String image) {
112: switch (ofKind) {
113: default:
114: return new Token(ofKind, image);
115: }
116: }
117:
118: public static Token newToken(int ofKind) {
119: return newToken(ofKind, null);
120: }
121:
122: }
123: /* JavaCC - OriginalChecksum=b0f7016462c5245c2ce7cbccca00653c (do not edit this line) */
|