hpricot 0.6-jruby → 0.6.161-jruby

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1300 @@
1
+ // line 1 "ext/hpricot_scan/hpricot_scan.java.rl"
2
+
3
+ import java.io.IOException;
4
+
5
+ import org.jruby.Ruby;
6
+ import org.jruby.RubyClass;
7
+ import org.jruby.RubyHash;
8
+ import org.jruby.RubyModule;
9
+ import org.jruby.RubyNumeric;
10
+ import org.jruby.RubyObjectAdapter;
11
+ import org.jruby.RubyString;
12
+ import org.jruby.javasupport.JavaEmbedUtils;
13
+ import org.jruby.runtime.Block;
14
+ import org.jruby.runtime.CallbackFactory;
15
+ import org.jruby.runtime.builtin.IRubyObject;
16
+ import org.jruby.exceptions.RaiseException;
17
+ import org.jruby.runtime.load.BasicLibraryService;
18
+
19
+ public class HpricotScanService implements BasicLibraryService {
20
+ public static String NO_WAY_SERIOUSLY="*** This should not happen, please send a bug report with the HTML you're parsing to why@whytheluckystiff.net. So sorry!";
21
+ private static RubyObjectAdapter rubyApi;
22
+
23
+ public void ELE(IRubyObject N) {
24
+ if (tokend > tokstart || text) {
25
+ IRubyObject raw_string = runtime.getNil();
26
+ ele_open = false; text = false;
27
+ if (tokstart != -1 && N != cdata && N != sym_text && N != procins && N != comment) {
28
+ raw_string = runtime.newString(new String(buf,tokstart,tokend-tokstart));
29
+ }
30
+ rb_yield_tokens(N, tag[0], attr, raw_string, taint);
31
+ }
32
+ }
33
+
34
+ public void SET(IRubyObject[] N, int E) {
35
+ int mark = 0;
36
+ if(N == tag) {
37
+ if(mark_tag == -1 || E == mark_tag) {
38
+ tag[0] = runtime.newString("");
39
+ } else if(E > mark_tag) {
40
+ tag[0] = runtime.newString(new String(buf,mark_tag, E-mark_tag));
41
+ }
42
+ } else if(N == akey) {
43
+ if(mark_akey == -1 || E == mark_akey) {
44
+ akey[0] = runtime.newString("");
45
+ } else if(E > mark_akey) {
46
+ akey[0] = runtime.newString(new String(buf,mark_akey, E-mark_akey));
47
+ }
48
+ } else if(N == aval) {
49
+ if(mark_aval == -1 || E == mark_aval) {
50
+ aval[0] = runtime.newString("");
51
+ } else if(E > mark_aval) {
52
+ aval[0] = runtime.newString(new String(buf,mark_aval, E-mark_aval));
53
+ }
54
+ }
55
+ }
56
+
57
+ public void CAT(IRubyObject[] N, int E) {
58
+ if(N[0].isNil()) {
59
+ SET(N,E);
60
+ } else {
61
+ int mark = 0;
62
+ if(N == tag) {
63
+ mark = mark_tag;
64
+ } else if(N == akey) {
65
+ mark = mark_akey;
66
+ } else if(N == aval) {
67
+ mark = mark_aval;
68
+ }
69
+ ((RubyString)(N[0])).append(runtime.newString(new String(buf, mark, E-mark)));
70
+ }
71
+ }
72
+
73
+ public void SLIDE(Object N) {
74
+ int mark = 0;
75
+ if(N == tag) {
76
+ mark = mark_tag;
77
+ } else if(N == akey) {
78
+ mark = mark_akey;
79
+ } else if(N == aval) {
80
+ mark = mark_aval;
81
+ }
82
+ if(mark > tokstart) {
83
+ if(N == tag) {
84
+ mark_tag -= tokstart;
85
+ } else if(N == akey) {
86
+ mark_akey -= tokstart;
87
+ } else if(N == aval) {
88
+ mark_aval -= tokstart;
89
+ }
90
+ }
91
+ }
92
+
93
+ public void ATTR(IRubyObject K, IRubyObject V) {
94
+ if(!K.isNil()) {
95
+ if(attr.isNil()) {
96
+ attr = RubyHash.newHash(runtime);
97
+ }
98
+ ((RubyHash)attr).aset(K,V);
99
+ }
100
+ }
101
+
102
+ public void ATTR(IRubyObject[] K, IRubyObject V) {
103
+ ATTR(K[0],V);
104
+ }
105
+
106
+ public void ATTR(IRubyObject K, IRubyObject[] V) {
107
+ ATTR(K,V[0]);
108
+ }
109
+
110
+ public void ATTR(IRubyObject[] K, IRubyObject[] V) {
111
+ ATTR(K[0],V[0]);
112
+ }
113
+
114
+ public void TEXT_PASS() {
115
+ if(!text) {
116
+ if(ele_open) {
117
+ ele_open = false;
118
+ if(tokstart > -1) {
119
+ mark_tag = tokstart;
120
+ }
121
+ } else {
122
+ mark_tag = p;
123
+ }
124
+ attr = runtime.getNil();
125
+ tag[0] = runtime.getNil();
126
+ text = true;
127
+ }
128
+ }
129
+
130
+ public void EBLK(IRubyObject N, int T) {
131
+ CAT(tag, p - T + 1);
132
+ ELE(N);
133
+ }
134
+
135
+
136
+ public void rb_raise(RubyClass error, String message) {
137
+ throw new RaiseException(runtime, error, message, true);
138
+ }
139
+
140
+ public IRubyObject rb_str_new2(String s) {
141
+ return runtime.newString(s);
142
+ }
143
+
144
+ // line 188 "ext/hpricot_scan/hpricot_scan.java.rl"
145
+
146
+
147
+
148
+ // line 149 "ext/hpricot_scan/hpricot_scan.java.java"
149
+ private static byte[] init__hpricot_scan_actions_0()
150
+ {
151
+ return new byte [] {
152
+ 0, 1, 1, 1, 2, 1, 4, 1, 5, 1, 6, 1,
153
+ 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 1,
154
+ 14, 1, 16, 1, 20, 1, 21, 1, 22, 1, 24, 1,
155
+ 25, 1, 26, 1, 28, 1, 29, 1, 30, 1, 32, 1,
156
+ 33, 1, 38, 1, 39, 1, 40, 1, 41, 1, 42, 1,
157
+ 43, 1, 44, 1, 45, 1, 46, 1, 47, 1, 48, 1,
158
+ 49, 1, 50, 1, 51, 2, 2, 5, 2, 2, 6, 2,
159
+ 2, 11, 2, 2, 12, 2, 2, 14, 2, 4, 39, 2,
160
+ 4, 40, 2, 4, 41, 2, 5, 2, 2, 6, 14, 2,
161
+ 7, 6, 2, 7, 14, 2, 11, 12, 2, 13, 3, 2,
162
+ 14, 6, 2, 14, 40, 2, 15, 24, 2, 15, 28, 2,
163
+ 15, 32, 2, 15, 45, 2, 17, 23, 2, 18, 27, 2,
164
+ 19, 31, 2, 22, 34, 2, 22, 36, 3, 2, 6, 14,
165
+ 3, 2, 14, 6, 3, 6, 7, 14, 3, 6, 14, 40,
166
+ 3, 7, 14, 40, 3, 11, 2, 12, 3, 14, 6, 40,
167
+ 3, 14, 13, 3, 3, 22, 0, 37, 3, 22, 2, 34,
168
+ 3, 22, 14, 35, 4, 2, 14, 13, 3, 4, 6, 7,
169
+ 14, 40, 4, 22, 2, 14, 35, 4, 22, 6, 14, 35,
170
+ 4, 22, 7, 14, 35, 4, 22, 14, 6, 35, 5, 22,
171
+ 2, 6, 14, 35, 5, 22, 2, 14, 6, 35, 5, 22,
172
+ 6, 7, 14, 35
173
+ };
174
+ }
175
+
176
+ private static final byte _hpricot_scan_actions[] = init__hpricot_scan_actions_0();
177
+
178
+
179
+ private static short[] init__hpricot_scan_key_offsets_0()
180
+ {
181
+ return new short [] {
182
+ 0, 3, 4, 5, 6, 7, 8, 9, 10, 13, 22, 37,
183
+ 44, 45, 46, 47, 48, 49, 52, 57, 69, 81, 86, 93,
184
+ 94, 95, 100, 101, 105, 106, 107, 121, 135, 152, 169, 186,
185
+ 203, 210, 212, 214, 220, 222, 227, 232, 238, 240, 245, 251,
186
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
187
+ 282, 296, 300, 313, 326, 340, 354, 355, 366, 375, 388, 405,
188
+ 423, 441, 450, 461, 480, 499, 510, 521, 536, 538, 540, 556,
189
+ 572, 575, 587, 599, 619, 639, 658, 677, 697, 717, 728, 739,
190
+ 751, 763, 775, 791, 794, 809, 811, 813, 829, 845, 848, 860,
191
+ 871, 890, 910, 930, 941, 952, 964, 984, 1004, 1016, 1036, 1057,
192
+ 1074, 1091, 1095, 1098, 1110, 1122, 1142, 1162, 1182, 1194, 1206, 1226,
193
+ 1242, 1258, 1270, 1291, 1310, 1313, 1328, 1340, 1355, 1358, 1369, 1371,
194
+ 1373, 1384, 1391, 1404, 1418, 1432, 1445, 1446, 1447, 1448, 1449, 1450,
195
+ 1451, 1455, 1460, 1469, 1479, 1484, 1491, 1492, 1493, 1494, 1495, 1496,
196
+ 1497, 1498, 1499, 1503, 1508, 1512, 1522, 1527, 1533, 1534, 1535, 1536,
197
+ 1537, 1538, 1539, 1540, 1541, 1542, 1546, 1551, 1553, 1554, 1555, 1560,
198
+ 1561, 1562, 1564, 1565, 1566, 1567, 1568, 1572, 1582, 1591, 1601, 1602,
199
+ 1603, 1605, 1614, 1615, 1616, 1617, 1619, 1621, 1624, 1627, 1631, 1633,
200
+ 1634, 1636, 1637, 1640
201
+ };
202
+ }
203
+
204
+ private static final short _hpricot_scan_key_offsets[] = init__hpricot_scan_key_offsets_0();
205
+
206
+
207
+ private static char[] init__hpricot_scan_trans_keys_0()
208
+ {
209
+ return new char [] {
210
+ 45, 68, 91, 45, 79, 67, 84, 89, 80, 69, 32, 9,
211
+ 13, 32, 58, 95, 9, 13, 65, 90, 97, 122, 32, 62,
212
+ 63, 91, 95, 9, 13, 45, 46, 48, 58, 65, 90, 97,
213
+ 122, 32, 62, 80, 83, 91, 9, 13, 85, 66, 76, 73,
214
+ 67, 32, 9, 13, 32, 34, 39, 9, 13, 9, 34, 61,
215
+ 95, 32, 37, 39, 59, 63, 90, 97, 122, 9, 34, 61,
216
+ 95, 32, 37, 39, 59, 63, 90, 97, 122, 32, 62, 91,
217
+ 9, 13, 32, 34, 39, 62, 91, 9, 13, 34, 34, 32,
218
+ 62, 91, 9, 13, 93, 32, 62, 9, 13, 39, 39, 9,
219
+ 39, 61, 95, 32, 33, 35, 37, 40, 59, 63, 90, 97,
220
+ 122, 9, 39, 61, 95, 32, 33, 35, 37, 40, 59, 63,
221
+ 90, 97, 122, 9, 32, 33, 39, 62, 91, 95, 10, 13,
222
+ 35, 37, 40, 59, 61, 90, 97, 122, 9, 32, 34, 39,
223
+ 62, 91, 95, 10, 13, 33, 37, 40, 59, 61, 90, 97,
224
+ 122, 9, 32, 33, 39, 62, 91, 95, 10, 13, 35, 37,
225
+ 40, 59, 61, 90, 97, 122, 9, 32, 34, 39, 62, 91,
226
+ 95, 10, 13, 33, 37, 40, 59, 61, 90, 97, 122, 32,
227
+ 34, 39, 62, 91, 9, 13, 34, 39, 34, 39, 32, 39,
228
+ 62, 91, 9, 13, 39, 93, 32, 62, 93, 9, 13, 32,
229
+ 39, 62, 9, 13, 32, 34, 62, 91, 9, 13, 34, 93,
230
+ 32, 34, 62, 9, 13, 32, 39, 62, 91, 9, 13, 9,
231
+ 39, 61, 95, 32, 33, 35, 37, 40, 59, 63, 90, 97,
232
+ 122, 89, 83, 84, 69, 77, 67, 68, 65, 84, 65, 91,
233
+ 58, 95, 65, 90, 97, 122, 32, 62, 63, 95, 9, 13,
234
+ 45, 46, 48, 58, 65, 90, 97, 122, 32, 62, 9, 13,
235
+ 32, 47, 62, 63, 95, 9, 13, 45, 58, 65, 90, 97,
236
+ 122, 32, 47, 62, 63, 95, 9, 13, 45, 58, 65, 90,
237
+ 97, 122, 32, 47, 61, 62, 63, 95, 9, 13, 45, 58,
238
+ 65, 90, 97, 122, 32, 47, 61, 62, 63, 95, 9, 13,
239
+ 45, 58, 65, 90, 97, 122, 62, 13, 32, 34, 39, 47,
240
+ 60, 62, 9, 10, 11, 12, 13, 32, 47, 60, 62, 9,
241
+ 10, 11, 12, 32, 47, 62, 63, 95, 9, 13, 45, 58,
242
+ 65, 90, 97, 122, 13, 32, 47, 60, 62, 63, 95, 9,
243
+ 10, 11, 12, 45, 58, 65, 90, 97, 122, 13, 32, 47,
244
+ 60, 61, 62, 63, 95, 9, 10, 11, 12, 45, 58, 65,
245
+ 90, 97, 122, 13, 32, 47, 60, 61, 62, 63, 95, 9,
246
+ 10, 11, 12, 45, 58, 65, 90, 97, 122, 13, 32, 47,
247
+ 60, 62, 9, 10, 11, 12, 13, 32, 34, 39, 47, 60,
248
+ 62, 9, 10, 11, 12, 13, 32, 34, 39, 47, 60, 62,
249
+ 63, 95, 9, 10, 11, 12, 45, 58, 65, 90, 97, 122,
250
+ 13, 32, 34, 39, 47, 60, 62, 63, 95, 9, 10, 11,
251
+ 12, 45, 58, 65, 90, 97, 122, 13, 32, 34, 47, 60,
252
+ 62, 92, 9, 10, 11, 12, 13, 32, 34, 47, 60, 62,
253
+ 92, 9, 10, 11, 12, 32, 34, 47, 62, 63, 92, 95,
254
+ 9, 13, 45, 58, 65, 90, 97, 122, 34, 92, 34, 92,
255
+ 32, 34, 47, 61, 62, 63, 92, 95, 9, 13, 45, 58,
256
+ 65, 90, 97, 122, 32, 34, 47, 61, 62, 63, 92, 95,
257
+ 9, 13, 45, 58, 65, 90, 97, 122, 34, 62, 92, 13,
258
+ 32, 34, 39, 47, 60, 62, 92, 9, 10, 11, 12, 13,
259
+ 32, 34, 39, 47, 60, 62, 92, 9, 10, 11, 12, 13,
260
+ 32, 34, 39, 47, 60, 62, 63, 92, 95, 9, 10, 11,
261
+ 12, 45, 58, 65, 90, 97, 122, 13, 32, 34, 39, 47,
262
+ 60, 62, 63, 92, 95, 9, 10, 11, 12, 45, 58, 65,
263
+ 90, 97, 122, 13, 32, 34, 47, 60, 62, 63, 92, 95,
264
+ 9, 10, 11, 12, 45, 58, 65, 90, 97, 122, 13, 32,
265
+ 34, 47, 60, 62, 63, 92, 95, 9, 10, 11, 12, 45,
266
+ 58, 65, 90, 97, 122, 13, 32, 34, 47, 60, 61, 62,
267
+ 63, 92, 95, 9, 10, 11, 12, 45, 58, 65, 90, 97,
268
+ 122, 13, 32, 34, 47, 60, 61, 62, 63, 92, 95, 9,
269
+ 10, 11, 12, 45, 58, 65, 90, 97, 122, 13, 32, 34,
270
+ 47, 60, 62, 92, 9, 10, 11, 12, 13, 32, 34, 47,
271
+ 60, 62, 92, 9, 10, 11, 12, 13, 32, 34, 39, 47,
272
+ 60, 62, 92, 9, 10, 11, 12, 13, 32, 34, 39, 47,
273
+ 60, 62, 92, 9, 10, 11, 12, 13, 32, 34, 39, 47,
274
+ 60, 62, 92, 9, 10, 11, 12, 32, 34, 39, 47, 62,
275
+ 63, 92, 95, 9, 13, 45, 58, 65, 90, 97, 122, 34,
276
+ 39, 92, 32, 39, 47, 62, 63, 92, 95, 9, 13, 45,
277
+ 58, 65, 90, 97, 122, 39, 92, 39, 92, 32, 39, 47,
278
+ 61, 62, 63, 92, 95, 9, 13, 45, 58, 65, 90, 97,
279
+ 122, 32, 39, 47, 61, 62, 63, 92, 95, 9, 13, 45,
280
+ 58, 65, 90, 97, 122, 39, 62, 92, 13, 32, 34, 39,
281
+ 47, 60, 62, 92, 9, 10, 11, 12, 13, 32, 39, 47,
282
+ 60, 62, 92, 9, 10, 11, 12, 13, 32, 39, 47, 60,
283
+ 62, 63, 92, 95, 9, 10, 11, 12, 45, 58, 65, 90,
284
+ 97, 122, 13, 32, 39, 47, 60, 61, 62, 63, 92, 95,
285
+ 9, 10, 11, 12, 45, 58, 65, 90, 97, 122, 13, 32,
286
+ 39, 47, 60, 61, 62, 63, 92, 95, 9, 10, 11, 12,
287
+ 45, 58, 65, 90, 97, 122, 13, 32, 39, 47, 60, 62,
288
+ 92, 9, 10, 11, 12, 13, 32, 39, 47, 60, 62, 92,
289
+ 9, 10, 11, 12, 13, 32, 34, 39, 47, 60, 62, 92,
290
+ 9, 10, 11, 12, 13, 32, 34, 39, 47, 60, 62, 63,
291
+ 92, 95, 9, 10, 11, 12, 45, 58, 65, 90, 97, 122,
292
+ 13, 32, 34, 39, 47, 60, 62, 63, 92, 95, 9, 10,
293
+ 11, 12, 45, 58, 65, 90, 97, 122, 13, 32, 34, 39,
294
+ 47, 60, 62, 92, 9, 10, 11, 12, 13, 32, 34, 39,
295
+ 47, 60, 62, 63, 92, 95, 9, 10, 11, 12, 45, 58,
296
+ 65, 90, 97, 122, 13, 32, 34, 39, 47, 60, 61, 62,
297
+ 63, 92, 95, 9, 10, 11, 12, 45, 58, 65, 90, 97,
298
+ 122, 32, 34, 39, 47, 61, 62, 63, 92, 95, 9, 13,
299
+ 45, 58, 65, 90, 97, 122, 32, 34, 39, 47, 61, 62,
300
+ 63, 92, 95, 9, 13, 45, 58, 65, 90, 97, 122, 34,
301
+ 39, 62, 92, 34, 39, 92, 13, 32, 34, 39, 47, 60,
302
+ 62, 92, 9, 10, 11, 12, 13, 32, 34, 39, 47, 60,
303
+ 62, 92, 9, 10, 11, 12, 13, 32, 34, 39, 47, 60,
304
+ 62, 63, 92, 95, 9, 10, 11, 12, 45, 58, 65, 90,
305
+ 97, 122, 13, 32, 34, 39, 47, 60, 62, 63, 92, 95,
306
+ 9, 10, 11, 12, 45, 58, 65, 90, 97, 122, 13, 32,
307
+ 34, 39, 47, 60, 62, 63, 92, 95, 9, 10, 11, 12,
308
+ 45, 58, 65, 90, 97, 122, 13, 32, 34, 39, 47, 60,
309
+ 62, 92, 9, 10, 11, 12, 13, 32, 34, 39, 47, 60,
310
+ 62, 92, 9, 10, 11, 12, 13, 32, 34, 39, 47, 60,
311
+ 62, 63, 92, 95, 9, 10, 11, 12, 45, 58, 65, 90,
312
+ 97, 122, 32, 34, 39, 47, 62, 63, 92, 95, 9, 13,
313
+ 45, 58, 65, 90, 97, 122, 32, 34, 39, 47, 62, 63,
314
+ 92, 95, 9, 13, 45, 58, 65, 90, 97, 122, 13, 32,
315
+ 34, 39, 47, 60, 62, 92, 9, 10, 11, 12, 13, 32,
316
+ 34, 39, 47, 60, 61, 62, 63, 92, 95, 9, 10, 11,
317
+ 12, 45, 58, 65, 90, 97, 122, 13, 32, 39, 47, 60,
318
+ 62, 63, 92, 95, 9, 10, 11, 12, 45, 58, 65, 90,
319
+ 97, 122, 34, 39, 92, 32, 39, 47, 62, 63, 92, 95,
320
+ 9, 13, 45, 58, 65, 90, 97, 122, 13, 32, 34, 39,
321
+ 47, 60, 62, 92, 9, 10, 11, 12, 32, 34, 47, 62,
322
+ 63, 92, 95, 9, 13, 45, 58, 65, 90, 97, 122, 34,
323
+ 39, 92, 13, 32, 39, 47, 60, 62, 92, 9, 10, 11,
324
+ 12, 34, 92, 39, 92, 13, 32, 34, 39, 47, 60, 62,
325
+ 9, 10, 11, 12, 58, 95, 120, 65, 90, 97, 122, 32,
326
+ 63, 95, 9, 13, 45, 46, 48, 58, 65, 90, 97, 122,
327
+ 32, 63, 95, 109, 9, 13, 45, 46, 48, 58, 65, 90,
328
+ 97, 122, 32, 63, 95, 108, 9, 13, 45, 46, 48, 58,
329
+ 65, 90, 97, 122, 32, 63, 95, 9, 13, 45, 46, 48,
330
+ 58, 65, 90, 97, 122, 101, 114, 115, 105, 111, 110, 32,
331
+ 61, 9, 13, 32, 34, 39, 9, 13, 95, 45, 46, 48,
332
+ 58, 65, 90, 97, 122, 34, 95, 45, 46, 48, 58, 65,
333
+ 90, 97, 122, 32, 62, 63, 9, 13, 32, 62, 63, 101,
334
+ 115, 9, 13, 62, 110, 99, 111, 100, 105, 110, 103, 32,
335
+ 61, 9, 13, 32, 34, 39, 9, 13, 65, 90, 97, 122,
336
+ 34, 95, 45, 46, 48, 57, 65, 90, 97, 122, 32, 62,
337
+ 63, 9, 13, 32, 62, 63, 115, 9, 13, 116, 97, 110,
338
+ 100, 97, 108, 111, 110, 101, 32, 61, 9, 13, 32, 34,
339
+ 39, 9, 13, 110, 121, 111, 34, 32, 62, 63, 9, 13,
340
+ 101, 115, 110, 121, 111, 39, 101, 115, 65, 90, 97, 122,
341
+ 39, 95, 45, 46, 48, 57, 65, 90, 97, 122, 95, 45,
342
+ 46, 48, 58, 65, 90, 97, 122, 39, 95, 45, 46, 48,
343
+ 58, 65, 90, 97, 122, 62, 62, 10, 60, 33, 47, 58,
344
+ 63, 95, 65, 90, 97, 122, 39, 93, 34, 34, 92, 39,
345
+ 92, 34, 39, 92, 32, 9, 13, 32, 118, 9, 13, 10,
346
+ 45, 45, 10, 93, 93, 10, 62, 63, 62, 0
347
+ };
348
+ }
349
+
350
+ private static final char _hpricot_scan_trans_keys[] = init__hpricot_scan_trans_keys_0();
351
+
352
+
353
+ private static byte[] init__hpricot_scan_single_lengths_0()
354
+ {
355
+ return new byte [] {
356
+ 3, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 5,
357
+ 1, 1, 1, 1, 1, 1, 3, 4, 4, 3, 5, 1,
358
+ 1, 3, 1, 2, 1, 1, 4, 4, 7, 7, 7, 7,
359
+ 5, 2, 2, 4, 2, 3, 3, 4, 2, 3, 4, 4,
360
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
361
+ 4, 2, 5, 5, 6, 6, 1, 7, 5, 5, 7, 8,
362
+ 8, 5, 7, 9, 9, 7, 7, 7, 2, 2, 8, 8,
363
+ 3, 8, 8, 10, 10, 9, 9, 10, 10, 7, 7, 8,
364
+ 8, 8, 8, 3, 7, 2, 2, 8, 8, 3, 8, 7,
365
+ 9, 10, 10, 7, 7, 8, 10, 10, 8, 10, 11, 9,
366
+ 9, 4, 3, 8, 8, 10, 10, 10, 8, 8, 10, 8,
367
+ 8, 8, 11, 9, 3, 7, 8, 7, 3, 7, 2, 2,
368
+ 7, 3, 3, 4, 4, 3, 1, 1, 1, 1, 1, 1,
369
+ 2, 3, 1, 2, 3, 5, 1, 1, 1, 1, 1, 1,
370
+ 1, 1, 2, 3, 0, 2, 3, 4, 1, 1, 1, 1,
371
+ 1, 1, 1, 1, 1, 2, 3, 2, 1, 1, 3, 1,
372
+ 1, 2, 1, 1, 1, 1, 0, 2, 1, 2, 1, 1,
373
+ 2, 5, 1, 1, 1, 2, 2, 3, 1, 2, 2, 1,
374
+ 2, 1, 3, 1
375
+ };
376
+ }
377
+
378
+ private static final byte _hpricot_scan_single_lengths[] = init__hpricot_scan_single_lengths_0();
379
+
380
+
381
+ private static byte[] init__hpricot_scan_range_lengths_0()
382
+ {
383
+ return new byte [] {
384
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 5, 1,
385
+ 0, 0, 0, 0, 0, 1, 1, 4, 4, 1, 1, 0,
386
+ 0, 1, 0, 1, 0, 0, 5, 5, 5, 5, 5, 5,
387
+ 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 5,
388
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
389
+ 5, 1, 4, 4, 4, 4, 0, 2, 2, 4, 5, 5,
390
+ 5, 2, 2, 5, 5, 2, 2, 4, 0, 0, 4, 4,
391
+ 0, 2, 2, 5, 5, 5, 5, 5, 5, 2, 2, 2,
392
+ 2, 2, 4, 0, 4, 0, 0, 4, 4, 0, 2, 2,
393
+ 5, 5, 5, 2, 2, 2, 5, 5, 2, 5, 5, 4,
394
+ 4, 0, 0, 2, 2, 5, 5, 5, 2, 2, 5, 4,
395
+ 4, 2, 5, 5, 0, 4, 2, 4, 0, 2, 0, 0,
396
+ 2, 2, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0,
397
+ 1, 1, 4, 4, 1, 1, 0, 0, 0, 0, 0, 0,
398
+ 0, 0, 1, 1, 2, 4, 1, 1, 0, 0, 0, 0,
399
+ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0,
400
+ 0, 0, 0, 0, 0, 0, 2, 4, 4, 4, 0, 0,
401
+ 0, 2, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0,
402
+ 0, 0, 0, 0
403
+ };
404
+ }
405
+
406
+ private static final byte _hpricot_scan_range_lengths[] = init__hpricot_scan_range_lengths_0();
407
+
408
+
409
+ private static short[] init__hpricot_scan_index_offsets_0()
410
+ {
411
+ return new short [] {
412
+ 0, 4, 6, 8, 10, 12, 14, 16, 18, 21, 28, 39,
413
+ 46, 48, 50, 52, 54, 56, 59, 64, 73, 82, 87, 94,
414
+ 96, 98, 103, 105, 109, 111, 113, 123, 133, 146, 159, 172,
415
+ 185, 192, 195, 198, 204, 207, 212, 217, 223, 226, 231, 237,
416
+ 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, 267, 269,
417
+ 274, 284, 288, 298, 308, 319, 330, 332, 342, 350, 360, 373,
418
+ 387, 401, 409, 419, 434, 449, 459, 469, 481, 484, 487, 500,
419
+ 513, 517, 528, 539, 555, 571, 586, 601, 617, 633, 643, 653,
420
+ 664, 675, 686, 699, 703, 715, 718, 721, 734, 747, 751, 762,
421
+ 772, 787, 803, 819, 829, 839, 850, 866, 882, 893, 909, 926,
422
+ 940, 954, 959, 963, 974, 985, 1001, 1017, 1033, 1044, 1055, 1071,
423
+ 1084, 1097, 1108, 1125, 1140, 1144, 1156, 1167, 1179, 1183, 1193, 1196,
424
+ 1199, 1209, 1215, 1224, 1234, 1244, 1253, 1255, 1257, 1259, 1261, 1263,
425
+ 1265, 1269, 1274, 1280, 1287, 1292, 1299, 1301, 1303, 1305, 1307, 1309,
426
+ 1311, 1313, 1315, 1319, 1324, 1327, 1334, 1339, 1345, 1347, 1349, 1351,
427
+ 1353, 1355, 1357, 1359, 1361, 1363, 1367, 1372, 1375, 1377, 1379, 1384,
428
+ 1386, 1388, 1391, 1393, 1395, 1397, 1399, 1402, 1409, 1415, 1422, 1424,
429
+ 1426, 1429, 1437, 1439, 1441, 1443, 1446, 1449, 1453, 1456, 1460, 1463,
430
+ 1465, 1468, 1470, 1474
431
+ };
432
+ }
433
+
434
+ private static final short _hpricot_scan_index_offsets[] = init__hpricot_scan_index_offsets_0();
435
+
436
+
437
+ private static short[] init__hpricot_scan_indicies_0()
438
+ {
439
+ return new short [] {
440
+ 1, 2, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0,
441
+ 8, 0, 9, 0, 10, 0, 11, 11, 0, 11, 12, 12,
442
+ 11, 12, 12, 0, 13, 15, 14, 16, 14, 13, 14, 14,
443
+ 14, 14, 0, 17, 18, 19, 20, 21, 17, 0, 22, 0,
444
+ 23, 0, 24, 0, 25, 0, 26, 0, 27, 27, 0, 27,
445
+ 28, 29, 27, 0, 30, 31, 30, 30, 30, 30, 30, 30,
446
+ 0, 32, 33, 32, 32, 32, 32, 32, 32, 0, 34, 18,
447
+ 21, 34, 0, 34, 35, 36, 18, 21, 34, 0, 38, 37,
448
+ 41, 40, 42, 18, 21, 42, 39, 43, 21, 43, 18, 43,
449
+ 39, 38, 44, 41, 45, 46, 47, 46, 46, 46, 46, 46,
450
+ 46, 46, 0, 48, 49, 48, 48, 48, 48, 48, 48, 48,
451
+ 0, 50, 50, 48, 49, 18, 21, 48, 34, 48, 48, 48,
452
+ 48, 0, 50, 50, 35, 51, 18, 21, 48, 34, 48, 48,
453
+ 48, 48, 0, 52, 52, 54, 55, 56, 57, 54, 53, 54,
454
+ 54, 54, 54, 44, 58, 58, 61, 62, 63, 64, 60, 59,
455
+ 60, 60, 60, 60, 45, 59, 61, 65, 63, 64, 59, 45,
456
+ 67, 68, 66, 70, 71, 69, 72, 41, 63, 64, 72, 45,
457
+ 73, 74, 64, 75, 76, 43, 75, 21, 74, 41, 63, 74,
458
+ 45, 77, 41, 78, 79, 77, 40, 73, 80, 79, 80, 41,
459
+ 78, 80, 40, 81, 38, 56, 57, 81, 44, 60, 82, 60,
460
+ 60, 60, 60, 60, 60, 60, 45, 83, 0, 84, 0, 85,
461
+ 0, 86, 0, 87, 0, 88, 0, 89, 0, 90, 0, 91,
462
+ 0, 92, 0, 93, 0, 94, 94, 94, 94, 0, 95, 97,
463
+ 96, 96, 95, 96, 96, 96, 96, 0, 98, 99, 98, 0,
464
+ 100, 102, 103, 101, 101, 100, 101, 101, 101, 0, 104, 106,
465
+ 107, 105, 105, 104, 105, 105, 105, 0, 108, 110, 111, 112,
466
+ 109, 109, 108, 109, 109, 109, 39, 113, 115, 116, 117, 114,
467
+ 114, 113, 114, 114, 114, 39, 118, 39, 120, 120, 122, 123,
468
+ 124, 39, 117, 120, 121, 119, 126, 126, 128, 39, 129, 126,
469
+ 127, 125, 130, 115, 117, 114, 114, 130, 114, 114, 114, 39,
470
+ 126, 126, 132, 39, 133, 131, 131, 126, 127, 131, 131, 131,
471
+ 125, 134, 134, 137, 39, 138, 139, 136, 136, 134, 135, 136,
472
+ 136, 136, 125, 140, 140, 132, 39, 142, 133, 131, 131, 140,
473
+ 141, 131, 131, 131, 125, 126, 126, 128, 39, 129, 126, 127,
474
+ 125, 143, 143, 145, 146, 147, 39, 129, 143, 144, 119, 148,
475
+ 148, 122, 123, 124, 39, 117, 150, 150, 148, 149, 150, 150,
476
+ 150, 119, 143, 143, 145, 146, 151, 39, 133, 150, 150, 143,
477
+ 144, 150, 150, 150, 119, 153, 153, 155, 156, 157, 158, 159,
478
+ 153, 154, 152, 161, 161, 163, 164, 165, 166, 167, 161, 162,
479
+ 160, 168, 169, 171, 172, 170, 173, 170, 168, 170, 170, 170,
480
+ 165, 169, 173, 165, 174, 173, 165, 175, 169, 177, 178, 179,
481
+ 176, 173, 176, 175, 176, 176, 176, 165, 180, 169, 171, 181,
482
+ 172, 170, 173, 170, 180, 170, 170, 170, 165, 169, 182, 173,
483
+ 165, 183, 183, 185, 186, 187, 165, 172, 159, 183, 184, 152,
484
+ 188, 188, 185, 186, 187, 165, 172, 159, 188, 189, 152, 188,
485
+ 188, 185, 186, 187, 165, 172, 190, 159, 190, 188, 189, 190,
486
+ 190, 190, 152, 191, 191, 193, 194, 195, 165, 196, 190, 159,
487
+ 190, 191, 192, 190, 190, 190, 152, 153, 153, 155, 195, 157,
488
+ 197, 190, 159, 190, 153, 154, 190, 190, 190, 152, 161, 161,
489
+ 163, 199, 165, 196, 198, 167, 198, 161, 162, 198, 198, 198,
490
+ 160, 200, 200, 163, 203, 165, 204, 205, 202, 167, 202, 200,
491
+ 201, 202, 202, 202, 160, 206, 206, 163, 199, 165, 208, 196,
492
+ 198, 167, 198, 206, 207, 198, 198, 198, 160, 161, 161, 163,
493
+ 164, 165, 166, 167, 161, 162, 160, 161, 161, 209, 164, 165,
494
+ 166, 167, 161, 162, 160, 191, 191, 193, 194, 156, 165, 166,
495
+ 159, 191, 192, 152, 211, 211, 213, 214, 215, 216, 217, 218,
496
+ 211, 212, 210, 220, 220, 222, 209, 223, 224, 225, 226, 220,
497
+ 221, 219, 227, 228, 174, 230, 231, 229, 232, 229, 227, 229,
498
+ 229, 229, 224, 228, 174, 232, 224, 234, 169, 236, 237, 235,
499
+ 238, 235, 234, 235, 235, 235, 233, 169, 238, 233, 228, 238,
500
+ 233, 239, 169, 241, 242, 243, 240, 238, 240, 239, 240, 240,
501
+ 240, 233, 244, 169, 236, 245, 237, 235, 238, 235, 244, 235,
502
+ 235, 235, 233, 169, 246, 238, 233, 248, 248, 250, 251, 252,
503
+ 233, 237, 253, 248, 249, 247, 255, 255, 163, 257, 233, 258,
504
+ 259, 255, 256, 254, 255, 255, 163, 261, 233, 262, 260, 259,
505
+ 260, 255, 256, 260, 260, 260, 254, 263, 263, 163, 266, 233,
506
+ 267, 268, 265, 259, 265, 263, 264, 265, 265, 265, 254, 269,
507
+ 269, 163, 261, 233, 271, 262, 260, 259, 260, 269, 270, 260,
508
+ 260, 260, 254, 255, 255, 163, 257, 233, 258, 259, 255, 256,
509
+ 254, 255, 255, 222, 257, 233, 258, 259, 255, 256, 254, 272,
510
+ 272, 274, 275, 276, 233, 258, 253, 272, 273, 247, 277, 277,
511
+ 250, 251, 252, 233, 237, 279, 253, 279, 277, 278, 279, 279,
512
+ 279, 247, 272, 272, 274, 275, 280, 233, 262, 279, 253, 279,
513
+ 272, 273, 279, 279, 279, 247, 211, 211, 281, 214, 215, 216,
514
+ 217, 218, 211, 212, 210, 220, 220, 222, 209, 283, 224, 284,
515
+ 282, 226, 282, 220, 221, 282, 282, 282, 219, 285, 285, 222,
516
+ 209, 288, 224, 289, 290, 287, 226, 287, 285, 286, 287, 287,
517
+ 287, 219, 291, 228, 174, 230, 292, 231, 229, 232, 229, 291,
518
+ 229, 229, 229, 224, 293, 228, 174, 295, 296, 297, 294, 232,
519
+ 294, 293, 294, 294, 294, 224, 228, 174, 298, 232, 224, 299,
520
+ 299, 232, 224, 300, 300, 302, 303, 304, 224, 231, 218, 300,
521
+ 301, 210, 305, 305, 302, 303, 304, 224, 231, 218, 305, 306,
522
+ 210, 305, 305, 302, 303, 304, 224, 231, 307, 218, 307, 305,
523
+ 306, 307, 307, 307, 210, 308, 308, 310, 311, 312, 224, 284,
524
+ 307, 218, 307, 308, 309, 307, 307, 307, 210, 211, 211, 281,
525
+ 214, 312, 216, 313, 307, 218, 307, 211, 212, 307, 307, 307,
526
+ 210, 220, 220, 222, 209, 223, 224, 225, 226, 220, 221, 219,
527
+ 220, 220, 314, 314, 223, 224, 225, 226, 220, 221, 219, 211,
528
+ 211, 213, 214, 312, 216, 313, 307, 218, 307, 211, 212, 307,
529
+ 307, 307, 210, 315, 316, 317, 319, 320, 318, 321, 318, 315,
530
+ 318, 318, 318, 216, 315, 322, 317, 319, 320, 318, 321, 318,
531
+ 315, 318, 318, 318, 216, 308, 308, 310, 311, 215, 224, 225,
532
+ 218, 308, 309, 210, 323, 323, 222, 209, 283, 224, 325, 284,
533
+ 282, 226, 282, 323, 324, 282, 282, 282, 219, 326, 326, 155,
534
+ 280, 328, 329, 279, 253, 279, 326, 327, 279, 279, 279, 247,
535
+ 316, 317, 321, 216, 330, 331, 333, 334, 332, 335, 332, 330,
536
+ 332, 332, 332, 328, 277, 277, 250, 251, 252, 233, 237, 253,
537
+ 277, 278, 247, 336, 331, 338, 339, 337, 340, 337, 336, 337,
538
+ 337, 337, 157, 322, 317, 321, 216, 326, 326, 155, 276, 328,
539
+ 341, 253, 326, 327, 247, 331, 340, 157, 331, 335, 328, 148,
540
+ 148, 122, 123, 124, 39, 117, 148, 149, 119, 342, 342, 343,
541
+ 342, 342, 0, 344, 345, 345, 344, 345, 345, 345, 345, 0,
542
+ 344, 345, 345, 346, 344, 345, 345, 345, 345, 0, 344, 345,
543
+ 345, 347, 344, 345, 345, 345, 345, 0, 348, 345, 345, 348,
544
+ 345, 345, 345, 345, 0, 350, 349, 351, 349, 352, 349, 353,
545
+ 349, 354, 349, 355, 349, 355, 356, 355, 349, 356, 357, 358,
546
+ 356, 349, 359, 359, 359, 359, 359, 349, 360, 361, 361, 361,
547
+ 361, 361, 349, 362, 363, 364, 362, 349, 362, 363, 364, 365,
548
+ 366, 362, 349, 363, 349, 367, 349, 368, 349, 369, 349, 370,
549
+ 349, 371, 349, 372, 349, 373, 349, 373, 374, 373, 349, 374,
550
+ 375, 376, 374, 349, 377, 377, 349, 378, 379, 379, 379, 379,
551
+ 379, 349, 380, 363, 364, 380, 349, 380, 363, 364, 366, 380,
552
+ 349, 381, 349, 382, 349, 383, 349, 384, 349, 385, 349, 386,
553
+ 349, 387, 349, 388, 349, 389, 349, 389, 390, 389, 349, 390,
554
+ 391, 392, 390, 349, 393, 394, 349, 395, 349, 396, 349, 397,
555
+ 363, 364, 397, 349, 398, 349, 395, 349, 399, 400, 349, 401,
556
+ 349, 396, 349, 402, 349, 401, 349, 403, 403, 349, 378, 404,
557
+ 404, 404, 404, 404, 349, 405, 405, 405, 405, 405, 349, 360,
558
+ 406, 406, 406, 406, 406, 349, 408, 407, 410, 409, 412, 413,
559
+ 411, 415, 416, 417, 418, 417, 417, 417, 414, 41, 45, 43,
560
+ 21, 41, 40, 169, 173, 165, 169, 238, 233, 228, 174, 232,
561
+ 224, 344, 344, 420, 348, 421, 348, 420, 423, 424, 422, 426,
562
+ 425, 428, 429, 427, 431, 430, 433, 434, 435, 432, 434, 436,
563
+ 0
564
+ };
565
+ }
566
+
567
+ private static final short _hpricot_scan_indicies[] = init__hpricot_scan_indicies_0();
568
+
569
+
570
+ private static short[] init__hpricot_scan_trans_targs_wi_0()
571
+ {
572
+ return new short [] {
573
+ 204, 1, 2, 53, 204, 3, 4, 5, 6, 7, 8, 9,
574
+ 10, 11, 10, 204, 26, 11, 204, 12, 48, 26, 13, 14,
575
+ 15, 16, 17, 18, 19, 30, 20, 21, 20, 21, 22, 23,
576
+ 28, 24, 25, 204, 24, 25, 25, 27, 29, 29, 31, 32,
577
+ 31, 32, 33, 34, 35, 36, 47, 32, 206, 40, 35, 36,
578
+ 47, 37, 34, 206, 40, 46, 38, 39, 43, 38, 39, 43,
579
+ 39, 41, 42, 41, 207, 43, 208, 44, 45, 39, 32, 49,
580
+ 50, 51, 52, 21, 54, 55, 56, 57, 58, 204, 60, 61,
581
+ 60, 204, 61, 204, 63, 62, 66, 204, 63, 64, 66, 204,
582
+ 65, 64, 66, 67, 204, 65, 64, 66, 67, 204, 204, 68,
583
+ 144, 74, 142, 143, 73, 68, 69, 70, 73, 204, 69, 71,
584
+ 73, 204, 65, 72, 71, 73, 74, 204, 65, 72, 74, 75,
585
+ 76, 77, 141, 73, 75, 76, 71, 73, 78, 79, 90, 70,
586
+ 93, 80, 209, 94, 78, 79, 90, 70, 93, 80, 209, 94,
587
+ 79, 69, 82, 84, 209, 81, 79, 83, 82, 84, 85, 209,
588
+ 83, 85, 209, 86, 95, 139, 140, 93, 87, 88, 91, 87,
589
+ 88, 89, 96, 93, 209, 209, 91, 93, 83, 92, 91, 93,
590
+ 95, 209, 83, 92, 95, 90, 97, 98, 117, 108, 90, 128,
591
+ 99, 211, 129, 97, 98, 117, 108, 128, 99, 211, 129, 98,
592
+ 100, 120, 121, 211, 122, 101, 100, 103, 105, 210, 102, 104,
593
+ 103, 105, 106, 210, 104, 106, 210, 107, 138, 113, 136, 137,
594
+ 111, 112, 107, 100, 108, 111, 210, 112, 109, 111, 210, 104,
595
+ 110, 109, 111, 113, 210, 104, 110, 113, 114, 115, 116, 135,
596
+ 111, 114, 115, 109, 111, 108, 118, 128, 211, 119, 134, 118,
597
+ 128, 133, 211, 119, 123, 119, 120, 121, 123, 211, 211, 98,
598
+ 124, 133, 131, 132, 128, 125, 126, 118, 125, 126, 127, 130,
599
+ 128, 211, 117, 98, 100, 79, 120, 121, 211, 122, 100, 119,
600
+ 134, 133, 100, 108, 101, 210, 100, 69, 103, 105, 210, 102,
601
+ 79, 82, 84, 209, 81, 210, 146, 147, 212, 146, 148, 149,
602
+ 213, 204, 151, 152, 153, 154, 155, 156, 157, 158, 200, 159,
603
+ 160, 159, 161, 204, 162, 163, 176, 164, 165, 166, 167, 168,
604
+ 169, 170, 171, 172, 198, 173, 174, 173, 175, 177, 178, 179,
605
+ 180, 181, 182, 183, 184, 185, 186, 187, 193, 188, 191, 189,
606
+ 190, 190, 192, 194, 196, 195, 197, 199, 199, 201, 201, 214,
607
+ 214, 216, 216, 204, 204, 205, 204, 0, 59, 62, 145, 204,
608
+ 204, 150, 214, 214, 215, 214, 202, 216, 216, 217, 216, 203,
609
+ 218, 218, 218, 219, 218
610
+ };
611
+ }
612
+
613
+ private static final short _hpricot_scan_trans_targs_wi[] = init__hpricot_scan_trans_targs_wi_0();
614
+
615
+
616
+ private static short[] init__hpricot_scan_trans_actions_wi_0()
617
+ {
618
+ return new short [] {
619
+ 73, 0, 0, 0, 59, 0, 0, 0, 0, 0, 0, 0,
620
+ 1, 5, 0, 92, 5, 0, 51, 0, 0, 0, 0, 0,
621
+ 0, 0, 0, 0, 0, 0, 3, 83, 0, 19, 0, 0,
622
+ 0, 3, 86, 75, 0, 21, 0, 0, 3, 0, 3, 83,
623
+ 0, 19, 0, 19, 3, 3, 3, 172, 188, 3, 0, 0,
624
+ 0, 0, 113, 146, 0, 21, 3, 86, 86, 0, 21, 21,
625
+ 0, 21, 0, 0, 146, 0, 146, 0, 0, 3, 113, 0,
626
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 61, 1, 5,
627
+ 0, 98, 0, 55, 5, 0, 5, 95, 0, 116, 0, 53,
628
+ 11, 0, 110, 11, 168, 0, 180, 23, 0, 122, 57, 3,
629
+ 3, 3, 0, 0, 89, 0, 9, 9, 104, 164, 0, 180,
630
+ 119, 176, 107, 107, 0, 160, 11, 201, 9, 9, 0, 80,
631
+ 80, 0, 0, 152, 3, 3, 196, 156, 3, 80, 80, 77,
632
+ 152, 3, 226, 3, 0, 9, 9, 7, 104, 0, 211, 0,
633
+ 0, 7, 180, 23, 192, 0, 7, 11, 0, 110, 11, 216,
634
+ 0, 0, 149, 3, 3, 7, 0, 89, 3, 3, 196, 80,
635
+ 80, 7, 0, 156, 221, 232, 180, 119, 107, 107, 0, 160,
636
+ 11, 238, 9, 9, 0, 7, 3, 80, 80, 101, 77, 152,
637
+ 3, 226, 3, 0, 9, 9, 7, 104, 0, 211, 0, 0,
638
+ 7, 180, 23, 192, 0, 0, 0, 180, 23, 192, 0, 11,
639
+ 0, 110, 11, 216, 0, 0, 149, 3, 3, 3, 0, 7,
640
+ 89, 3, 0, 9, 9, 104, 211, 0, 180, 119, 221, 107,
641
+ 107, 0, 160, 11, 238, 9, 9, 0, 80, 80, 0, 7,
642
+ 152, 3, 3, 196, 156, 77, 180, 119, 221, 107, 107, 0,
643
+ 160, 11, 238, 0, 0, 11, 0, 110, 11, 216, 149, 7,
644
+ 3, 3, 7, 7, 89, 3, 3, 196, 80, 80, 7, 7,
645
+ 156, 232, 7, 3, 77, 77, 196, 89, 206, 3, 101, 9,
646
+ 9, 0, 80, 80, 3, 232, 3, 77, 196, 89, 206, 3,
647
+ 3, 196, 89, 206, 3, 226, 25, 25, 0, 0, 0, 0,
648
+ 31, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
649
+ 13, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0,
650
+ 0, 0, 0, 0, 0, 3, 15, 0, 0, 0, 0, 0,
651
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0,
652
+ 17, 0, 0, 3, 3, 0, 0, 3, 0, 3, 0, 37,
653
+ 137, 43, 140, 63, 134, 184, 69, 0, 0, 1, 0, 65,
654
+ 67, 0, 33, 125, 31, 35, 0, 39, 128, 31, 41, 0,
655
+ 45, 131, 143, 0, 47
656
+ };
657
+ }
658
+
659
+ private static final short _hpricot_scan_trans_actions_wi[] = init__hpricot_scan_trans_actions_wi_0();
660
+
661
+
662
+ private static short[] init__hpricot_scan_to_state_actions_0()
663
+ {
664
+ return new short [] {
665
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
666
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
667
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
668
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
669
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
670
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
671
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
672
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
673
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
674
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
675
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
676
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
677
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
678
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
679
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
680
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
681
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
682
+ 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 0,
683
+ 27, 0, 27, 0
684
+ };
685
+ }
686
+
687
+ private static final short _hpricot_scan_to_state_actions[] = init__hpricot_scan_to_state_actions_0();
688
+
689
+
690
+ private static short[] init__hpricot_scan_from_state_actions_0()
691
+ {
692
+ return new short [] {
693
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
694
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
695
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
696
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
697
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
698
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
699
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
700
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
701
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
702
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
703
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
704
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
705
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
706
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
707
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
708
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
709
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
710
+ 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0,
711
+ 29, 0, 29, 0
712
+ };
713
+ }
714
+
715
+ private static final short _hpricot_scan_from_state_actions[] = init__hpricot_scan_from_state_actions_0();
716
+
717
+
718
+ private static short[] init__hpricot_scan_eof_trans_0()
719
+ {
720
+ return new short [] {
721
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
722
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
723
+ 40, 40, 40, 40, 1, 40, 1, 1, 1, 1, 1, 1,
724
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
725
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
726
+ 1, 1, 1, 1, 40, 40, 40, 40, 40, 40, 40, 40,
727
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
728
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
729
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
730
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
731
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
732
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
733
+ 40, 1, 1, 1, 1, 1, 350, 350, 350, 350, 350, 350,
734
+ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
735
+ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
736
+ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
737
+ 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 408, 410,
738
+ 0, 415, 420, 420, 420, 40, 40, 40, 421, 421, 0, 426,
739
+ 0, 431, 0, 437
740
+ };
741
+ }
742
+
743
+ private static final short _hpricot_scan_eof_trans[] = init__hpricot_scan_eof_trans_0();
744
+
745
+
746
+ static final int hpricot_scan_start = 204;
747
+ static final int hpricot_scan_error = -1;
748
+
749
+ static final int hpricot_scan_en_html_comment = 214;
750
+ static final int hpricot_scan_en_html_cdata = 216;
751
+ static final int hpricot_scan_en_html_procins = 218;
752
+ static final int hpricot_scan_en_main = 204;
753
+
754
+ // line 191 "ext/hpricot_scan/hpricot_scan.java.rl"
755
+
756
+ public final static int BUFSIZE=16384;
757
+
758
+ private void rb_yield_tokens(IRubyObject sym, IRubyObject tag, IRubyObject attr, IRubyObject raw, boolean taint) {
759
+ IRubyObject ary;
760
+ if (sym == runtime.newSymbol("text")) {
761
+ raw = tag;
762
+ }
763
+ ary = runtime.newArray(new IRubyObject[]{sym, tag, attr, raw});
764
+ if (taint) {
765
+ ary.setTaint(true);
766
+ tag.setTaint(true);
767
+ attr.setTaint(true);
768
+ raw.setTaint(true);
769
+ }
770
+ block.yield(runtime.getCurrentContext(), ary, null, null, false);
771
+ }
772
+
773
+
774
+ int cs, act, have = 0, nread = 0, curline = 1, p=-1;
775
+ boolean text = false;
776
+ int tokstart=-1, tokend;
777
+ char[] buf;
778
+ Ruby runtime;
779
+ IRubyObject attr, bufsize;
780
+ IRubyObject[] tag, akey, aval;
781
+ int mark_tag, mark_akey, mark_aval;
782
+ boolean done = false, ele_open = false;
783
+ int buffer_size = 0;
784
+ boolean taint = false;
785
+ Block block = null;
786
+
787
+
788
+ IRubyObject xmldecl, doctype, procins, stag, etag, emptytag, comment,
789
+ cdata, sym_text;
790
+
791
+ IRubyObject hpricot_scan(IRubyObject recv, IRubyObject port) {
792
+ attr = bufsize = runtime.getNil();
793
+ tag = new IRubyObject[]{runtime.getNil()};
794
+ akey = new IRubyObject[]{runtime.getNil()};
795
+ aval = new IRubyObject[]{runtime.getNil()};
796
+
797
+ RubyClass rb_eHpricotParseError = runtime.getModule("Hpricot").getClass("ParseError");
798
+
799
+ taint = port.isTaint();
800
+ if ( !port.respondsTo("read")) {
801
+ if ( port.respondsTo("to_str")) {
802
+ port = port.callMethod(runtime.getCurrentContext(),"to_str");
803
+ } else {
804
+ throw runtime.newArgumentError("bad Hpricot argument, String or IO only please.");
805
+ }
806
+ }
807
+
808
+ buffer_size = BUFSIZE;
809
+ if (rubyApi.getInstanceVariable(recv, "@buffer_size") != null) {
810
+ bufsize = rubyApi.getInstanceVariable(recv, "@buffer_size");
811
+ if (!bufsize.isNil()) {
812
+ buffer_size = RubyNumeric.fix2int(bufsize);
813
+ }
814
+ }
815
+ buf = new char[buffer_size];
816
+
817
+
818
+ // line 819 "ext/hpricot_scan/hpricot_scan.java.java"
819
+ {
820
+ cs = hpricot_scan_start;
821
+ ts = -1;
822
+ te = -1;
823
+ act = 0;
824
+ }
825
+ // line 254 "ext/hpricot_scan/hpricot_scan.java.rl"
826
+
827
+ while( !done ) {
828
+ IRubyObject str;
829
+ p = have;
830
+ int pe;
831
+ int len, space = buffer_size - have;
832
+
833
+ if ( space == 0 ) {
834
+ /* We've used up the entire buffer storing an already-parsed token
835
+ * prefix that must be preserved. Likely caused by super-long attributes.
836
+ * See ticket #13. */
837
+ rb_raise(rb_eHpricotParseError, "ran out of buffer space on element <" + tag.toString() + ">, starting on line "+curline+".");
838
+ }
839
+
840
+ if (port.respondsTo("read")) {
841
+ str = port.callMethod(runtime.getCurrentContext(),"read",runtime.newFixnum(space));
842
+ } else {
843
+ str = ((RubyString)port).substr(nread,space);
844
+ }
845
+
846
+ str = str.convertToString();
847
+ String sss = str.toString();
848
+ char[] chars = sss.toCharArray();
849
+ System.arraycopy(chars,0,buf,p,chars.length);
850
+
851
+ len = sss.length();
852
+ nread += len;
853
+
854
+ if ( len < space ) {
855
+ len++;
856
+ done = true;
857
+ }
858
+
859
+ pe = p + len;
860
+ char[] data = buf;
861
+
862
+
863
+ // line 864 "ext/hpricot_scan/hpricot_scan.java.java"
864
+ {
865
+ int _klen;
866
+ int _trans = 0;
867
+ int _acts;
868
+ int _nacts;
869
+ int _keys;
870
+ int _goto_targ = 0;
871
+
872
+ _goto: while (true) {
873
+ switch ( _goto_targ ) {
874
+ case 0:
875
+ if ( p == pe ) {
876
+ _goto_targ = 4;
877
+ continue _goto;
878
+ }
879
+ case 1:
880
+ _acts = _hpricot_scan_from_state_actions[cs];
881
+ _nacts = (int) _hpricot_scan_actions[_acts++];
882
+ while ( _nacts-- > 0 ) {
883
+ switch ( _hpricot_scan_actions[_acts++] ) {
884
+ case 21:
885
+ // line 1 "ext/hpricot_scan/hpricot_scan.java.rl"
886
+ {ts = p;}
887
+ break;
888
+ // line 889 "ext/hpricot_scan/hpricot_scan.java.java"
889
+ }
890
+ }
891
+
892
+ _match: do {
893
+ _keys = _hpricot_scan_key_offsets[cs];
894
+ _trans = _hpricot_scan_index_offsets[cs];
895
+ _klen = _hpricot_scan_single_lengths[cs];
896
+ if ( _klen > 0 ) {
897
+ int _lower = _keys;
898
+ int _mid;
899
+ int _upper = _keys + _klen - 1;
900
+ while (true) {
901
+ if ( _upper < _lower )
902
+ break;
903
+
904
+ _mid = _lower + ((_upper-_lower) >> 1);
905
+ if ( data[p] < _hpricot_scan_trans_keys[_mid] )
906
+ _upper = _mid - 1;
907
+ else if ( data[p] > _hpricot_scan_trans_keys[_mid] )
908
+ _lower = _mid + 1;
909
+ else {
910
+ _trans += (_mid - _keys);
911
+ break _match;
912
+ }
913
+ }
914
+ _keys += _klen;
915
+ _trans += _klen;
916
+ }
917
+
918
+ _klen = _hpricot_scan_range_lengths[cs];
919
+ if ( _klen > 0 ) {
920
+ int _lower = _keys;
921
+ int _mid;
922
+ int _upper = _keys + (_klen<<1) - 2;
923
+ while (true) {
924
+ if ( _upper < _lower )
925
+ break;
926
+
927
+ _mid = _lower + (((_upper-_lower) >> 1) & ~1);
928
+ if ( data[p] < _hpricot_scan_trans_keys[_mid] )
929
+ _upper = _mid - 2;
930
+ else if ( data[p] > _hpricot_scan_trans_keys[_mid+1] )
931
+ _lower = _mid + 2;
932
+ else {
933
+ _trans += ((_mid - _keys)>>1);
934
+ break _match;
935
+ }
936
+ }
937
+ _trans += _klen;
938
+ }
939
+ } while (false);
940
+
941
+ _trans = _hpricot_scan_indicies[_trans];
942
+ case 3:
943
+ cs = _hpricot_scan_trans_targs_wi[_trans];
944
+
945
+ if ( _hpricot_scan_trans_actions_wi[_trans] != 0 ) {
946
+ _acts = _hpricot_scan_trans_actions_wi[_trans];
947
+ _nacts = (int) _hpricot_scan_actions[_acts++];
948
+ while ( _nacts-- > 0 )
949
+ {
950
+ switch ( _hpricot_scan_actions[_acts++] )
951
+ {
952
+ case 0:
953
+ // line 146 "ext/hpricot_scan/hpricot_scan.java.rl"
954
+ {
955
+ if (text) {
956
+ CAT(tag, p);
957
+ ELE(sym_text);
958
+ text = false;
959
+ }
960
+ attr = runtime.getNil();
961
+ tag[0] = runtime.getNil();
962
+ mark_tag = -1;
963
+ ele_open = true;
964
+ }
965
+ break;
966
+ case 1:
967
+ // line 158 "ext/hpricot_scan/hpricot_scan.java.rl"
968
+ { mark_tag = p; }
969
+ break;
970
+ case 2:
971
+ // line 159 "ext/hpricot_scan/hpricot_scan.java.rl"
972
+ { mark_aval = p; }
973
+ break;
974
+ case 3:
975
+ // line 160 "ext/hpricot_scan/hpricot_scan.java.rl"
976
+ { mark_akey = p; }
977
+ break;
978
+ case 4:
979
+ // line 161 "ext/hpricot_scan/hpricot_scan.java.rl"
980
+ { SET(tag, p); }
981
+ break;
982
+ case 5:
983
+ // line 163 "ext/hpricot_scan/hpricot_scan.java.rl"
984
+ { SET(aval, p); }
985
+ break;
986
+ case 6:
987
+ // line 164 "ext/hpricot_scan/hpricot_scan.java.rl"
988
+ {
989
+ if (buf[p-1] == '"' || buf[p-1] == '\'') { SET(aval, p-1); }
990
+ else { SET(aval, p); }
991
+ }
992
+ break;
993
+ case 7:
994
+ // line 168 "ext/hpricot_scan/hpricot_scan.java.rl"
995
+ { SET(akey, p); }
996
+ break;
997
+ case 8:
998
+ // line 169 "ext/hpricot_scan/hpricot_scan.java.rl"
999
+ { SET(aval, p); ATTR(rb_str_new2("version"), aval); }
1000
+ break;
1001
+ case 9:
1002
+ // line 170 "ext/hpricot_scan/hpricot_scan.java.rl"
1003
+ { SET(aval, p); ATTR(rb_str_new2("encoding"), aval); }
1004
+ break;
1005
+ case 10:
1006
+ // line 171 "ext/hpricot_scan/hpricot_scan.java.rl"
1007
+ { SET(aval, p); ATTR(rb_str_new2("standalone"), aval); }
1008
+ break;
1009
+ case 11:
1010
+ // line 172 "ext/hpricot_scan/hpricot_scan.java.rl"
1011
+ { SET(aval, p); ATTR(rb_str_new2("public_id"), aval); }
1012
+ break;
1013
+ case 12:
1014
+ // line 173 "ext/hpricot_scan/hpricot_scan.java.rl"
1015
+ { SET(aval, p); ATTR(rb_str_new2("system_id"), aval); }
1016
+ break;
1017
+ case 13:
1018
+ // line 175 "ext/hpricot_scan/hpricot_scan.java.rl"
1019
+ {
1020
+ akey[0] = runtime.getNil();
1021
+ aval[0] = runtime.getNil();
1022
+ mark_akey = -1;
1023
+ mark_aval = -1;
1024
+ }
1025
+ break;
1026
+ case 14:
1027
+ // line 182 "ext/hpricot_scan/hpricot_scan.java.rl"
1028
+ {
1029
+ ATTR(akey, aval);
1030
+ }
1031
+ break;
1032
+ case 15:
1033
+ // line 9 "ext/hpricot_scan/hpricot_scan.java.rl"
1034
+ {curline += 1;}
1035
+ break;
1036
+ case 16:
1037
+ // line 46 "ext/hpricot_scan/hpricot_scan.java.rl"
1038
+ { TEXT_PASS(); }
1039
+ break;
1040
+ case 17:
1041
+ // line 50 "ext/hpricot_scan/hpricot_scan.java.rl"
1042
+ { EBLK(comment, 3); {cs = 204; _goto_targ = 2; if (true) continue _goto;} }
1043
+ break;
1044
+ case 18:
1045
+ // line 55 "ext/hpricot_scan/hpricot_scan.java.rl"
1046
+ { EBLK(cdata, 3); {cs = 204; _goto_targ = 2; if (true) continue _goto;} }
1047
+ break;
1048
+ case 19:
1049
+ // line 60 "ext/hpricot_scan/hpricot_scan.java.rl"
1050
+ { EBLK(procins, 2); {cs = 204; _goto_targ = 2; if (true) continue _goto;} }
1051
+ break;
1052
+ case 22:
1053
+ // line 1 "ext/hpricot_scan/hpricot_scan.java.rl"
1054
+ {te = p+1;}
1055
+ break;
1056
+ case 23:
1057
+ // line 50 "ext/hpricot_scan/hpricot_scan.java.rl"
1058
+ {te = p+1;}
1059
+ break;
1060
+ case 24:
1061
+ // line 51 "ext/hpricot_scan/hpricot_scan.java.rl"
1062
+ {te = p+1;{ TEXT_PASS(); }}
1063
+ break;
1064
+ case 25:
1065
+ // line 51 "ext/hpricot_scan/hpricot_scan.java.rl"
1066
+ {te = p;p--;{ TEXT_PASS(); }}
1067
+ break;
1068
+ case 26:
1069
+ // line 51 "ext/hpricot_scan/hpricot_scan.java.rl"
1070
+ {{p = ((te))-1;}{ TEXT_PASS(); }}
1071
+ break;
1072
+ case 27:
1073
+ // line 55 "ext/hpricot_scan/hpricot_scan.java.rl"
1074
+ {te = p+1;}
1075
+ break;
1076
+ case 28:
1077
+ // line 56 "ext/hpricot_scan/hpricot_scan.java.rl"
1078
+ {te = p+1;{ TEXT_PASS(); }}
1079
+ break;
1080
+ case 29:
1081
+ // line 56 "ext/hpricot_scan/hpricot_scan.java.rl"
1082
+ {te = p;p--;{ TEXT_PASS(); }}
1083
+ break;
1084
+ case 30:
1085
+ // line 56 "ext/hpricot_scan/hpricot_scan.java.rl"
1086
+ {{p = ((te))-1;}{ TEXT_PASS(); }}
1087
+ break;
1088
+ case 31:
1089
+ // line 60 "ext/hpricot_scan/hpricot_scan.java.rl"
1090
+ {te = p+1;}
1091
+ break;
1092
+ case 32:
1093
+ // line 61 "ext/hpricot_scan/hpricot_scan.java.rl"
1094
+ {te = p+1;{ TEXT_PASS(); }}
1095
+ break;
1096
+ case 33:
1097
+ // line 61 "ext/hpricot_scan/hpricot_scan.java.rl"
1098
+ {te = p;p--;{ TEXT_PASS(); }}
1099
+ break;
1100
+ case 34:
1101
+ // line 66 "ext/hpricot_scan/hpricot_scan.java.rl"
1102
+ {act = 8;}
1103
+ break;
1104
+ case 35:
1105
+ // line 68 "ext/hpricot_scan/hpricot_scan.java.rl"
1106
+ {act = 10;}
1107
+ break;
1108
+ case 36:
1109
+ // line 70 "ext/hpricot_scan/hpricot_scan.java.rl"
1110
+ {act = 12;}
1111
+ break;
1112
+ case 37:
1113
+ // line 73 "ext/hpricot_scan/hpricot_scan.java.rl"
1114
+ {act = 15;}
1115
+ break;
1116
+ case 38:
1117
+ // line 65 "ext/hpricot_scan/hpricot_scan.java.rl"
1118
+ {te = p+1;{ ELE(xmldecl); }}
1119
+ break;
1120
+ case 39:
1121
+ // line 66 "ext/hpricot_scan/hpricot_scan.java.rl"
1122
+ {te = p+1;{ ELE(doctype); }}
1123
+ break;
1124
+ case 40:
1125
+ // line 68 "ext/hpricot_scan/hpricot_scan.java.rl"
1126
+ {te = p+1;{ ELE(stag); }}
1127
+ break;
1128
+ case 41:
1129
+ // line 69 "ext/hpricot_scan/hpricot_scan.java.rl"
1130
+ {te = p+1;{ ELE(etag); }}
1131
+ break;
1132
+ case 42:
1133
+ // line 70 "ext/hpricot_scan/hpricot_scan.java.rl"
1134
+ {te = p+1;{ ELE(emptytag); }}
1135
+ break;
1136
+ case 43:
1137
+ // line 71 "ext/hpricot_scan/hpricot_scan.java.rl"
1138
+ {te = p+1;{ {cs = 214; _goto_targ = 2; if (true) continue _goto;} }}
1139
+ break;
1140
+ case 44:
1141
+ // line 72 "ext/hpricot_scan/hpricot_scan.java.rl"
1142
+ {te = p+1;{ {cs = 216; _goto_targ = 2; if (true) continue _goto;} }}
1143
+ break;
1144
+ case 45:
1145
+ // line 73 "ext/hpricot_scan/hpricot_scan.java.rl"
1146
+ {te = p+1;{ TEXT_PASS(); }}
1147
+ break;
1148
+ case 46:
1149
+ // line 66 "ext/hpricot_scan/hpricot_scan.java.rl"
1150
+ {te = p;p--;{ ELE(doctype); }}
1151
+ break;
1152
+ case 47:
1153
+ // line 67 "ext/hpricot_scan/hpricot_scan.java.rl"
1154
+ {te = p;p--;{ {cs = 218; _goto_targ = 2; if (true) continue _goto;} }}
1155
+ break;
1156
+ case 48:
1157
+ // line 73 "ext/hpricot_scan/hpricot_scan.java.rl"
1158
+ {te = p;p--;{ TEXT_PASS(); }}
1159
+ break;
1160
+ case 49:
1161
+ // line 67 "ext/hpricot_scan/hpricot_scan.java.rl"
1162
+ {{p = ((te))-1;}{ {cs = 218; _goto_targ = 2; if (true) continue _goto;} }}
1163
+ break;
1164
+ case 50:
1165
+ // line 73 "ext/hpricot_scan/hpricot_scan.java.rl"
1166
+ {{p = ((te))-1;}{ TEXT_PASS(); }}
1167
+ break;
1168
+ case 51:
1169
+ // line 1 "ext/hpricot_scan/hpricot_scan.java.rl"
1170
+ { switch( act ) {
1171
+ case 8:
1172
+ {{p = ((te))-1;} ELE(doctype); }
1173
+ break;
1174
+ case 10:
1175
+ {{p = ((te))-1;} ELE(stag); }
1176
+ break;
1177
+ case 12:
1178
+ {{p = ((te))-1;} ELE(emptytag); }
1179
+ break;
1180
+ case 15:
1181
+ {{p = ((te))-1;} TEXT_PASS(); }
1182
+ break;
1183
+ default: break;
1184
+ }
1185
+ }
1186
+ break;
1187
+ // line 1188 "ext/hpricot_scan/hpricot_scan.java.java"
1188
+ }
1189
+ }
1190
+ }
1191
+
1192
+ case 2:
1193
+ _acts = _hpricot_scan_to_state_actions[cs];
1194
+ _nacts = (int) _hpricot_scan_actions[_acts++];
1195
+ while ( _nacts-- > 0 ) {
1196
+ switch ( _hpricot_scan_actions[_acts++] ) {
1197
+ case 20:
1198
+ // line 1 "ext/hpricot_scan/hpricot_scan.java.rl"
1199
+ {ts = -1;}
1200
+ break;
1201
+ // line 1202 "ext/hpricot_scan/hpricot_scan.java.java"
1202
+ }
1203
+ }
1204
+
1205
+ if ( ++p != pe ) {
1206
+ _goto_targ = 1;
1207
+ continue _goto;
1208
+ }
1209
+ case 4:
1210
+ if ( p == eof )
1211
+ {
1212
+ if ( _hpricot_scan_eof_trans[cs] > 0 ) {
1213
+ _trans = _hpricot_scan_eof_trans[cs] - 1;
1214
+ _goto_targ = 3;
1215
+ continue _goto;
1216
+ }
1217
+ }
1218
+
1219
+ case 5:
1220
+ }
1221
+ break; }
1222
+ }
1223
+ // line 291 "ext/hpricot_scan/hpricot_scan.java.rl"
1224
+
1225
+ if ( cs == hpricot_scan_error ) {
1226
+ if(!tag[0].isNil()) {
1227
+ rb_raise(rb_eHpricotParseError, "parse error on element <"+tag.toString()+">, starting on line "+curline+".\n" + NO_WAY_SERIOUSLY);
1228
+ } else {
1229
+ rb_raise(rb_eHpricotParseError, "parse error on line "+curline+".\n" + NO_WAY_SERIOUSLY);
1230
+ }
1231
+ }
1232
+
1233
+ if ( done && ele_open ) {
1234
+ ele_open = false;
1235
+ if(tokstart > -1) {
1236
+ mark_tag = tokstart;
1237
+ tokstart = -1;
1238
+ text = true;
1239
+ }
1240
+ }
1241
+
1242
+ if(tokstart == -1) {
1243
+ have = 0;
1244
+ /* text nodes have no tokstart because each byte is parsed alone */
1245
+ if(mark_tag != -1 && text) {
1246
+ if (done) {
1247
+ if(mark_tag < p-1) {
1248
+ CAT(tag, p-1);
1249
+ ELE(sym_text);
1250
+ }
1251
+ } else {
1252
+ CAT(tag, p);
1253
+ }
1254
+ }
1255
+ mark_tag = 0;
1256
+ } else {
1257
+ have = pe - tokstart;
1258
+ System.arraycopy(buf,tokstart,buf,0,have);
1259
+ SLIDE(tag);
1260
+ SLIDE(akey);
1261
+ SLIDE(aval);
1262
+ tokend = (tokend - tokstart);
1263
+ tokstart = 0;
1264
+ }
1265
+ }
1266
+ return runtime.getNil();
1267
+ }
1268
+
1269
+ public static IRubyObject __hpricot_scan(IRubyObject recv, IRubyObject port, Block block) {
1270
+ Ruby runtime = recv.getRuntime();
1271
+ HpricotScanService service = new HpricotScanService();
1272
+ service.runtime = runtime;
1273
+ service.xmldecl = runtime.newSymbol("xmldecl");
1274
+ service.doctype = runtime.newSymbol("doctype");
1275
+ service.procins = runtime.newSymbol("procins");
1276
+ service.stag = runtime.newSymbol("stag");
1277
+ service.etag = runtime.newSymbol("etag");
1278
+ service.emptytag = runtime.newSymbol("emptytag");
1279
+ service.comment = runtime.newSymbol("comment");
1280
+ service.cdata = runtime.newSymbol("cdata");
1281
+ service.sym_text = runtime.newSymbol("text");
1282
+ service.block = block;
1283
+ return service.hpricot_scan(recv, port);
1284
+ }
1285
+
1286
+
1287
+ public boolean basicLoad(final Ruby runtime) throws IOException {
1288
+ Init_hpricot_scan(runtime);
1289
+ return true;
1290
+ }
1291
+
1292
+ public static void Init_hpricot_scan(Ruby runtime) {
1293
+ RubyModule mHpricot = runtime.defineModule("Hpricot");
1294
+ mHpricot.getMetaClass().attr_accessor(new IRubyObject[]{runtime.newSymbol("buffer_size")});
1295
+ CallbackFactory fact = runtime.callbackFactory(HpricotScanService.class);
1296
+ mHpricot.getMetaClass().defineMethod("scan",fact.getSingletonMethod("__hpricot_scan",IRubyObject.class));
1297
+ mHpricot.defineClassUnder("ParseError",runtime.getClass("Exception"),runtime.getClass("Exception").getAllocator());
1298
+ rubyApi = JavaEmbedUtils.newObjectAdapter();
1299
+ }
1300
+ }