-
Notifications
You must be signed in to change notification settings - Fork 17
/
svg-path.lex.php
336 lines (306 loc) · 8.71 KB
/
svg-path.lex.php
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<?php # vim:ft=php
include 'jlex.php';
include 'svg-path.php';
class A2S_Yylex extends A2S_JLexBase {
const YY_BUFFER_SIZE = 512;
const YY_F = -1;
const YY_NO_STATE = -1;
const YY_NOT_ACCEPT = 0;
const YY_START = 1;
const YY_END = 2;
const YY_NO_ANCHOR = 4;
const YY_BOL = 128;
var $YY_EOF = 129;
/* w/e */
function __construct($stream) {
parent::__construct($stream);
$this->yy_lexical_state = self::YYINITIAL;
}
const YYINITIAL = 0;
static $yy_state_dtrans = array(
0
);
static $yy_acpt = array(
/* 0 */ self::YY_NOT_ACCEPT,
/* 1 */ self::YY_NO_ANCHOR,
/* 2 */ self::YY_NO_ANCHOR,
/* 3 */ self::YY_NO_ANCHOR,
/* 4 */ self::YY_NO_ANCHOR,
/* 5 */ self::YY_NO_ANCHOR,
/* 6 */ self::YY_NO_ANCHOR,
/* 7 */ self::YY_NO_ANCHOR,
/* 8 */ self::YY_NO_ANCHOR,
/* 9 */ self::YY_NO_ANCHOR,
/* 10 */ self::YY_NO_ANCHOR,
/* 11 */ self::YY_NO_ANCHOR,
/* 12 */ self::YY_NO_ANCHOR,
/* 13 */ self::YY_NO_ANCHOR,
/* 14 */ self::YY_NO_ANCHOR,
/* 15 */ self::YY_NO_ANCHOR,
/* 16 */ self::YY_NO_ANCHOR,
/* 17 */ self::YY_NO_ANCHOR,
/* 18 */ self::YY_NO_ANCHOR,
/* 19 */ self::YY_NO_ANCHOR,
/* 20 */ self::YY_NO_ANCHOR,
/* 21 */ self::YY_NOT_ACCEPT,
/* 22 */ self::YY_NO_ANCHOR,
/* 23 */ self::YY_NO_ANCHOR,
/* 24 */ self::YY_NO_ANCHOR,
/* 25 */ self::YY_NO_ANCHOR,
/* 26 */ self::YY_NO_ANCHOR,
/* 27 */ self::YY_NO_ANCHOR,
/* 28 */ self::YY_NOT_ACCEPT,
/* 29 */ self::YY_NO_ANCHOR,
/* 30 */ self::YY_NOT_ACCEPT,
/* 31 */ self::YY_NO_ANCHOR,
/* 32 */ self::YY_NOT_ACCEPT,
/* 33 */ self::YY_NOT_ACCEPT,
/* 34 */ self::YY_NOT_ACCEPT,
/* 35 */ self::YY_NOT_ACCEPT,
/* 36 */ self::YY_NOT_ACCEPT,
/* 37 */ self::YY_NOT_ACCEPT,
/* 38 */ self::YY_NOT_ACCEPT
);
static $yy_cmap = array(
19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18, 19, 18, 18, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 2, 18, 5, 6, 19, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 19, 19,
19, 19, 19, 19, 19, 17, 19, 14, 19, 7, 19, 19, 11, 19, 19, 19, 10, 8, 19, 19,
19, 13, 19, 15, 16, 19, 12, 19, 19, 19, 9, 19, 19, 19, 19, 19, 19, 17, 19, 14,
19, 7, 19, 19, 11, 19, 19, 19, 10, 8, 19, 19, 19, 13, 19, 15, 16, 19, 12, 19,
19, 19, 9, 19, 1, 19, 19, 19, 0, 0,);
static $yy_rmap = array(
0, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 5, 6, 7,
8, 9, 3, 10, 11, 12, 13, 14, 15, 9, 16, 1, 17, 11, 18, 19, 12, 13, 14,);
static $yy_nxt = array(
array(
1, 2, 3, 22, 4, 23, 29, 31, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 31,
),
array(
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 4, 4, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 4, 4, -1, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 18, 18, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 17, 17, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 18, 18, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 20, 20, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 20, 20, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 18, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 17, 17, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 24, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 25, 25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 26, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 27, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, -1, 20, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, 33, 24, 24, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, 36, 25, 25, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, 37, 26, 26, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
array(
-1, -1, 38, 27, 27, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
),
);
public function /*Yytoken*/ nextToken ()
{
$yy_anchor = self::YY_NO_ANCHOR;
$yy_state = self::$yy_state_dtrans[$this->yy_lexical_state];
$yy_next_state = self::YY_NO_STATE;
$yy_last_accept_state = self::YY_NO_STATE;
$yy_initial = true;
$this->yy_mark_start();
$yy_this_accept = self::$yy_acpt[$yy_state];
if (self::YY_NOT_ACCEPT != $yy_this_accept) {
$yy_last_accept_state = $yy_state;
$this->yy_mark_end();
}
while (true) {
if ($yy_initial && $this->yy_at_bol) $yy_lookahead = self::YY_BOL;
else $yy_lookahead = $this->yy_advance();
$yy_next_state = self::$yy_nxt[self::$yy_rmap[$yy_state]][self::$yy_cmap[$yy_lookahead]];
if ($this->YY_EOF == $yy_lookahead && true == $yy_initial) {
return null;
}
if (self::YY_F != $yy_next_state) {
$yy_state = $yy_next_state;
$yy_initial = false;
$yy_this_accept = self::$yy_acpt[$yy_state];
if (self::YY_NOT_ACCEPT != $yy_this_accept) {
$yy_last_accept_state = $yy_state;
$this->yy_mark_end();
}
}
else {
if (self::YY_NO_STATE == $yy_last_accept_state) {
throw new Exception("Lexical Error: Unmatched Input.");
}
else {
$yy_anchor = self::$yy_acpt[$yy_last_accept_state];
if (0 != (self::YY_END & $yy_anchor)) {
$this->yy_move_end();
}
$this->yy_to_mark();
switch ($yy_last_accept_state) {
case 1:
case -2:
break;
case 2:
{ return $this->createToken(A2S_SVGPathParser::TK_FLAG); }
case -3:
break;
case 3:
{ }
case -4:
break;
case 4:
{ return $this->createToken(A2S_SVGPathParser::TK_POSNUM); }
case -5:
break;
case 5:
{ return $this->createToken(A2S_SVGPathParser::TK_MCMD); }
case -6:
break;
case 6:
{ return $this->createToken(A2S_SVGPathParser::TK_ZCMD); }
case -7:
break;
case 7:
{ return $this->createToken(A2S_SVGPathParser::TK_LCMD); }
case -8:
break;
case 8:
{ return $this->createToken(A2S_SVGPathParser::TK_HCMD); }
case -9:
break;
case 9:
{ return $this->createToken(A2S_SVGPathParser::TK_VCMD); }
case -10:
break;
case 10:
{ return $this->createToken(A2S_SVGPathParser::TK_QCMD); }
case -11:
break;
case 11:
{ return $this->createToken(A2S_SVGPathParser::TK_CCMD); }
case -12:
break;
case 12:
{ return $this->createToken(A2S_SVGPathParser::TK_SCMD); }
case -13:
break;
case 13:
{ return $this->createToken(A2S_SVGPathParser::TK_TCMD); }
case -14:
break;
case 14:
{ return $this->createToken(A2S_SVGPathParser::TK_ACMD); }
case -15:
break;
case 15:
{ }
case -16:
break;
case 16:
{ return $this->createToken(A2S_SVGPathParser::TK_POSNUM); }
case -17:
break;
case 17:
{ return $this->createToken(A2S_SVGPathParser::TK_POSNUM); }
case -18:
break;
case 18:
{ return $this->createToken(A2S_SVGPathParser::TK_POSNUM); }
case -19:
break;
case 19:
{ return $this->createToken(A2S_SVGPathParser::TK_POSNUM); }
case -20:
break;
case 20:
{ return $this->createToken(A2S_SVGPathParser::TK_POSNUM); }
case -21:
break;
case 22:
{ return $this->createToken(A2S_SVGPathParser::TK_FLAG); }
case -22:
break;
case 23:
{ }
case -23:
break;
case 24:
{ return $this->createToken(A2S_SVGPathParser::TK_POSNUM); }
case -24:
break;
case 25:
{ return $this->createToken(A2S_SVGPathParser::TK_POSNUM); }
case -25:
break;
case 26:
{ return $this->createToken(A2S_SVGPathParser::TK_POSNUM); }
case -26:
break;
case 27:
{ return $this->createToken(A2S_SVGPathParser::TK_POSNUM); }
case -27:
break;
case 29:
{ }
case -28:
break;
case 31:
{ }
case -29:
break;
default:
$this->yy_error('INTERNAL',false);
case -1:
}
$yy_initial = true;
$yy_state = self::$yy_state_dtrans[$this->yy_lexical_state];
$yy_next_state = self::YY_NO_STATE;
$yy_last_accept_state = self::YY_NO_STATE;
$this->yy_mark_start();
$yy_this_accept = self::$yy_acpt[$yy_state];
if (self::YY_NOT_ACCEPT != $yy_this_accept) {
$yy_last_accept_state = $yy_state;
$this->yy_mark_end();
}
}
}
}
}
}