line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* |
2
|
|
|
|
|
|
|
Copyright (C) 2016-2017 Alexander Borisov |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or |
5
|
|
|
|
|
|
|
modify it under the terms of the GNU Lesser General Public |
6
|
|
|
|
|
|
|
License as published by the Free Software Foundation; either |
7
|
|
|
|
|
|
|
version 2.1 of the License, or (at your option) any later version. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful, |
10
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12
|
|
|
|
|
|
|
Lesser General Public License for more details. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public |
15
|
|
|
|
|
|
|
License along with this library; if not, write to the Free Software |
16
|
|
|
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Author: lex.borisov@gmail.com (Alexander Borisov) |
19
|
|
|
|
|
|
|
*/ |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#include "mycss/tokenizer_end.h" |
22
|
|
|
|
|
|
|
|
23
|
109
|
|
|
|
|
|
size_t mycss_tokenizer_end_run_state_single(mycss_entry_t* entry, mycss_tokenizer_state_t state, const char* css, size_t css_offset, size_t css_size) |
24
|
|
|
|
|
|
|
{ |
25
|
109
|
|
|
|
|
|
mycss_t* mycss = entry->mycss; |
26
|
109
|
|
|
|
|
|
mycss_tokenizer_state_f* state_f = mycss->parse_state_func; |
27
|
|
|
|
|
|
|
|
28
|
109
|
|
|
|
|
|
return state_f[state + MyCSS_TOKENIZER_STATE_LAST_ENTRY](entry, entry->token, css, css_offset, css_size); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
32
|
|
|
|
|
|
|
//// whitespace |
33
|
|
|
|
|
|
|
//// |
34
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
35
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_whitespace(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
36
|
|
|
|
|
|
|
{ |
37
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
38
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
|
if(token->length) { |
40
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_WHITESPACE; |
41
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return css_size; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
48
|
|
|
|
|
|
|
//// U+0022 QUOTATION MARK (") |
49
|
|
|
|
|
|
|
//// |
50
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
51
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_quotation_mark(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
52
|
|
|
|
|
|
|
{ |
53
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_BAD_STRING; |
54
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
55
|
|
|
|
|
|
|
|
56
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return css_size; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_quotation_mark_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
62
|
|
|
|
|
|
|
{ |
63
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
64
|
0
|
|
|
|
|
|
return css_size; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
68
|
|
|
|
|
|
|
//// U+0023 NUMBER SIGN (#) |
69
|
|
|
|
|
|
|
//// |
70
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
71
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_number_sign(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
72
|
|
|
|
|
|
|
{ |
73
|
0
|
|
|
|
|
|
token->length = 1; |
74
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
75
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
return css_size; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
39
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_number_sign_name_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
82
|
|
|
|
|
|
|
{ |
83
|
39
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_HASH; |
84
|
39
|
50
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
85
|
|
|
|
|
|
|
|
86
|
39
|
|
|
|
|
|
return css_size; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_number_sign_name_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
90
|
|
|
|
|
|
|
{ |
91
|
0
|
|
|
|
|
|
size_t begin = token->begin; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
// and '#' character |
94
|
0
|
|
|
|
|
|
token->length = 1; |
95
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
96
|
|
|
|
|
|
|
|
97
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
// and '\' character |
100
|
0
|
|
|
|
|
|
token->length = 1; |
101
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
102
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
103
|
|
|
|
|
|
|
|
104
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
return css_size; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
110
|
|
|
|
|
|
|
//// U+0024 DOLLAR SIGN ($) |
111
|
|
|
|
|
|
|
//// |
112
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
113
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_dollar_sign(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
114
|
|
|
|
|
|
|
{ |
115
|
0
|
|
|
|
|
|
token->length = 1; |
116
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
117
|
|
|
|
|
|
|
|
118
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
return css_size; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
124
|
|
|
|
|
|
|
//// U+0027 APOSTROPHE (') |
125
|
|
|
|
|
|
|
//// |
126
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
127
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_apostrophe(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
128
|
|
|
|
|
|
|
{ |
129
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_BAD_STRING; |
130
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
131
|
|
|
|
|
|
|
|
132
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
return css_size; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_apostrophe_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
138
|
|
|
|
|
|
|
{ |
139
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
140
|
0
|
|
|
|
|
|
return css_size; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
144
|
|
|
|
|
|
|
//// U+0028 LEFT PARENTHESIS (() |
145
|
|
|
|
|
|
|
//// |
146
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
147
|
1
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_left_parenthesis(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
148
|
|
|
|
|
|
|
{ |
149
|
1
|
|
|
|
|
|
token->length = 1; |
150
|
1
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_LEFT_PARENTHESIS; |
151
|
|
|
|
|
|
|
|
152
|
1
|
50
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
153
|
1
|
|
|
|
|
|
return css_size; |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
157
|
|
|
|
|
|
|
//// U+0029 RIGHT PARENTHESIS ()) |
158
|
|
|
|
|
|
|
//// |
159
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
160
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_right_parenthesis(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
161
|
|
|
|
|
|
|
{ |
162
|
0
|
|
|
|
|
|
token->length = 1; |
163
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_RIGHT_PARENTHESIS; |
164
|
|
|
|
|
|
|
|
165
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
166
|
0
|
|
|
|
|
|
return css_size; |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
170
|
|
|
|
|
|
|
//// U+002A ASTERISK (*) |
171
|
|
|
|
|
|
|
//// |
172
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
173
|
1
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_asterisk(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
174
|
|
|
|
|
|
|
{ |
175
|
1
|
|
|
|
|
|
token->length = 1; |
176
|
1
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
177
|
|
|
|
|
|
|
|
178
|
1
|
50
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
179
|
1
|
|
|
|
|
|
return css_size; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
183
|
|
|
|
|
|
|
//// U+002B PLUS SIGN (+) |
184
|
|
|
|
|
|
|
//// |
185
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
186
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_plus_sign(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
187
|
|
|
|
|
|
|
{ |
188
|
0
|
|
|
|
|
|
token->length = 1; |
189
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
190
|
|
|
|
|
|
|
|
191
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
192
|
0
|
|
|
|
|
|
return css_size; |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_plus_sign_full_stop(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
196
|
|
|
|
|
|
|
{ |
197
|
0
|
|
|
|
|
|
size_t begin = token->begin; |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
// '+' character |
200
|
0
|
|
|
|
|
|
token->length = 1; |
201
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
202
|
|
|
|
|
|
|
|
203
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
// and '.' character |
206
|
0
|
|
|
|
|
|
token->length = 1; |
207
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
208
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
209
|
|
|
|
|
|
|
|
210
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
211
|
|
|
|
|
|
|
|
212
|
0
|
|
|
|
|
|
return css_size; |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
216
|
|
|
|
|
|
|
//// U+002C COMMA (,) |
217
|
|
|
|
|
|
|
//// |
218
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
219
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_comma(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
220
|
|
|
|
|
|
|
{ |
221
|
0
|
|
|
|
|
|
token->length = 1; |
222
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_COMMA; |
223
|
|
|
|
|
|
|
|
224
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
225
|
0
|
|
|
|
|
|
return css_size; |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
229
|
|
|
|
|
|
|
//// U+002D HYPHEN-MINUS (-) |
230
|
|
|
|
|
|
|
//// |
231
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
232
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_hyphen_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
233
|
|
|
|
|
|
|
{ |
234
|
0
|
|
|
|
|
|
token->length = 1; |
235
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
236
|
|
|
|
|
|
|
|
237
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
238
|
0
|
|
|
|
|
|
return css_size; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_hyphen_minus_full_stop(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
242
|
|
|
|
|
|
|
{ |
243
|
0
|
|
|
|
|
|
size_t begin = token->begin; |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
// '-' character |
246
|
0
|
|
|
|
|
|
token->length = 1; |
247
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
248
|
|
|
|
|
|
|
|
249
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
// and '.' character |
252
|
0
|
|
|
|
|
|
token->length = 1; |
253
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
254
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
255
|
|
|
|
|
|
|
|
256
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
257
|
|
|
|
|
|
|
|
258
|
0
|
|
|
|
|
|
return css_size; |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
|
261
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_hyphen_minus_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
262
|
|
|
|
|
|
|
{ |
263
|
0
|
|
|
|
|
|
size_t begin = token->begin; |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
// '-' character |
266
|
0
|
|
|
|
|
|
token->length = 1; |
267
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
268
|
|
|
|
|
|
|
|
269
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
// and '-' character |
272
|
0
|
|
|
|
|
|
token->length = 1; |
273
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
274
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
275
|
|
|
|
|
|
|
|
276
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
277
|
|
|
|
|
|
|
|
278
|
0
|
|
|
|
|
|
return css_size; |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
|
281
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_hyphen_minus_minus_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
282
|
|
|
|
|
|
|
{ |
283
|
0
|
|
|
|
|
|
size_t begin = token->begin; |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
// '-' character |
286
|
0
|
|
|
|
|
|
token->length = 1; |
287
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
288
|
|
|
|
|
|
|
|
289
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
// and '-' character |
292
|
0
|
|
|
|
|
|
token->length = 1; |
293
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
294
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
295
|
|
|
|
|
|
|
|
296
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
// and '\' character |
299
|
0
|
|
|
|
|
|
token->length = 1; |
300
|
0
|
|
|
|
|
|
token->begin = begin + 2; |
301
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
302
|
|
|
|
|
|
|
|
303
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
304
|
|
|
|
|
|
|
|
305
|
0
|
|
|
|
|
|
return css_size; |
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_hyphen_minus_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
309
|
|
|
|
|
|
|
{ |
310
|
0
|
|
|
|
|
|
size_t begin = token->begin; |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
// '-' character |
313
|
0
|
|
|
|
|
|
token->length = 1; |
314
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
315
|
|
|
|
|
|
|
|
316
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
// and '\' character |
319
|
0
|
|
|
|
|
|
token->length = 1; |
320
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
321
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
322
|
|
|
|
|
|
|
|
323
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
324
|
|
|
|
|
|
|
|
325
|
0
|
|
|
|
|
|
return css_size; |
326
|
|
|
|
|
|
|
} |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
329
|
|
|
|
|
|
|
//// U+002E FULL STOP (.) |
330
|
|
|
|
|
|
|
//// |
331
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
332
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_full_stop(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
333
|
|
|
|
|
|
|
{ |
334
|
0
|
|
|
|
|
|
token->length = 1; |
335
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
336
|
|
|
|
|
|
|
|
337
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
338
|
0
|
|
|
|
|
|
return css_size; |
339
|
|
|
|
|
|
|
} |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
342
|
|
|
|
|
|
|
//// U+002F SOLIDUS (/) |
343
|
|
|
|
|
|
|
//// |
344
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
345
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_solidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
346
|
|
|
|
|
|
|
{ |
347
|
0
|
|
|
|
|
|
token->length = 1; |
348
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
349
|
|
|
|
|
|
|
|
350
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
351
|
0
|
|
|
|
|
|
return css_size; |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
|
354
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_solidus_comment_end(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
355
|
|
|
|
|
|
|
{ |
356
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
357
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_COMMENT; |
358
|
|
|
|
|
|
|
|
359
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
360
|
0
|
|
|
|
|
|
return css_size; |
361
|
|
|
|
|
|
|
} |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
364
|
|
|
|
|
|
|
//// U+003A COLON (:) |
365
|
|
|
|
|
|
|
//// |
366
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
367
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_colon(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
368
|
|
|
|
|
|
|
{ |
369
|
0
|
|
|
|
|
|
token->length = 1; |
370
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_COLON; |
371
|
|
|
|
|
|
|
|
372
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
373
|
0
|
|
|
|
|
|
return css_size; |
374
|
|
|
|
|
|
|
} |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
377
|
|
|
|
|
|
|
//// U+003B SEMICOLON (;) |
378
|
|
|
|
|
|
|
//// |
379
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
380
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_semicolon(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
381
|
|
|
|
|
|
|
{ |
382
|
0
|
|
|
|
|
|
token->length = 1; |
383
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_SEMICOLON; |
384
|
|
|
|
|
|
|
|
385
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
386
|
0
|
|
|
|
|
|
return css_size; |
387
|
|
|
|
|
|
|
} |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
390
|
|
|
|
|
|
|
//// U+003C LESS-THAN SIGN (<) |
391
|
|
|
|
|
|
|
//// |
392
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
393
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_less_than_sign(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
394
|
|
|
|
|
|
|
{ |
395
|
0
|
|
|
|
|
|
token->length = 1; |
396
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
397
|
|
|
|
|
|
|
|
398
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
399
|
0
|
|
|
|
|
|
return css_size; |
400
|
|
|
|
|
|
|
} |
401
|
|
|
|
|
|
|
|
402
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_less_than_sign_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
403
|
|
|
|
|
|
|
{ |
404
|
0
|
|
|
|
|
|
size_t begin = token->begin; |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
// '<' character |
407
|
0
|
|
|
|
|
|
token->length = 1; |
408
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
409
|
|
|
|
|
|
|
|
410
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
// and '-' character |
413
|
0
|
|
|
|
|
|
token->length = 1; |
414
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
415
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
416
|
|
|
|
|
|
|
|
417
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
418
|
|
|
|
|
|
|
|
419
|
0
|
|
|
|
|
|
return css_size; |
420
|
|
|
|
|
|
|
} |
421
|
|
|
|
|
|
|
|
422
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_less_than_sign_minus_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
423
|
|
|
|
|
|
|
{ |
424
|
0
|
|
|
|
|
|
size_t begin = token->begin; |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
// '<' character |
427
|
0
|
|
|
|
|
|
token->length = 1; |
428
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
429
|
|
|
|
|
|
|
|
430
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
// and '-' character |
433
|
0
|
|
|
|
|
|
token->length = 1; |
434
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
435
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
436
|
|
|
|
|
|
|
|
437
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
// and '-' character |
440
|
0
|
|
|
|
|
|
token->length = 1; |
441
|
0
|
|
|
|
|
|
token->begin = begin + 2; |
442
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
443
|
|
|
|
|
|
|
|
444
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
445
|
0
|
|
|
|
|
|
return css_size; |
446
|
|
|
|
|
|
|
} |
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
449
|
|
|
|
|
|
|
//// U+0040 COMMERCIAL AT (@) |
450
|
|
|
|
|
|
|
//// |
451
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
452
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_commercial_at(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
453
|
|
|
|
|
|
|
{ |
454
|
0
|
|
|
|
|
|
token->length = 1; |
455
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
456
|
|
|
|
|
|
|
|
457
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
458
|
0
|
|
|
|
|
|
return css_size; |
459
|
|
|
|
|
|
|
} |
460
|
|
|
|
|
|
|
|
461
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_commercial_at_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
462
|
|
|
|
|
|
|
{ |
463
|
0
|
|
|
|
|
|
size_t begin = token->begin; |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
// '@' character |
466
|
0
|
|
|
|
|
|
token->length = 1; |
467
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
468
|
|
|
|
|
|
|
|
469
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
// and '-' character |
472
|
0
|
|
|
|
|
|
token->length = 1; |
473
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
474
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
475
|
|
|
|
|
|
|
|
476
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
477
|
0
|
|
|
|
|
|
return css_size; |
478
|
|
|
|
|
|
|
} |
479
|
|
|
|
|
|
|
|
480
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_commercial_at_minus_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
481
|
|
|
|
|
|
|
{ |
482
|
0
|
|
|
|
|
|
size_t begin = token->begin; |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
// '@' character |
485
|
0
|
|
|
|
|
|
token->length = 1; |
486
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
487
|
|
|
|
|
|
|
|
488
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
// and '-' character |
491
|
0
|
|
|
|
|
|
token->length = 1; |
492
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
493
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
494
|
|
|
|
|
|
|
|
495
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
// and '\' character |
498
|
0
|
|
|
|
|
|
token->length = 1; |
499
|
0
|
|
|
|
|
|
token->begin = begin + 2; |
500
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
501
|
|
|
|
|
|
|
|
502
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
503
|
0
|
|
|
|
|
|
return css_size; |
504
|
|
|
|
|
|
|
} |
505
|
|
|
|
|
|
|
|
506
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_commercial_at_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
507
|
|
|
|
|
|
|
{ |
508
|
0
|
|
|
|
|
|
size_t begin = token->begin; |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
// '@' character |
511
|
0
|
|
|
|
|
|
token->length = 1; |
512
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
513
|
|
|
|
|
|
|
|
514
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
// and '\' character |
517
|
0
|
|
|
|
|
|
token->length = 1; |
518
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
519
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
520
|
|
|
|
|
|
|
|
521
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
522
|
0
|
|
|
|
|
|
return css_size; |
523
|
|
|
|
|
|
|
} |
524
|
|
|
|
|
|
|
|
525
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_commercial_at_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
526
|
|
|
|
|
|
|
{ |
527
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_AT_KEYWORD; |
528
|
|
|
|
|
|
|
|
529
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
530
|
0
|
|
|
|
|
|
return css_size; |
531
|
|
|
|
|
|
|
} |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
534
|
|
|
|
|
|
|
//// U+005B LEFT SQUARE BRACKET ([) |
535
|
|
|
|
|
|
|
//// |
536
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
537
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_left_square_bracket(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
538
|
|
|
|
|
|
|
{ |
539
|
0
|
|
|
|
|
|
token->length = 1; |
540
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_LEFT_SQUARE_BRACKET; |
541
|
|
|
|
|
|
|
|
542
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
543
|
0
|
|
|
|
|
|
return css_size; |
544
|
|
|
|
|
|
|
} |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
547
|
|
|
|
|
|
|
//// U+005C REVERSE SOLIDUS (\) |
548
|
|
|
|
|
|
|
//// |
549
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
550
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_reverse_solidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
551
|
|
|
|
|
|
|
{ |
552
|
0
|
|
|
|
|
|
token->length = 1; |
553
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
554
|
|
|
|
|
|
|
|
555
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
556
|
0
|
|
|
|
|
|
return css_size; |
557
|
|
|
|
|
|
|
} |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
560
|
|
|
|
|
|
|
//// U+005D RIGHT SQUARE BRACKET (]) |
561
|
|
|
|
|
|
|
//// |
562
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
563
|
9
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_right_square_bracket(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
564
|
|
|
|
|
|
|
{ |
565
|
9
|
|
|
|
|
|
token->length = 1; |
566
|
9
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_RIGHT_SQUARE_BRACKET; |
567
|
|
|
|
|
|
|
|
568
|
9
|
50
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
569
|
9
|
|
|
|
|
|
return css_size; |
570
|
|
|
|
|
|
|
} |
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
573
|
|
|
|
|
|
|
//// U+005E CIRCUMFLEX ACCENT (^) |
574
|
|
|
|
|
|
|
//// |
575
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
576
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_circumflex_accent(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
577
|
|
|
|
|
|
|
{ |
578
|
0
|
|
|
|
|
|
token->length = 1; |
579
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
580
|
|
|
|
|
|
|
|
581
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
582
|
0
|
|
|
|
|
|
return css_size; |
583
|
|
|
|
|
|
|
} |
584
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
586
|
|
|
|
|
|
|
//// U+007B LEFT CURLY BRACKET ({) |
587
|
|
|
|
|
|
|
//// |
588
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
589
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_left_curly_bracket(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
590
|
|
|
|
|
|
|
{ |
591
|
0
|
|
|
|
|
|
token->length = 1; |
592
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_LEFT_CURLY_BRACKET; |
593
|
|
|
|
|
|
|
|
594
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
595
|
0
|
|
|
|
|
|
return css_size; |
596
|
|
|
|
|
|
|
} |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
599
|
|
|
|
|
|
|
//// U+007D RIGHT CURLY BRACKET (}) |
600
|
|
|
|
|
|
|
//// |
601
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
602
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_right_curly_bracket(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
603
|
|
|
|
|
|
|
{ |
604
|
0
|
|
|
|
|
|
token->length = 1; |
605
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_RIGHT_CURLY_BRACKET; |
606
|
|
|
|
|
|
|
|
607
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
608
|
0
|
|
|
|
|
|
return css_size; |
609
|
|
|
|
|
|
|
} |
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
612
|
|
|
|
|
|
|
//// Digit |
613
|
|
|
|
|
|
|
//// |
614
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
615
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_digit(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
616
|
|
|
|
|
|
|
{ |
617
|
0
|
|
|
|
|
|
token->length = 1; |
618
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_NUMBER; |
619
|
|
|
|
|
|
|
|
620
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
621
|
0
|
|
|
|
|
|
return css_size; |
622
|
|
|
|
|
|
|
} |
623
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
625
|
|
|
|
|
|
|
//// U+0055 LATIN CAPITAL LETTER U (U) || U+0075 LATIN SMALL LETTER U (u) |
626
|
|
|
|
|
|
|
//// |
627
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
628
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_letter_u(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
629
|
|
|
|
|
|
|
{ |
630
|
0
|
|
|
|
|
|
token->length = 1; |
631
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_IDENT; |
632
|
|
|
|
|
|
|
|
633
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
634
|
0
|
|
|
|
|
|
return css_size; |
635
|
|
|
|
|
|
|
} |
636
|
|
|
|
|
|
|
|
637
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_letter_u_next(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
638
|
|
|
|
|
|
|
{ |
639
|
0
|
|
|
|
|
|
size_t begin = token->begin; |
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
// 'u' or 'U' character |
642
|
0
|
|
|
|
|
|
token->length = 1; |
643
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_IDENT; |
644
|
|
|
|
|
|
|
|
645
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
// and '+' character |
648
|
0
|
|
|
|
|
|
token->length = 1; |
649
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
650
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
651
|
|
|
|
|
|
|
|
652
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
653
|
0
|
|
|
|
|
|
return css_size; |
654
|
|
|
|
|
|
|
} |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
657
|
|
|
|
|
|
|
//// name-start code point |
658
|
|
|
|
|
|
|
//// |
659
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
660
|
8
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_name_start_code_point(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
661
|
|
|
|
|
|
|
{ |
662
|
8
|
|
|
|
|
|
token->length = 1; |
663
|
8
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_IDENT; |
664
|
|
|
|
|
|
|
|
665
|
8
|
50
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
666
|
8
|
|
|
|
|
|
return css_size; |
667
|
|
|
|
|
|
|
} |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
670
|
|
|
|
|
|
|
//// U+007C VERTICAL LINE (|) |
671
|
|
|
|
|
|
|
//// |
672
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
673
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_vertical_line(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
674
|
|
|
|
|
|
|
{ |
675
|
0
|
|
|
|
|
|
token->length = 1; |
676
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
677
|
|
|
|
|
|
|
|
678
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
679
|
0
|
|
|
|
|
|
return css_size; |
680
|
|
|
|
|
|
|
} |
681
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
683
|
|
|
|
|
|
|
//// U+007E TILDE (~) |
684
|
|
|
|
|
|
|
//// |
685
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
686
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_tilde(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
687
|
|
|
|
|
|
|
{ |
688
|
0
|
|
|
|
|
|
token->length = 1; |
689
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
690
|
|
|
|
|
|
|
|
691
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
692
|
0
|
|
|
|
|
|
return css_size; |
693
|
|
|
|
|
|
|
} |
694
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
696
|
|
|
|
|
|
|
//// anything else |
697
|
|
|
|
|
|
|
//// |
698
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
699
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_state_delim_single_code_point(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
700
|
|
|
|
|
|
|
{ |
701
|
0
|
|
|
|
|
|
token->length = css_offset - token->begin; |
702
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
703
|
|
|
|
|
|
|
|
704
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
705
|
0
|
|
|
|
|
|
return css_size; |
706
|
|
|
|
|
|
|
} |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
710
|
|
|
|
|
|
|
//// Global |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
713
|
|
|
|
|
|
|
//// Global back |
714
|
|
|
|
|
|
|
//// |
715
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
716
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
717
|
|
|
|
|
|
|
{ |
718
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
719
|
0
|
|
|
|
|
|
return css_size; |
720
|
|
|
|
|
|
|
} |
721
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
723
|
|
|
|
|
|
|
//// Consume a numeric |
724
|
|
|
|
|
|
|
//// |
725
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
726
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_numeric(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
727
|
|
|
|
|
|
|
{ |
728
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
729
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_NUMBER; |
730
|
|
|
|
|
|
|
|
731
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
732
|
0
|
|
|
|
|
|
return css_size; |
733
|
|
|
|
|
|
|
} |
734
|
|
|
|
|
|
|
|
735
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_numeric_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
736
|
|
|
|
|
|
|
{ |
737
|
|
|
|
|
|
|
// numbers |
738
|
0
|
|
|
|
|
|
token->length = ((entry->current_buffer->offset + css_offset) - token->begin) - 1; |
739
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_NUMBER; |
740
|
|
|
|
|
|
|
|
741
|
0
|
|
|
|
|
|
size_t begin = token->begin + token->length; |
742
|
|
|
|
|
|
|
|
743
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
744
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
// and '-' character |
746
|
0
|
|
|
|
|
|
token->length = 1; |
747
|
0
|
|
|
|
|
|
token->begin = begin; |
748
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
749
|
|
|
|
|
|
|
|
750
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
751
|
0
|
|
|
|
|
|
return css_size; |
752
|
|
|
|
|
|
|
} |
753
|
|
|
|
|
|
|
|
754
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_numeric_minus_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
755
|
|
|
|
|
|
|
{ |
756
|
|
|
|
|
|
|
// numbers |
757
|
0
|
|
|
|
|
|
token->length = ((entry->current_buffer->offset + css_offset) - token->begin) - 2; |
758
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_NUMBER; |
759
|
|
|
|
|
|
|
|
760
|
0
|
|
|
|
|
|
size_t begin = token->begin + token->length; |
761
|
|
|
|
|
|
|
|
762
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
// and '-' character |
765
|
0
|
|
|
|
|
|
token->length = 1; |
766
|
0
|
|
|
|
|
|
token->begin = begin; |
767
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
768
|
|
|
|
|
|
|
|
769
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
770
|
|
|
|
|
|
|
|
771
|
|
|
|
|
|
|
// and '\' character |
772
|
0
|
|
|
|
|
|
token->length = 1; |
773
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
774
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
775
|
|
|
|
|
|
|
|
776
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
777
|
0
|
|
|
|
|
|
return css_size; |
778
|
|
|
|
|
|
|
} |
779
|
|
|
|
|
|
|
|
780
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_numeric_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
781
|
|
|
|
|
|
|
{ |
782
|
|
|
|
|
|
|
// numbers |
783
|
0
|
|
|
|
|
|
token->length = ((entry->current_buffer->offset + css_offset) - token->begin) - 1; |
784
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_NUMBER; |
785
|
|
|
|
|
|
|
|
786
|
0
|
|
|
|
|
|
size_t begin = token->begin + token->length; |
787
|
|
|
|
|
|
|
|
788
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
789
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
// and '\' character |
791
|
0
|
|
|
|
|
|
token->length = 1; |
792
|
0
|
|
|
|
|
|
token->begin = begin; |
793
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
794
|
|
|
|
|
|
|
|
795
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
796
|
0
|
|
|
|
|
|
return css_size; |
797
|
|
|
|
|
|
|
} |
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
800
|
|
|
|
|
|
|
//// Consume a number |
801
|
|
|
|
|
|
|
//// |
802
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
803
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_number_digit(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
804
|
|
|
|
|
|
|
{ |
805
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
806
|
0
|
|
|
|
|
|
mycss_tokenizer_end_run_state_single(entry, entry->state_back, css, css_offset, css_size); |
807
|
|
|
|
|
|
|
|
808
|
0
|
|
|
|
|
|
return css_size; |
809
|
|
|
|
|
|
|
} |
810
|
|
|
|
|
|
|
|
811
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_number_dot(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
812
|
|
|
|
|
|
|
{ |
813
|
0
|
|
|
|
|
|
token->length = ((entry->current_buffer->offset + css_offset) - token->begin) - 1; |
814
|
0
|
|
|
|
|
|
size_t begin = token->begin + token->length; |
815
|
|
|
|
|
|
|
|
816
|
0
|
|
|
|
|
|
mycss_tokenizer_end_run_state_single(entry, entry->state_back, css, css_offset, css_size); |
817
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
// '.' character |
819
|
0
|
|
|
|
|
|
token->length = 1; |
820
|
0
|
|
|
|
|
|
token->begin = begin; |
821
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
822
|
|
|
|
|
|
|
|
823
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
824
|
0
|
|
|
|
|
|
return css_size; |
825
|
|
|
|
|
|
|
} |
826
|
|
|
|
|
|
|
|
827
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_number_decimal(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
828
|
|
|
|
|
|
|
{ |
829
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
830
|
0
|
|
|
|
|
|
mycss_tokenizer_end_run_state_single(entry, entry->state_back, css, css_offset, css_size); |
831
|
|
|
|
|
|
|
|
832
|
0
|
|
|
|
|
|
return css_size; |
833
|
|
|
|
|
|
|
} |
834
|
|
|
|
|
|
|
|
835
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_number_e(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
836
|
|
|
|
|
|
|
{ |
837
|
0
|
|
|
|
|
|
token->length = ((entry->current_buffer->offset + css_offset) - token->begin) - 1; |
838
|
0
|
|
|
|
|
|
size_t begin = token->begin + token->length; |
839
|
|
|
|
|
|
|
|
840
|
0
|
|
|
|
|
|
mycss_tokenizer_end_run_state_single(entry, entry->state_back, css, css_offset, css_size); |
841
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
// 'e' or 'E' character |
843
|
0
|
|
|
|
|
|
token->length = 1; |
844
|
0
|
|
|
|
|
|
token->begin = begin; |
845
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_IDENT; |
846
|
|
|
|
|
|
|
|
847
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
848
|
0
|
|
|
|
|
|
return css_size; |
849
|
|
|
|
|
|
|
} |
850
|
|
|
|
|
|
|
|
851
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_number_e_plus_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
852
|
|
|
|
|
|
|
{ |
853
|
0
|
|
|
|
|
|
token->length = ((entry->current_buffer->offset + css_offset) - token->begin) - 2; |
854
|
0
|
|
|
|
|
|
size_t begin = token->begin + token->length; |
855
|
|
|
|
|
|
|
|
856
|
0
|
|
|
|
|
|
mycss_tokenizer_end_run_state_single(entry, entry->state_back, css, css_offset, css_size); |
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
// 'e' or 'E' character |
859
|
0
|
|
|
|
|
|
token->length = 1; |
860
|
0
|
|
|
|
|
|
token->begin = begin; |
861
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_IDENT; |
862
|
|
|
|
|
|
|
|
863
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
864
|
|
|
|
|
|
|
|
865
|
|
|
|
|
|
|
// and '+' or '-' character |
866
|
0
|
|
|
|
|
|
token->length = 1; |
867
|
0
|
|
|
|
|
|
token->begin = begin + 1; |
868
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
869
|
|
|
|
|
|
|
|
870
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
871
|
0
|
|
|
|
|
|
return css_size; |
872
|
|
|
|
|
|
|
} |
873
|
|
|
|
|
|
|
|
874
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_number_e_decimal(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
875
|
|
|
|
|
|
|
{ |
876
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
877
|
0
|
|
|
|
|
|
mycss_tokenizer_end_run_state_single(entry, entry->state_back, css, css_offset, css_size); |
878
|
|
|
|
|
|
|
|
879
|
0
|
|
|
|
|
|
return css_size; |
880
|
|
|
|
|
|
|
} |
881
|
|
|
|
|
|
|
|
882
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
883
|
|
|
|
|
|
|
//// Consume a url token |
884
|
|
|
|
|
|
|
//// |
885
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
886
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_url(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
887
|
|
|
|
|
|
|
{ |
888
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
889
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_BAD_URL; |
890
|
|
|
|
|
|
|
|
891
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
892
|
0
|
|
|
|
|
|
return css_size; |
893
|
|
|
|
|
|
|
} |
894
|
|
|
|
|
|
|
|
895
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_url_string_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
896
|
|
|
|
|
|
|
{ |
897
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
898
|
|
|
|
|
|
|
|
899
|
0
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_BAD_STRING) |
900
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_BAD_URL; |
901
|
|
|
|
|
|
|
else |
902
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_URL; |
903
|
|
|
|
|
|
|
|
904
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
905
|
0
|
|
|
|
|
|
return css_size; |
906
|
|
|
|
|
|
|
} |
907
|
|
|
|
|
|
|
|
908
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_url_after(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
909
|
|
|
|
|
|
|
{ |
910
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
911
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_URL; |
912
|
|
|
|
|
|
|
|
913
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
914
|
0
|
|
|
|
|
|
return css_size; |
915
|
|
|
|
|
|
|
} |
916
|
|
|
|
|
|
|
|
917
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_url_after_whitespace(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
918
|
|
|
|
|
|
|
{ |
919
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
920
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_URL; |
921
|
|
|
|
|
|
|
|
922
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
923
|
0
|
|
|
|
|
|
return css_size; |
924
|
|
|
|
|
|
|
} |
925
|
|
|
|
|
|
|
|
926
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_url_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
927
|
|
|
|
|
|
|
{ |
928
|
0
|
|
|
|
|
|
token->length = ((entry->current_buffer->offset + css_offset) - token->begin) - 1; |
929
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_BAD_URL; |
930
|
|
|
|
|
|
|
|
931
|
0
|
|
|
|
|
|
size_t begin = token->begin + token->length; |
932
|
|
|
|
|
|
|
|
933
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
// '\' character |
936
|
0
|
|
|
|
|
|
token->length = 1; |
937
|
0
|
|
|
|
|
|
token->begin = begin; |
938
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
939
|
|
|
|
|
|
|
|
940
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
941
|
0
|
|
|
|
|
|
return css_size; |
942
|
|
|
|
|
|
|
} |
943
|
|
|
|
|
|
|
|
944
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_bad_url(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
945
|
|
|
|
|
|
|
{ |
946
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
947
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_BAD_URL; |
948
|
|
|
|
|
|
|
|
949
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
950
|
0
|
|
|
|
|
|
return css_size; |
951
|
|
|
|
|
|
|
} |
952
|
|
|
|
|
|
|
|
953
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
954
|
|
|
|
|
|
|
//// Consume a string token |
955
|
|
|
|
|
|
|
//// |
956
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
957
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_string_double_quoted(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
958
|
|
|
|
|
|
|
{ |
959
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
960
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_BAD_STRING; |
961
|
|
|
|
|
|
|
|
962
|
0
|
|
|
|
|
|
mycss_tokenizer_end_run_state_single(entry, entry->state_back, css, css_offset, css_size); |
963
|
|
|
|
|
|
|
|
964
|
0
|
|
|
|
|
|
return css_size; |
965
|
|
|
|
|
|
|
} |
966
|
|
|
|
|
|
|
|
967
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_string_double_quoted_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
968
|
|
|
|
|
|
|
{ |
969
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
970
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_BAD_STRING; |
971
|
|
|
|
|
|
|
|
972
|
0
|
|
|
|
|
|
mycss_tokenizer_end_run_state_single(entry, entry->state_back, css, css_offset, css_size); |
973
|
|
|
|
|
|
|
|
974
|
0
|
|
|
|
|
|
return css_size; |
975
|
|
|
|
|
|
|
} |
976
|
|
|
|
|
|
|
|
977
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_string_single_quoted(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
978
|
|
|
|
|
|
|
{ |
979
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
980
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_BAD_STRING; |
981
|
|
|
|
|
|
|
|
982
|
0
|
|
|
|
|
|
mycss_tokenizer_end_run_state_single(entry, entry->state_back, css, css_offset, css_size); |
983
|
|
|
|
|
|
|
|
984
|
0
|
|
|
|
|
|
return css_size; |
985
|
|
|
|
|
|
|
} |
986
|
|
|
|
|
|
|
|
987
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_string_single_quoted_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
988
|
|
|
|
|
|
|
{ |
989
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
990
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_BAD_STRING; |
991
|
|
|
|
|
|
|
|
992
|
0
|
|
|
|
|
|
mycss_tokenizer_end_run_state_single(entry, entry->state_back, css, css_offset, css_size); |
993
|
|
|
|
|
|
|
|
994
|
0
|
|
|
|
|
|
return css_size; |
995
|
|
|
|
|
|
|
} |
996
|
|
|
|
|
|
|
|
997
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
998
|
|
|
|
|
|
|
//// Consume an ident-like token |
999
|
|
|
|
|
|
|
//// |
1000
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
1001
|
70
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_ident(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
1002
|
|
|
|
|
|
|
{ |
1003
|
70
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_IDENT; |
1004
|
|
|
|
|
|
|
|
1005
|
70
|
50
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
1006
|
70
|
|
|
|
|
|
return css_size; |
1007
|
|
|
|
|
|
|
} |
1008
|
|
|
|
|
|
|
|
1009
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
1010
|
|
|
|
|
|
|
//// Consume a name |
1011
|
|
|
|
|
|
|
//// |
1012
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
1013
|
109
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_name(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
1014
|
|
|
|
|
|
|
{ |
1015
|
109
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
1016
|
|
|
|
|
|
|
|
1017
|
109
|
|
|
|
|
|
mycss_tokenizer_end_run_state_single(entry, entry->state_back, css, css_offset, css_size); |
1018
|
|
|
|
|
|
|
|
1019
|
109
|
|
|
|
|
|
return css_size; |
1020
|
|
|
|
|
|
|
} |
1021
|
|
|
|
|
|
|
|
1022
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_name_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
1023
|
|
|
|
|
|
|
{ |
1024
|
0
|
|
|
|
|
|
token->length = ((entry->current_buffer->offset + css_offset) - token->begin) - 1; |
1025
|
0
|
|
|
|
|
|
size_t begin = token->begin + token->length; |
1026
|
|
|
|
|
|
|
|
1027
|
0
|
|
|
|
|
|
mycss_tokenizer_end_run_state_single(entry, entry->state_back, css, css_offset, css_size); |
1028
|
|
|
|
|
|
|
|
1029
|
|
|
|
|
|
|
// '\' character |
1030
|
0
|
|
|
|
|
|
token->length = 1; |
1031
|
0
|
|
|
|
|
|
token->begin = begin; |
1032
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
1033
|
|
|
|
|
|
|
|
1034
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
1035
|
0
|
|
|
|
|
|
return css_size; |
1036
|
|
|
|
|
|
|
} |
1037
|
|
|
|
|
|
|
|
1038
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
1039
|
|
|
|
|
|
|
//// Consume a unicode-range token |
1040
|
|
|
|
|
|
|
//// |
1041
|
|
|
|
|
|
|
///////////////////////////////////////////////////////// |
1042
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_unicode_range_before(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
1043
|
|
|
|
|
|
|
{ |
1044
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
1045
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_UNICODE_RANGE; |
1046
|
|
|
|
|
|
|
|
1047
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
1048
|
0
|
|
|
|
|
|
return css_size; |
1049
|
|
|
|
|
|
|
} |
1050
|
|
|
|
|
|
|
|
1051
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_unicode_range(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
1052
|
|
|
|
|
|
|
{ |
1053
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
1054
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_UNICODE_RANGE; |
1055
|
|
|
|
|
|
|
|
1056
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
1057
|
0
|
|
|
|
|
|
return css_size; |
1058
|
|
|
|
|
|
|
} |
1059
|
|
|
|
|
|
|
|
1060
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_unicode_range_question(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
1061
|
|
|
|
|
|
|
{ |
1062
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
1063
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_UNICODE_RANGE; |
1064
|
|
|
|
|
|
|
|
1065
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
1066
|
0
|
|
|
|
|
|
return css_size; |
1067
|
|
|
|
|
|
|
} |
1068
|
|
|
|
|
|
|
|
1069
|
0
|
|
|
|
|
|
size_t mycss_tokenizer_end_global_state_unicode_range_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size) |
1070
|
|
|
|
|
|
|
{ |
1071
|
0
|
0
|
|
|
|
|
if(entry->help_counter == 0) { |
1072
|
0
|
|
|
|
|
|
token->length = ((entry->current_buffer->offset + css_offset) - token->begin) - 1; |
1073
|
|
|
|
|
|
|
} |
1074
|
|
|
|
|
|
|
else { |
1075
|
0
|
|
|
|
|
|
token->length = (entry->current_buffer->offset + css_offset) - token->begin; |
1076
|
|
|
|
|
|
|
} |
1077
|
|
|
|
|
|
|
|
1078
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_UNICODE_RANGE; |
1079
|
0
|
|
|
|
|
|
size_t begin = token->begin + token->length; |
1080
|
|
|
|
|
|
|
|
1081
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
1082
|
|
|
|
|
|
|
|
1083
|
|
|
|
|
|
|
// character |
1084
|
0
|
|
|
|
|
|
token->length = 1; |
1085
|
0
|
|
|
|
|
|
token->begin = begin; |
1086
|
0
|
|
|
|
|
|
token->type = MyCSS_TOKEN_TYPE_DELIM; |
1087
|
|
|
|
|
|
|
|
1088
|
0
|
0
|
|
|
|
|
MyCSS_TOKEN_READY_CALLBACK_FUNCTION(entry, token); |
1089
|
0
|
|
|
|
|
|
return css_offset; |
1090
|
|
|
|
|
|
|
} |
1091
|
|
|
|
|
|
|
|
1092
|
|
|
|
|
|
|
|
1093
|
|
|
|
|
|
|
|