History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/com/sun/tools/example/debug/expr/Token.java (1 of 18352 files). Show all

Unified · Split

java/pkg/com/sun/tools/example/debug/expr/Token.java+107−0
@@ -0,0 +1,107 @@
1/*
2 * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
27package com.sun.tools.example.debug.expr;
28
29/**
30 * Describes the input token stream.
31 */
32
33public class Token {
34
35 /**
36 * An integer that describes the kind of this token. This numbering
37 * system is determined by JavaCCParser, and a table of these numbers is
38 * stored in the file ...Constants.java.
39 */
40 public int kind;
41
42 /**
43 * beginLine and beginColumn describe the position of the first character
44 * of this token; endLine and endColumn describe the position of the
45 * last character of this token.
46 */
47 public int beginLine, beginColumn, endLine, endColumn;
48
49 /**
50 * The string image of the token.
51 */
52 public String image;
53
54 /**
55 * A reference to the next regular (non-special) token from the input
56 * stream. If this is the last token from the input stream, or if the
57 * token manager has not read tokens beyond this one, this field is
58 * set to null. This is true only if this token is also a regular
59 * token. Otherwise, see below for a description of the contents of
60 * this field.
61 */
62 public Token next;
63
64 /**
65 * This field is used to access special tokens that occur prior to this
66 * token, but after the immediately preceding regular (non-special) token.
67 * If there are no such special tokens, this field is set to null.
68 * When there are more than one such special token, this field refers
69 * to the last of these special tokens, which in turn refers to the next
70 * previous special token through its specialToken field, and so on
71 * until the first special token (whose specialToken field is null).
72 * The next fields of special tokens refer to other special tokens that
73 * immediately follow it (without an intervening regular token). If there
74 * is no such token, this field is null.
75 */
76 public Token specialToken;
77
78 /**
79 * Returns the image.
80 */
81 @Override
82 public final String toString()
83 {
84 return image;
85 }
86
87 /**
88 * Returns a new Token object, by default. However, if you want, you
89 * can create and return subclass objects based on the value of ofKind.
90 * Simply add the cases to the switch for all those special cases.
91 * For example, if you have a subclass of Token called IDToken that
92 * you want to create if ofKind is ID, simlpy add something like :
93 *
94 * case MyParserConstants.ID : return new IDToken();
95 *
96 * to the following switch statement. Then you can cast matchedToken
97 * variable to the appropriate type and use it in your lexical actions.
98 */
99 public static final Token newToken(int ofKind)
100 {
101 switch(ofKind)
102 {
103 default : return new Token();
104 }
105 }
106
107}