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 package com.sun.javafx.css.parser;
27
28
29 final class Token {
30
31 final static int EOF = -1;
32 final static int INVALID = 0;
33 final static int SKIP = 1;
34
35 final static Token EOF_TOKEN = new Token(EOF, "EOF");
36 final static Token INVALID_TOKEN = new Token(INVALID, "INVALID");
37 final static Token SKIP_TOKEN = new Token(SKIP, "SKIP");
38
39 Token(int type, String text, int line, int offset) {
40 this.type = type;
41 this.text = text;
42 this.line = line;
43 this.offset = offset;
44 }
45
46 Token(int type, String text) {
47 this(type, text, -1, -1);
48 }
49
50 Token(int type) {
51 this(type, null);
52 }
53
54 private Token() {
55 this(0, "INVALID");
56 }
57
58 String getText() {
59 return text;
60 }
61
62 int getType() {
63 return type;
64 }
65
66 int getLine() {
67 return line;
68 }
69
70 void setLine(int line) {
71 this.line = line;
72 }
73
74 int getOffset() {
75 return offset;
76 }
77
78 void setOffset(int offset) {
79 this.offset = offset;
80 }
81
82 @Override public String toString() {
83 final StringBuilder buf = new StringBuilder();
84 buf.append('[').append(line).append(',').append(offset).append(']')
85 .append(',').append(text).append(",<").append(type).append('>');
86 return buf.toString();
87 }
88
89 @Override
90 public boolean equals(Object obj) {
91 if (this == obj) return true;
92 if (obj == null ||
93 getClass() != obj.getClass()) {
94 return false;
|
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 package com.sun.javafx.css.parser;
27
28
29 public final class Token {
30
31 public final static int EOF = -1;
32 public final static int INVALID = 0;
33 public final static int SKIP = 1;
34
35 public final static Token EOF_TOKEN = new Token(EOF, "EOF");
36 public final static Token INVALID_TOKEN = new Token(INVALID, "INVALID");
37 public final static Token SKIP_TOKEN = new Token(SKIP, "SKIP");
38
39 public Token(int type, String text, int line, int offset) {
40 this.type = type;
41 this.text = text;
42 this.line = line;
43 this.offset = offset;
44 }
45
46 public Token(int type, String text) {
47 this(type, text, -1, -1);
48 }
49
50 Token(int type) {
51 this(type, null);
52 }
53
54 private Token() {
55 this(0, "INVALID");
56 }
57
58 public String getText() {
59 return text;
60 }
61
62 public int getType() {
63 return type;
64 }
65
66 public int getLine() {
67 return line;
68 }
69
70 void setLine(int line) {
71 this.line = line;
72 }
73
74 public int getOffset() {
75 return offset;
76 }
77
78 void setOffset(int offset) {
79 this.offset = offset;
80 }
81
82 @Override public String toString() {
83 final StringBuilder buf = new StringBuilder();
84 buf.append('[').append(line).append(',').append(offset).append(']')
85 .append(',').append(text).append(",<").append(type).append('>');
86 return buf.toString();
87 }
88
89 @Override
90 public boolean equals(Object obj) {
91 if (this == obj) return true;
92 if (obj == null ||
93 getClass() != obj.getClass()) {
94 return false;
|