FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
processing/app/src/processing/app/syntax/Token.java at master · processing/processing · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
processing
/
processing
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
1.5k
Star
6.5k
Code
Issues
0
Pull requests
0
Actions
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
processing
/
app
/
src
/
processing
/
app
/
syntax
/
Token.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
143 lines (112 loc) · 3.59 KB
Breadcrumbs
processing
/
app
/
src
/
processing
/
app
/
syntax
/
Token.java
Copy path
File metadata and controls
143 lines (112 loc) · 3.59 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
* Token.java - Generic token
* Copyright (C) 1998, 1999 Slava Pestov
*
* You may use and modify this package for any purpose. Redistribution is
* permitted, in both source and binary form, provided that this notice
* remains intact in all source distributions of this package.
*/
package
processing
.
app
.
syntax
;
/**
* A linked list of tokens. Each token has three fields - a token
* identifier, which is a byte value that can be looked up in the
* array returned by <code>SyntaxDocument.getColors()</code>
* to get a color value, a length value which is the length of the
* token in the text, and a pointer to the next token in the list.
*
* @author Slava Pestov
* @version $Id$
*/
public
class
Token
{
/** Normal text token id. This should be used to mark normal text. */
public
static
final
byte
NULL
=
0
;
/** This can be used to mark a comment. */
public
static
final
byte
COMMENT1
=
1
;
/** This can be used to mark a comment. */
public
static
final
byte
COMMENT2
=
2
;
/** Strings in quotes */
public
static
final
byte
LITERAL1
=
3
;
/** Constants (QUARTER_PI, CORNERS, etc.) */
public
static
final
byte
LITERAL2
=
4
;
/**
* Label token id. This can be used to mark labels
* (eg, C mode uses this to mark ...: sequences)
*/
public
static
final
byte
LABEL
=
5
;
/** Keywords (void, int, boolean, etc.) */
public
static
final
byte
KEYWORD1
=
6
;
/** Fields [variables within a class] */
public
static
final
byte
KEYWORD2
=
7
;
/** Loop/function-like blocks (for, while, etc.) */
public
static
final
byte
KEYWORD3
=
8
;
/** Processing variables (width, height, focused, etc.) */
public
static
final
byte
KEYWORD4
=
9
;
/** Datatypes (int, boolean, etc.) */
public
static
final
byte
KEYWORD5
=
10
;
/** Keywords which can be followed by parenthesis */
public
static
final
byte
KEYWORD6
=
11
;
/** Functions */
public
static
final
byte
FUNCTION1
=
12
;
/** Methods (functions inside a class) */
public
static
final
byte
FUNCTION2
=
13
;
/** Loop/function-like blocks (for, while, etc.) */
public
static
final
byte
FUNCTION3
=
14
;
/** Built-in Processing functions (setup, draw, mouseDragged). */
public
static
final
byte
FUNCTION4
=
15
;
/**
* Operator token id. This can be used to mark an
* operator. (eg, SQL mode marks +, -, etc with this
* token type)
*/
public
static
final
byte
OPERATOR
=
16
;
/**
* Invalid token id. This can be used to mark invalid
* or incomplete tokens, so the user can easily spot
* syntax errors.
*/
public
static
final
byte
INVALID
=
17
;
/** The total number of defined token ids. */
public
static
final
byte
ID_COUNT
=
INVALID
+
1
;
/**
* The first id that can be used for internal state
* in a token marker.
*/
public
static
final
byte
INTERNAL_FIRST
=
100
;
/**
* The last id that can be used for internal state
* in a token marker.
*/
public
static
final
byte
INTERNAL_LAST
=
126
;
/**
* The token type, that along with a length of 0
* marks the end of the token list.
*/
public
static
final
byte
END
=
127
;
/**
* The length of this token.
*/
public
int
length
;
/**
* The id of this token.
*/
public
byte
id
;
/**
* The next token in the linked list.
*/
public
Token
next
;
/**
* Creates a new token.
* @param length The length of the token
* @param id The id of the token
*/
public
Token
(
int
length
,
byte
id
) {
this
.
length
=
length
;
this
.
id
=
id
;
}
/**
* Returns a string representation of this token.
*/
public
String
toString
() {
return
"[id="
+
id
+
",length="
+
length
+
"]"
;
}
}
Back
|
FazBrowse Home
|
New Git URL