oga 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +13 -0
  3. data/LICENSE +19 -0
  4. data/README.md +171 -0
  5. data/doc/DCO.md +25 -0
  6. data/doc/changelog.md +7 -0
  7. data/doc/css/common.css +76 -0
  8. data/doc/migrating_from_nokogiri.md +169 -0
  9. data/ext/c/extconf.rb +13 -0
  10. data/ext/c/lexer.c +1518 -0
  11. data/ext/c/lexer.h +8 -0
  12. data/ext/c/lexer.rl +121 -0
  13. data/ext/c/liboga.c +6 -0
  14. data/ext/c/liboga.h +11 -0
  15. data/ext/java/Liboga.java +14 -0
  16. data/ext/java/org/liboga/xml/Lexer.java +829 -0
  17. data/ext/java/org/liboga/xml/Lexer.rl +151 -0
  18. data/ext/ragel/base_lexer.rl +323 -0
  19. data/lib/oga.rb +43 -0
  20. data/lib/oga/html/parser.rb +25 -0
  21. data/lib/oga/oga.rb +27 -0
  22. data/lib/oga/version.rb +3 -0
  23. data/lib/oga/xml/attribute.rb +111 -0
  24. data/lib/oga/xml/cdata.rb +24 -0
  25. data/lib/oga/xml/character_node.rb +39 -0
  26. data/lib/oga/xml/comment.rb +24 -0
  27. data/lib/oga/xml/doctype.rb +91 -0
  28. data/lib/oga/xml/document.rb +99 -0
  29. data/lib/oga/xml/element.rb +340 -0
  30. data/lib/oga/xml/lexer.rb +399 -0
  31. data/lib/oga/xml/namespace.rb +42 -0
  32. data/lib/oga/xml/node.rb +175 -0
  33. data/lib/oga/xml/node_set.rb +313 -0
  34. data/lib/oga/xml/parser.rb +556 -0
  35. data/lib/oga/xml/processing_instruction.rb +39 -0
  36. data/lib/oga/xml/pull_parser.rb +166 -0
  37. data/lib/oga/xml/querying.rb +32 -0
  38. data/lib/oga/xml/text.rb +16 -0
  39. data/lib/oga/xml/traversal.rb +48 -0
  40. data/lib/oga/xml/xml_declaration.rb +76 -0
  41. data/lib/oga/xpath/evaluator.rb +1748 -0
  42. data/lib/oga/xpath/lexer.rb +2043 -0
  43. data/lib/oga/xpath/node.rb +10 -0
  44. data/lib/oga/xpath/parser.rb +535 -0
  45. data/oga.gemspec +45 -0
  46. metadata +221 -0
@@ -0,0 +1,13 @@
1
+ require 'mkmf'
2
+
3
+ have_header('ruby.h')
4
+
5
+ $CFLAGS << ' -Wextra -Wall -pedantic'
6
+
7
+ if ENV['DEBUG']
8
+ $CFLAGS << ' -O0 -g'
9
+ else
10
+ $CFLAGS << ' -O3'
11
+ end
12
+
13
+ create_makefile('liboga')
@@ -0,0 +1,1518 @@
1
+
2
+ #line 1 "ext/c/lexer.rl"
3
+ #include "lexer.h"
4
+
5
+ /*
6
+ The following two macros allow the Ragel grammar to use generic function calls
7
+ without relying on the setup of the C or Java lexer. Using these macros we can
8
+ also pass along `self` to the callback functions without having to hard-code
9
+ this in to the Ragel grammar.
10
+
11
+ In the C lexer we don't need the `data` variable (since this is pulled in based
12
+ on `ts` and `te`) so the macro ignores this argument.
13
+ */
14
+
15
+ #define callback(name, data, encoding, start, stop) \
16
+ liboga_xml_lexer_callback(self, name, encoding, start, stop);
17
+
18
+ #define callback_simple(name) \
19
+ liboga_xml_lexer_callback_simple(self, name);
20
+
21
+ #define oga_ivar_get(owner, name) \
22
+ rb_ivar_get(owner, rb_intern(name))
23
+
24
+ #define oga_ivar_set(owner, name, value) \
25
+ rb_ivar_set(owner, rb_intern(name), value)
26
+
27
+
28
+ #line 26 "ext/c/lexer.rl"
29
+
30
+ /**
31
+ * Calls a method defined in the Ruby side of the lexer. The String value is
32
+ * created based on the values of `ts` and `te` and uses the encoding specified
33
+ * in `encoding`.
34
+ *
35
+ * @example
36
+ * rb_encoding *encoding = rb_enc_get(...);
37
+ * liboga_xml_lexer_callback(self, "on_string", encoding, ts, te);
38
+ */
39
+ void liboga_xml_lexer_callback(
40
+ VALUE self,
41
+ const char *name,
42
+ rb_encoding *encoding,
43
+ const char *ts,
44
+ const char *te
45
+ )
46
+ {
47
+ VALUE value = rb_enc_str_new(ts, te - ts, encoding);
48
+ VALUE method = rb_intern(name);
49
+
50
+ rb_funcall(self, method, 1, value);
51
+ }
52
+
53
+ /**
54
+ * Calls a method defined in the Ruby side of the lexer without passing it any
55
+ * arguments.
56
+ *
57
+ * @example
58
+ * liboga_xml_lexer_callback_simple(self, "on_cdata_start");
59
+ */
60
+ void liboga_xml_lexer_callback_simple(VALUE self, const char *name)
61
+ {
62
+ VALUE method = rb_intern(name);
63
+
64
+ rb_funcall(self, method, 0);
65
+ }
66
+
67
+
68
+ #line 69 "ext/c/lexer.c"
69
+ static const int c_lexer_start = 35;
70
+ static const int c_lexer_first_final = 35;
71
+ static const int c_lexer_error = 0;
72
+
73
+ static const int c_lexer_en_proc_ins_body = 41;
74
+ static const int c_lexer_en_doctype = 43;
75
+ static const int c_lexer_en_xml_decl = 55;
76
+ static const int c_lexer_en_element_name = 60;
77
+ static const int c_lexer_en_element_head = 62;
78
+ static const int c_lexer_en_text = 64;
79
+ static const int c_lexer_en_main = 35;
80
+
81
+
82
+ #line 65 "ext/c/lexer.rl"
83
+
84
+ /**
85
+ * Lexes the String specifies as the method argument. Token values have the
86
+ * same encoding as the input value.
87
+ *
88
+ * This method keeps track of an internal state using the instance variables
89
+ * `@act` and `@cs`.
90
+ */
91
+ VALUE oga_xml_lexer_advance(VALUE self, VALUE data_block)
92
+ {
93
+ /* Make sure that all data passed back to Ruby has the proper encoding. */
94
+ rb_encoding *encoding = rb_enc_get(data_block);
95
+
96
+ char *data_str_val = StringValuePtr(data_block);
97
+
98
+ const char *p = data_str_val;
99
+ const char *pe = data_str_val + strlen(data_str_val);
100
+ const char *eof = pe;
101
+ const char *ts = 0;
102
+ const char *te = 0;
103
+ const char *mark = 0;
104
+
105
+ int act = NUM2INT(oga_ivar_get(self, "@act"));
106
+ int cs = NUM2INT(oga_ivar_get(self, "@cs"));
107
+
108
+
109
+ #line 110 "ext/c/lexer.c"
110
+ {
111
+ if ( p == pe )
112
+ goto _test_eof;
113
+ goto _resume;
114
+
115
+ _again:
116
+ switch ( cs ) {
117
+ case 35: goto st35;
118
+ case 36: goto st36;
119
+ case 1: goto st1;
120
+ case 2: goto st2;
121
+ case 3: goto st3;
122
+ case 4: goto st4;
123
+ case 5: goto st5;
124
+ case 6: goto st6;
125
+ case 7: goto st7;
126
+ case 8: goto st8;
127
+ case 9: goto st9;
128
+ case 10: goto st10;
129
+ case 11: goto st11;
130
+ case 12: goto st12;
131
+ case 37: goto st37;
132
+ case 13: goto st13;
133
+ case 14: goto st14;
134
+ case 15: goto st15;
135
+ case 16: goto st16;
136
+ case 17: goto st17;
137
+ case 18: goto st18;
138
+ case 19: goto st19;
139
+ case 20: goto st20;
140
+ case 21: goto st21;
141
+ case 22: goto st22;
142
+ case 23: goto st23;
143
+ case 24: goto st24;
144
+ case 38: goto st38;
145
+ case 39: goto st39;
146
+ case 40: goto st40;
147
+ case 41: goto st41;
148
+ case 42: goto st42;
149
+ case 43: goto st43;
150
+ case 0: goto st0;
151
+ case 25: goto st25;
152
+ case 26: goto st26;
153
+ case 44: goto st44;
154
+ case 45: goto st45;
155
+ case 46: goto st46;
156
+ case 47: goto st47;
157
+ case 48: goto st48;
158
+ case 49: goto st49;
159
+ case 50: goto st50;
160
+ case 51: goto st51;
161
+ case 52: goto st52;
162
+ case 53: goto st53;
163
+ case 54: goto st54;
164
+ case 27: goto st27;
165
+ case 28: goto st28;
166
+ case 55: goto st55;
167
+ case 56: goto st56;
168
+ case 29: goto st29;
169
+ case 57: goto st57;
170
+ case 30: goto st30;
171
+ case 58: goto st58;
172
+ case 59: goto st59;
173
+ case 60: goto st60;
174
+ case 61: goto st61;
175
+ case 62: goto st62;
176
+ case 31: goto st31;
177
+ case 32: goto st32;
178
+ case 33: goto st33;
179
+ case 63: goto st63;
180
+ case 34: goto st34;
181
+ case 64: goto st64;
182
+ case 65: goto st65;
183
+ case 66: goto st66;
184
+ default: break;
185
+ }
186
+
187
+ if ( ++p == pe )
188
+ goto _test_eof;
189
+ _resume:
190
+ switch ( cs )
191
+ {
192
+ tr0:
193
+ cs = 35;
194
+ #line 280 "ext/ragel/base_lexer.rl"
195
+ {{p = ((te))-1;}{
196
+ p--;
197
+ cs = 64;
198
+ }}
199
+ goto _again;
200
+ tr7:
201
+ #line 56 "ext/ragel/base_lexer.rl"
202
+ {te = p+1;{
203
+ callback("on_comment", data, encoding, ts + 4, te - 3);
204
+ }}
205
+ goto st35;
206
+ tr23:
207
+ #line 72 "ext/ragel/base_lexer.rl"
208
+ {te = p+1;{
209
+ callback("on_cdata", data, encoding, ts + 9, te - 3);
210
+ }}
211
+ goto st35;
212
+ tr26:
213
+ #line 222 "ext/ragel/base_lexer.rl"
214
+ {te = p+1;{
215
+ callback_simple("on_element_end");
216
+ }}
217
+ goto st35;
218
+ tr44:
219
+ cs = 35;
220
+ #line 280 "ext/ragel/base_lexer.rl"
221
+ {te = p+1;{
222
+ p--;
223
+ cs = 64;
224
+ }}
225
+ goto _again;
226
+ tr46:
227
+ cs = 35;
228
+ #line 280 "ext/ragel/base_lexer.rl"
229
+ {te = p;p--;{
230
+ p--;
231
+ cs = 64;
232
+ }}
233
+ goto _again;
234
+ tr48:
235
+ cs = 35;
236
+ #line 216 "ext/ragel/base_lexer.rl"
237
+ {te = p+1;{
238
+ callback_simple("on_element_start");
239
+ p--;
240
+ cs = 60;
241
+ }}
242
+ goto _again;
243
+ tr50:
244
+ cs = 35;
245
+ #line 140 "ext/ragel/base_lexer.rl"
246
+ {te = p;p--;{
247
+ callback_simple("on_doctype_start");
248
+ cs = 43;
249
+ }}
250
+ goto _again;
251
+ tr51:
252
+ cs = 35;
253
+ #line 1 "NONE"
254
+ { switch( act ) {
255
+ case 25:
256
+ {{p = ((te))-1;}
257
+ callback_simple("on_xml_decl_start");
258
+ cs = 55;
259
+ }
260
+ break;
261
+ case 28:
262
+ {{p = ((te))-1;}
263
+ callback_simple("on_proc_ins_start");
264
+ callback("on_proc_ins_name", data, encoding, ts + 2, te);
265
+
266
+ mark = te;
267
+
268
+ cs = 41;
269
+ }
270
+ break;
271
+ }
272
+ }
273
+ goto _again;
274
+ tr52:
275
+ cs = 35;
276
+ #line 90 "ext/ragel/base_lexer.rl"
277
+ {te = p;p--;{
278
+ callback_simple("on_proc_ins_start");
279
+ callback("on_proc_ins_name", data, encoding, ts + 2, te);
280
+
281
+ mark = te;
282
+
283
+ cs = 41;
284
+ }}
285
+ goto _again;
286
+ st35:
287
+ #line 1 "NONE"
288
+ {ts = 0;}
289
+ if ( ++p == pe )
290
+ goto _test_eof35;
291
+ case 35:
292
+ #line 1 "NONE"
293
+ {ts = p;}
294
+ #line 295 "ext/c/lexer.c"
295
+ if ( (*p) == 60 )
296
+ goto tr45;
297
+ goto tr44;
298
+ tr45:
299
+ #line 1 "NONE"
300
+ {te = p+1;}
301
+ goto st36;
302
+ st36:
303
+ if ( ++p == pe )
304
+ goto _test_eof36;
305
+ case 36:
306
+ #line 307 "ext/c/lexer.c"
307
+ switch( (*p) ) {
308
+ case 33: goto st1;
309
+ case 45: goto tr48;
310
+ case 47: goto st22;
311
+ case 63: goto st24;
312
+ case 95: goto tr48;
313
+ }
314
+ if ( (*p) < 65 ) {
315
+ if ( 48 <= (*p) && (*p) <= 57 )
316
+ goto tr48;
317
+ } else if ( (*p) > 90 ) {
318
+ if ( 97 <= (*p) && (*p) <= 122 )
319
+ goto tr48;
320
+ } else
321
+ goto tr48;
322
+ goto tr46;
323
+ st1:
324
+ if ( ++p == pe )
325
+ goto _test_eof1;
326
+ case 1:
327
+ switch( (*p) ) {
328
+ case 45: goto st2;
329
+ case 68: goto st6;
330
+ case 91: goto st13;
331
+ case 100: goto st6;
332
+ }
333
+ goto tr0;
334
+ st2:
335
+ if ( ++p == pe )
336
+ goto _test_eof2;
337
+ case 2:
338
+ if ( (*p) == 45 )
339
+ goto st3;
340
+ goto tr0;
341
+ st3:
342
+ if ( ++p == pe )
343
+ goto _test_eof3;
344
+ case 3:
345
+ if ( (*p) == 45 )
346
+ goto st4;
347
+ goto st3;
348
+ st4:
349
+ if ( ++p == pe )
350
+ goto _test_eof4;
351
+ case 4:
352
+ if ( (*p) == 45 )
353
+ goto st5;
354
+ goto st3;
355
+ st5:
356
+ if ( ++p == pe )
357
+ goto _test_eof5;
358
+ case 5:
359
+ switch( (*p) ) {
360
+ case 45: goto st5;
361
+ case 62: goto tr7;
362
+ }
363
+ goto st3;
364
+ st6:
365
+ if ( ++p == pe )
366
+ goto _test_eof6;
367
+ case 6:
368
+ switch( (*p) ) {
369
+ case 79: goto st7;
370
+ case 111: goto st7;
371
+ }
372
+ goto tr0;
373
+ st7:
374
+ if ( ++p == pe )
375
+ goto _test_eof7;
376
+ case 7:
377
+ switch( (*p) ) {
378
+ case 67: goto st8;
379
+ case 99: goto st8;
380
+ }
381
+ goto tr0;
382
+ st8:
383
+ if ( ++p == pe )
384
+ goto _test_eof8;
385
+ case 8:
386
+ switch( (*p) ) {
387
+ case 84: goto st9;
388
+ case 116: goto st9;
389
+ }
390
+ goto tr0;
391
+ st9:
392
+ if ( ++p == pe )
393
+ goto _test_eof9;
394
+ case 9:
395
+ switch( (*p) ) {
396
+ case 89: goto st10;
397
+ case 121: goto st10;
398
+ }
399
+ goto tr0;
400
+ st10:
401
+ if ( ++p == pe )
402
+ goto _test_eof10;
403
+ case 10:
404
+ switch( (*p) ) {
405
+ case 80: goto st11;
406
+ case 112: goto st11;
407
+ }
408
+ goto tr0;
409
+ st11:
410
+ if ( ++p == pe )
411
+ goto _test_eof11;
412
+ case 11:
413
+ switch( (*p) ) {
414
+ case 69: goto st12;
415
+ case 101: goto st12;
416
+ }
417
+ goto tr0;
418
+ st12:
419
+ if ( ++p == pe )
420
+ goto _test_eof12;
421
+ case 12:
422
+ switch( (*p) ) {
423
+ case 9: goto st37;
424
+ case 32: goto st37;
425
+ }
426
+ goto tr0;
427
+ st37:
428
+ if ( ++p == pe )
429
+ goto _test_eof37;
430
+ case 37:
431
+ switch( (*p) ) {
432
+ case 9: goto st37;
433
+ case 32: goto st37;
434
+ }
435
+ goto tr50;
436
+ st13:
437
+ if ( ++p == pe )
438
+ goto _test_eof13;
439
+ case 13:
440
+ if ( (*p) == 67 )
441
+ goto st14;
442
+ goto tr0;
443
+ st14:
444
+ if ( ++p == pe )
445
+ goto _test_eof14;
446
+ case 14:
447
+ if ( (*p) == 68 )
448
+ goto st15;
449
+ goto tr0;
450
+ st15:
451
+ if ( ++p == pe )
452
+ goto _test_eof15;
453
+ case 15:
454
+ if ( (*p) == 65 )
455
+ goto st16;
456
+ goto tr0;
457
+ st16:
458
+ if ( ++p == pe )
459
+ goto _test_eof16;
460
+ case 16:
461
+ if ( (*p) == 84 )
462
+ goto st17;
463
+ goto tr0;
464
+ st17:
465
+ if ( ++p == pe )
466
+ goto _test_eof17;
467
+ case 17:
468
+ if ( (*p) == 65 )
469
+ goto st18;
470
+ goto tr0;
471
+ st18:
472
+ if ( ++p == pe )
473
+ goto _test_eof18;
474
+ case 18:
475
+ if ( (*p) == 91 )
476
+ goto st19;
477
+ goto tr0;
478
+ st19:
479
+ if ( ++p == pe )
480
+ goto _test_eof19;
481
+ case 19:
482
+ if ( (*p) == 93 )
483
+ goto st20;
484
+ goto st19;
485
+ st20:
486
+ if ( ++p == pe )
487
+ goto _test_eof20;
488
+ case 20:
489
+ if ( (*p) == 93 )
490
+ goto st21;
491
+ goto st19;
492
+ st21:
493
+ if ( ++p == pe )
494
+ goto _test_eof21;
495
+ case 21:
496
+ switch( (*p) ) {
497
+ case 62: goto tr23;
498
+ case 93: goto st21;
499
+ }
500
+ goto st19;
501
+ st22:
502
+ if ( ++p == pe )
503
+ goto _test_eof22;
504
+ case 22:
505
+ switch( (*p) ) {
506
+ case 45: goto st23;
507
+ case 95: goto st23;
508
+ }
509
+ if ( (*p) < 65 ) {
510
+ if ( 48 <= (*p) && (*p) <= 57 )
511
+ goto st23;
512
+ } else if ( (*p) > 90 ) {
513
+ if ( 97 <= (*p) && (*p) <= 122 )
514
+ goto st23;
515
+ } else
516
+ goto st23;
517
+ goto tr0;
518
+ st23:
519
+ if ( ++p == pe )
520
+ goto _test_eof23;
521
+ case 23:
522
+ switch( (*p) ) {
523
+ case 45: goto st23;
524
+ case 58: goto st22;
525
+ case 62: goto tr26;
526
+ case 95: goto st23;
527
+ }
528
+ if ( (*p) < 65 ) {
529
+ if ( 48 <= (*p) && (*p) <= 57 )
530
+ goto st23;
531
+ } else if ( (*p) > 90 ) {
532
+ if ( 97 <= (*p) && (*p) <= 122 )
533
+ goto st23;
534
+ } else
535
+ goto st23;
536
+ goto tr0;
537
+ st24:
538
+ if ( ++p == pe )
539
+ goto _test_eof24;
540
+ case 24:
541
+ switch( (*p) ) {
542
+ case 45: goto tr27;
543
+ case 95: goto tr27;
544
+ case 120: goto st39;
545
+ }
546
+ if ( (*p) < 65 ) {
547
+ if ( 48 <= (*p) && (*p) <= 57 )
548
+ goto tr27;
549
+ } else if ( (*p) > 90 ) {
550
+ if ( 97 <= (*p) && (*p) <= 122 )
551
+ goto tr27;
552
+ } else
553
+ goto tr27;
554
+ goto tr0;
555
+ tr27:
556
+ #line 1 "NONE"
557
+ {te = p+1;}
558
+ #line 90 "ext/ragel/base_lexer.rl"
559
+ {act = 28;}
560
+ goto st38;
561
+ tr54:
562
+ #line 1 "NONE"
563
+ {te = p+1;}
564
+ #line 182 "ext/ragel/base_lexer.rl"
565
+ {act = 25;}
566
+ goto st38;
567
+ st38:
568
+ if ( ++p == pe )
569
+ goto _test_eof38;
570
+ case 38:
571
+ #line 572 "ext/c/lexer.c"
572
+ switch( (*p) ) {
573
+ case 45: goto tr27;
574
+ case 95: goto tr27;
575
+ }
576
+ if ( (*p) < 65 ) {
577
+ if ( 48 <= (*p) && (*p) <= 57 )
578
+ goto tr27;
579
+ } else if ( (*p) > 90 ) {
580
+ if ( 97 <= (*p) && (*p) <= 122 )
581
+ goto tr27;
582
+ } else
583
+ goto tr27;
584
+ goto tr51;
585
+ st39:
586
+ if ( ++p == pe )
587
+ goto _test_eof39;
588
+ case 39:
589
+ switch( (*p) ) {
590
+ case 45: goto tr27;
591
+ case 95: goto tr27;
592
+ case 109: goto st40;
593
+ }
594
+ if ( (*p) < 65 ) {
595
+ if ( 48 <= (*p) && (*p) <= 57 )
596
+ goto tr27;
597
+ } else if ( (*p) > 90 ) {
598
+ if ( 97 <= (*p) && (*p) <= 122 )
599
+ goto tr27;
600
+ } else
601
+ goto tr27;
602
+ goto tr52;
603
+ st40:
604
+ if ( ++p == pe )
605
+ goto _test_eof40;
606
+ case 40:
607
+ switch( (*p) ) {
608
+ case 45: goto tr27;
609
+ case 95: goto tr27;
610
+ case 108: goto tr54;
611
+ }
612
+ if ( (*p) < 65 ) {
613
+ if ( 48 <= (*p) && (*p) <= 57 )
614
+ goto tr27;
615
+ } else if ( (*p) > 90 ) {
616
+ if ( 97 <= (*p) && (*p) <= 122 )
617
+ goto tr27;
618
+ } else
619
+ goto tr27;
620
+ goto tr52;
621
+ tr55:
622
+ #line 107 "ext/ragel/base_lexer.rl"
623
+ {te = p+1;}
624
+ goto st41;
625
+ tr57:
626
+ #line 107 "ext/ragel/base_lexer.rl"
627
+ {te = p;p--;}
628
+ goto st41;
629
+ tr58:
630
+ cs = 41;
631
+ #line 100 "ext/ragel/base_lexer.rl"
632
+ {te = p+1;{
633
+ callback("on_text", data, encoding, mark, ts);
634
+ callback_simple("on_proc_ins_end");
635
+
636
+ cs = 35;
637
+ }}
638
+ goto _again;
639
+ st41:
640
+ #line 1 "NONE"
641
+ {ts = 0;}
642
+ if ( ++p == pe )
643
+ goto _test_eof41;
644
+ case 41:
645
+ #line 1 "NONE"
646
+ {ts = p;}
647
+ #line 648 "ext/c/lexer.c"
648
+ if ( (*p) == 63 )
649
+ goto st42;
650
+ goto tr55;
651
+ st42:
652
+ if ( ++p == pe )
653
+ goto _test_eof42;
654
+ case 42:
655
+ if ( (*p) == 62 )
656
+ goto tr58;
657
+ goto tr57;
658
+ tr30:
659
+ #line 124 "ext/ragel/base_lexer.rl"
660
+ {te = p+1;{
661
+ callback("on_string", data, encoding, ts + 1, te - 1);
662
+ }}
663
+ goto st43;
664
+ tr33:
665
+ #line 154 "ext/ragel/base_lexer.rl"
666
+ {te = p+1;{
667
+ callback("on_doctype_inline", data, encoding, ts + 1, te - 1);
668
+ }}
669
+ goto st43;
670
+ tr59:
671
+ #line 163 "ext/ragel/base_lexer.rl"
672
+ {te = p+1;}
673
+ goto st43;
674
+ tr61:
675
+ cs = 43;
676
+ #line 169 "ext/ragel/base_lexer.rl"
677
+ {te = p+1;{
678
+ callback_simple("on_doctype_end");
679
+ cs = 35;
680
+ }}
681
+ goto _again;
682
+ tr65:
683
+ #line 1 "NONE"
684
+ { switch( act ) {
685
+ case 3:
686
+ {{p = ((te))-1;}
687
+ callback("on_doctype_type", data, encoding, ts, te);
688
+ }
689
+ break;
690
+ case 7:
691
+ {{p = ((te))-1;}
692
+ callback("on_doctype_name", data, encoding, ts, te);
693
+ }
694
+ break;
695
+ }
696
+ }
697
+ goto st43;
698
+ tr66:
699
+ #line 165 "ext/ragel/base_lexer.rl"
700
+ {te = p;p--;{
701
+ callback("on_doctype_name", data, encoding, ts, te);
702
+ }}
703
+ goto st43;
704
+ st43:
705
+ #line 1 "NONE"
706
+ {ts = 0;}
707
+ if ( ++p == pe )
708
+ goto _test_eof43;
709
+ case 43:
710
+ #line 1 "NONE"
711
+ {ts = p;}
712
+ #line 713 "ext/c/lexer.c"
713
+ switch( (*p) ) {
714
+ case 9: goto tr59;
715
+ case 32: goto tr59;
716
+ case 34: goto st25;
717
+ case 39: goto st26;
718
+ case 45: goto tr60;
719
+ case 62: goto tr61;
720
+ case 80: goto st45;
721
+ case 83: goto st50;
722
+ case 91: goto st27;
723
+ case 95: goto tr60;
724
+ }
725
+ if ( (*p) < 65 ) {
726
+ if ( 48 <= (*p) && (*p) <= 57 )
727
+ goto tr60;
728
+ } else if ( (*p) > 90 ) {
729
+ if ( 97 <= (*p) && (*p) <= 122 )
730
+ goto tr60;
731
+ } else
732
+ goto tr60;
733
+ goto st0;
734
+ st0:
735
+ cs = 0;
736
+ goto _out;
737
+ st25:
738
+ if ( ++p == pe )
739
+ goto _test_eof25;
740
+ case 25:
741
+ if ( (*p) == 34 )
742
+ goto tr30;
743
+ goto st25;
744
+ st26:
745
+ if ( ++p == pe )
746
+ goto _test_eof26;
747
+ case 26:
748
+ if ( (*p) == 39 )
749
+ goto tr30;
750
+ goto st26;
751
+ tr60:
752
+ #line 1 "NONE"
753
+ {te = p+1;}
754
+ #line 165 "ext/ragel/base_lexer.rl"
755
+ {act = 7;}
756
+ goto st44;
757
+ tr71:
758
+ #line 1 "NONE"
759
+ {te = p+1;}
760
+ #line 148 "ext/ragel/base_lexer.rl"
761
+ {act = 3;}
762
+ goto st44;
763
+ st44:
764
+ if ( ++p == pe )
765
+ goto _test_eof44;
766
+ case 44:
767
+ #line 768 "ext/c/lexer.c"
768
+ switch( (*p) ) {
769
+ case 45: goto tr60;
770
+ case 95: goto tr60;
771
+ }
772
+ if ( (*p) < 65 ) {
773
+ if ( 48 <= (*p) && (*p) <= 57 )
774
+ goto tr60;
775
+ } else if ( (*p) > 90 ) {
776
+ if ( 97 <= (*p) && (*p) <= 122 )
777
+ goto tr60;
778
+ } else
779
+ goto tr60;
780
+ goto tr65;
781
+ st45:
782
+ if ( ++p == pe )
783
+ goto _test_eof45;
784
+ case 45:
785
+ switch( (*p) ) {
786
+ case 45: goto tr60;
787
+ case 85: goto st46;
788
+ case 95: goto tr60;
789
+ }
790
+ if ( (*p) < 65 ) {
791
+ if ( 48 <= (*p) && (*p) <= 57 )
792
+ goto tr60;
793
+ } else if ( (*p) > 90 ) {
794
+ if ( 97 <= (*p) && (*p) <= 122 )
795
+ goto tr60;
796
+ } else
797
+ goto tr60;
798
+ goto tr66;
799
+ st46:
800
+ if ( ++p == pe )
801
+ goto _test_eof46;
802
+ case 46:
803
+ switch( (*p) ) {
804
+ case 45: goto tr60;
805
+ case 66: goto st47;
806
+ case 95: goto tr60;
807
+ }
808
+ if ( (*p) < 65 ) {
809
+ if ( 48 <= (*p) && (*p) <= 57 )
810
+ goto tr60;
811
+ } else if ( (*p) > 90 ) {
812
+ if ( 97 <= (*p) && (*p) <= 122 )
813
+ goto tr60;
814
+ } else
815
+ goto tr60;
816
+ goto tr66;
817
+ st47:
818
+ if ( ++p == pe )
819
+ goto _test_eof47;
820
+ case 47:
821
+ switch( (*p) ) {
822
+ case 45: goto tr60;
823
+ case 76: goto st48;
824
+ case 95: goto tr60;
825
+ }
826
+ if ( (*p) < 65 ) {
827
+ if ( 48 <= (*p) && (*p) <= 57 )
828
+ goto tr60;
829
+ } else if ( (*p) > 90 ) {
830
+ if ( 97 <= (*p) && (*p) <= 122 )
831
+ goto tr60;
832
+ } else
833
+ goto tr60;
834
+ goto tr66;
835
+ st48:
836
+ if ( ++p == pe )
837
+ goto _test_eof48;
838
+ case 48:
839
+ switch( (*p) ) {
840
+ case 45: goto tr60;
841
+ case 73: goto st49;
842
+ case 95: goto tr60;
843
+ }
844
+ if ( (*p) < 65 ) {
845
+ if ( 48 <= (*p) && (*p) <= 57 )
846
+ goto tr60;
847
+ } else if ( (*p) > 90 ) {
848
+ if ( 97 <= (*p) && (*p) <= 122 )
849
+ goto tr60;
850
+ } else
851
+ goto tr60;
852
+ goto tr66;
853
+ st49:
854
+ if ( ++p == pe )
855
+ goto _test_eof49;
856
+ case 49:
857
+ switch( (*p) ) {
858
+ case 45: goto tr60;
859
+ case 67: goto tr71;
860
+ case 95: goto tr60;
861
+ }
862
+ if ( (*p) < 65 ) {
863
+ if ( 48 <= (*p) && (*p) <= 57 )
864
+ goto tr60;
865
+ } else if ( (*p) > 90 ) {
866
+ if ( 97 <= (*p) && (*p) <= 122 )
867
+ goto tr60;
868
+ } else
869
+ goto tr60;
870
+ goto tr66;
871
+ st50:
872
+ if ( ++p == pe )
873
+ goto _test_eof50;
874
+ case 50:
875
+ switch( (*p) ) {
876
+ case 45: goto tr60;
877
+ case 89: goto st51;
878
+ case 95: goto tr60;
879
+ }
880
+ if ( (*p) < 65 ) {
881
+ if ( 48 <= (*p) && (*p) <= 57 )
882
+ goto tr60;
883
+ } else if ( (*p) > 90 ) {
884
+ if ( 97 <= (*p) && (*p) <= 122 )
885
+ goto tr60;
886
+ } else
887
+ goto tr60;
888
+ goto tr66;
889
+ st51:
890
+ if ( ++p == pe )
891
+ goto _test_eof51;
892
+ case 51:
893
+ switch( (*p) ) {
894
+ case 45: goto tr60;
895
+ case 83: goto st52;
896
+ case 95: goto tr60;
897
+ }
898
+ if ( (*p) < 65 ) {
899
+ if ( 48 <= (*p) && (*p) <= 57 )
900
+ goto tr60;
901
+ } else if ( (*p) > 90 ) {
902
+ if ( 97 <= (*p) && (*p) <= 122 )
903
+ goto tr60;
904
+ } else
905
+ goto tr60;
906
+ goto tr66;
907
+ st52:
908
+ if ( ++p == pe )
909
+ goto _test_eof52;
910
+ case 52:
911
+ switch( (*p) ) {
912
+ case 45: goto tr60;
913
+ case 84: goto st53;
914
+ case 95: goto tr60;
915
+ }
916
+ if ( (*p) < 65 ) {
917
+ if ( 48 <= (*p) && (*p) <= 57 )
918
+ goto tr60;
919
+ } else if ( (*p) > 90 ) {
920
+ if ( 97 <= (*p) && (*p) <= 122 )
921
+ goto tr60;
922
+ } else
923
+ goto tr60;
924
+ goto tr66;
925
+ st53:
926
+ if ( ++p == pe )
927
+ goto _test_eof53;
928
+ case 53:
929
+ switch( (*p) ) {
930
+ case 45: goto tr60;
931
+ case 69: goto st54;
932
+ case 95: goto tr60;
933
+ }
934
+ if ( (*p) < 65 ) {
935
+ if ( 48 <= (*p) && (*p) <= 57 )
936
+ goto tr60;
937
+ } else if ( (*p) > 90 ) {
938
+ if ( 97 <= (*p) && (*p) <= 122 )
939
+ goto tr60;
940
+ } else
941
+ goto tr60;
942
+ goto tr66;
943
+ st54:
944
+ if ( ++p == pe )
945
+ goto _test_eof54;
946
+ case 54:
947
+ switch( (*p) ) {
948
+ case 45: goto tr60;
949
+ case 77: goto tr71;
950
+ case 95: goto tr60;
951
+ }
952
+ if ( (*p) < 65 ) {
953
+ if ( 48 <= (*p) && (*p) <= 57 )
954
+ goto tr60;
955
+ } else if ( (*p) > 90 ) {
956
+ if ( 97 <= (*p) && (*p) <= 122 )
957
+ goto tr60;
958
+ } else
959
+ goto tr60;
960
+ goto tr66;
961
+ st27:
962
+ if ( ++p == pe )
963
+ goto _test_eof27;
964
+ case 27:
965
+ goto st28;
966
+ st28:
967
+ if ( ++p == pe )
968
+ goto _test_eof28;
969
+ case 28:
970
+ if ( (*p) == 93 )
971
+ goto tr33;
972
+ goto st28;
973
+ tr34:
974
+ #line 201 "ext/ragel/base_lexer.rl"
975
+ {{p = ((te))-1;}}
976
+ goto st55;
977
+ tr36:
978
+ #line 124 "ext/ragel/base_lexer.rl"
979
+ {te = p+1;{
980
+ callback("on_string", data, encoding, ts + 1, te - 1);
981
+ }}
982
+ goto st55;
983
+ tr76:
984
+ #line 201 "ext/ragel/base_lexer.rl"
985
+ {te = p+1;}
986
+ goto st55;
987
+ tr81:
988
+ #line 201 "ext/ragel/base_lexer.rl"
989
+ {te = p;p--;}
990
+ goto st55;
991
+ tr82:
992
+ #line 195 "ext/ragel/base_lexer.rl"
993
+ {te = p;p--;{
994
+ callback("on_attribute", data, encoding, ts, te);
995
+ }}
996
+ goto st55;
997
+ tr83:
998
+ cs = 55;
999
+ #line 189 "ext/ragel/base_lexer.rl"
1000
+ {te = p+1;{
1001
+ callback_simple("on_xml_decl_end");
1002
+ cs = 35;
1003
+ }}
1004
+ goto _again;
1005
+ st55:
1006
+ #line 1 "NONE"
1007
+ {ts = 0;}
1008
+ if ( ++p == pe )
1009
+ goto _test_eof55;
1010
+ case 55:
1011
+ #line 1 "NONE"
1012
+ {ts = p;}
1013
+ #line 1014 "ext/c/lexer.c"
1014
+ switch( (*p) ) {
1015
+ case 34: goto tr77;
1016
+ case 39: goto tr78;
1017
+ case 45: goto st58;
1018
+ case 63: goto st59;
1019
+ case 95: goto st58;
1020
+ }
1021
+ if ( (*p) < 65 ) {
1022
+ if ( 48 <= (*p) && (*p) <= 57 )
1023
+ goto st58;
1024
+ } else if ( (*p) > 90 ) {
1025
+ if ( 97 <= (*p) && (*p) <= 122 )
1026
+ goto st58;
1027
+ } else
1028
+ goto st58;
1029
+ goto tr76;
1030
+ tr77:
1031
+ #line 1 "NONE"
1032
+ {te = p+1;}
1033
+ goto st56;
1034
+ st56:
1035
+ if ( ++p == pe )
1036
+ goto _test_eof56;
1037
+ case 56:
1038
+ #line 1039 "ext/c/lexer.c"
1039
+ if ( (*p) == 34 )
1040
+ goto tr36;
1041
+ goto st29;
1042
+ st29:
1043
+ if ( ++p == pe )
1044
+ goto _test_eof29;
1045
+ case 29:
1046
+ if ( (*p) == 34 )
1047
+ goto tr36;
1048
+ goto st29;
1049
+ tr78:
1050
+ #line 1 "NONE"
1051
+ {te = p+1;}
1052
+ goto st57;
1053
+ st57:
1054
+ if ( ++p == pe )
1055
+ goto _test_eof57;
1056
+ case 57:
1057
+ #line 1058 "ext/c/lexer.c"
1058
+ if ( (*p) == 39 )
1059
+ goto tr36;
1060
+ goto st30;
1061
+ st30:
1062
+ if ( ++p == pe )
1063
+ goto _test_eof30;
1064
+ case 30:
1065
+ if ( (*p) == 39 )
1066
+ goto tr36;
1067
+ goto st30;
1068
+ st58:
1069
+ if ( ++p == pe )
1070
+ goto _test_eof58;
1071
+ case 58:
1072
+ switch( (*p) ) {
1073
+ case 45: goto st58;
1074
+ case 95: goto st58;
1075
+ }
1076
+ if ( (*p) < 65 ) {
1077
+ if ( 48 <= (*p) && (*p) <= 57 )
1078
+ goto st58;
1079
+ } else if ( (*p) > 90 ) {
1080
+ if ( 97 <= (*p) && (*p) <= 122 )
1081
+ goto st58;
1082
+ } else
1083
+ goto st58;
1084
+ goto tr82;
1085
+ st59:
1086
+ if ( ++p == pe )
1087
+ goto _test_eof59;
1088
+ case 59:
1089
+ if ( (*p) == 62 )
1090
+ goto tr83;
1091
+ goto tr81;
1092
+ tr85:
1093
+ cs = 60;
1094
+ #line 232 "ext/ragel/base_lexer.rl"
1095
+ {te = p;p--;{
1096
+ callback("on_element_name", data, encoding, ts, te);
1097
+ cs = 62;
1098
+ }}
1099
+ goto _again;
1100
+ tr86:
1101
+ #line 228 "ext/ragel/base_lexer.rl"
1102
+ {te = p+1;{
1103
+ callback("on_element_ns", data, encoding, ts, te - 1);
1104
+ }}
1105
+ goto st60;
1106
+ st60:
1107
+ #line 1 "NONE"
1108
+ {ts = 0;}
1109
+ if ( ++p == pe )
1110
+ goto _test_eof60;
1111
+ case 60:
1112
+ #line 1 "NONE"
1113
+ {ts = p;}
1114
+ #line 1115 "ext/c/lexer.c"
1115
+ switch( (*p) ) {
1116
+ case 45: goto st61;
1117
+ case 95: goto st61;
1118
+ }
1119
+ if ( (*p) < 65 ) {
1120
+ if ( 48 <= (*p) && (*p) <= 57 )
1121
+ goto st61;
1122
+ } else if ( (*p) > 90 ) {
1123
+ if ( 97 <= (*p) && (*p) <= 122 )
1124
+ goto st61;
1125
+ } else
1126
+ goto st61;
1127
+ goto st0;
1128
+ st61:
1129
+ if ( ++p == pe )
1130
+ goto _test_eof61;
1131
+ case 61:
1132
+ switch( (*p) ) {
1133
+ case 45: goto st61;
1134
+ case 58: goto tr86;
1135
+ case 95: goto st61;
1136
+ }
1137
+ if ( (*p) < 65 ) {
1138
+ if ( 48 <= (*p) && (*p) <= 57 )
1139
+ goto st61;
1140
+ } else if ( (*p) > 90 ) {
1141
+ if ( 97 <= (*p) && (*p) <= 122 )
1142
+ goto st61;
1143
+ } else
1144
+ goto st61;
1145
+ goto tr85;
1146
+ tr38:
1147
+ #line 243 "ext/ragel/base_lexer.rl"
1148
+ {te = p+1;{
1149
+ callback_simple("advance_line");
1150
+ }}
1151
+ goto st62;
1152
+ tr41:
1153
+ #line 124 "ext/ragel/base_lexer.rl"
1154
+ {te = p+1;{
1155
+ callback("on_string", data, encoding, ts + 1, te - 1);
1156
+ }}
1157
+ goto st62;
1158
+ tr43:
1159
+ cs = 62;
1160
+ #line 266 "ext/ragel/base_lexer.rl"
1161
+ {te = p+1;{
1162
+ callback_simple("on_element_end");
1163
+ cs = 35;
1164
+ }}
1165
+ goto _again;
1166
+ tr87:
1167
+ #line 241 "ext/ragel/base_lexer.rl"
1168
+ {te = p+1;}
1169
+ goto st62;
1170
+ tr91:
1171
+ cs = 62;
1172
+ #line 260 "ext/ragel/base_lexer.rl"
1173
+ {te = p+1;{
1174
+ callback_simple("on_element_open_end");
1175
+ cs = 35;
1176
+ }}
1177
+ goto _again;
1178
+ tr92:
1179
+ #line 252 "ext/ragel/base_lexer.rl"
1180
+ {te = p;p--;{
1181
+ callback("on_attribute", data, encoding, ts, te);
1182
+ }}
1183
+ goto st62;
1184
+ tr93:
1185
+ #line 248 "ext/ragel/base_lexer.rl"
1186
+ {te = p+1;{
1187
+ callback("on_attribute_ns", data, encoding, ts, te - 1);
1188
+ }}
1189
+ goto st62;
1190
+ st62:
1191
+ #line 1 "NONE"
1192
+ {ts = 0;}
1193
+ if ( ++p == pe )
1194
+ goto _test_eof62;
1195
+ case 62:
1196
+ #line 1 "NONE"
1197
+ {ts = p;}
1198
+ #line 1199 "ext/c/lexer.c"
1199
+ switch( (*p) ) {
1200
+ case 9: goto tr87;
1201
+ case 10: goto tr38;
1202
+ case 13: goto st31;
1203
+ case 32: goto tr87;
1204
+ case 34: goto st32;
1205
+ case 39: goto st33;
1206
+ case 45: goto st63;
1207
+ case 47: goto st34;
1208
+ case 61: goto tr87;
1209
+ case 62: goto tr91;
1210
+ case 95: goto st63;
1211
+ }
1212
+ if ( (*p) < 65 ) {
1213
+ if ( 48 <= (*p) && (*p) <= 57 )
1214
+ goto st63;
1215
+ } else if ( (*p) > 90 ) {
1216
+ if ( 97 <= (*p) && (*p) <= 122 )
1217
+ goto st63;
1218
+ } else
1219
+ goto st63;
1220
+ goto st0;
1221
+ st31:
1222
+ if ( ++p == pe )
1223
+ goto _test_eof31;
1224
+ case 31:
1225
+ if ( (*p) == 10 )
1226
+ goto tr38;
1227
+ goto st0;
1228
+ st32:
1229
+ if ( ++p == pe )
1230
+ goto _test_eof32;
1231
+ case 32:
1232
+ if ( (*p) == 34 )
1233
+ goto tr41;
1234
+ goto st32;
1235
+ st33:
1236
+ if ( ++p == pe )
1237
+ goto _test_eof33;
1238
+ case 33:
1239
+ if ( (*p) == 39 )
1240
+ goto tr41;
1241
+ goto st33;
1242
+ st63:
1243
+ if ( ++p == pe )
1244
+ goto _test_eof63;
1245
+ case 63:
1246
+ switch( (*p) ) {
1247
+ case 45: goto st63;
1248
+ case 58: goto tr93;
1249
+ case 95: goto st63;
1250
+ }
1251
+ if ( (*p) < 65 ) {
1252
+ if ( 48 <= (*p) && (*p) <= 57 )
1253
+ goto st63;
1254
+ } else if ( (*p) > 90 ) {
1255
+ if ( 97 <= (*p) && (*p) <= 122 )
1256
+ goto st63;
1257
+ } else
1258
+ goto st63;
1259
+ goto tr92;
1260
+ st34:
1261
+ if ( ++p == pe )
1262
+ goto _test_eof34;
1263
+ case 34:
1264
+ if ( (*p) == 62 )
1265
+ goto tr43;
1266
+ goto st0;
1267
+ tr96:
1268
+ cs = 64;
1269
+ #line 1 "NONE"
1270
+ { switch( act ) {
1271
+ case 0:
1272
+ {{goto st0;}}
1273
+ break;
1274
+ case 23:
1275
+ {{p = ((te))-1;}
1276
+ callback("on_text", data, encoding, ts, te);
1277
+ cs = 35;
1278
+ }
1279
+ break;
1280
+ }
1281
+ }
1282
+ goto _again;
1283
+ tr97:
1284
+ cs = 64;
1285
+ #line 306 "ext/ragel/base_lexer.rl"
1286
+ {te = p;p--;{
1287
+ callback("on_text", data, encoding, ts, te);
1288
+ cs = 35;
1289
+ }}
1290
+ goto _again;
1291
+ tr98:
1292
+ cs = 64;
1293
+ #line 296 "ext/ragel/base_lexer.rl"
1294
+ {te = p+1;{
1295
+ callback("on_text", data, encoding, ts, mark);
1296
+
1297
+ p = mark - 1;
1298
+ mark = 0;
1299
+
1300
+ cs = 35;
1301
+ }}
1302
+ goto _again;
1303
+ st64:
1304
+ #line 1 "NONE"
1305
+ {ts = 0;}
1306
+ #line 1 "NONE"
1307
+ {act = 0;}
1308
+ if ( ++p == pe )
1309
+ goto _test_eof64;
1310
+ case 64:
1311
+ #line 1 "NONE"
1312
+ {ts = p;}
1313
+ #line 1314 "ext/c/lexer.c"
1314
+ if ( (*p) == 60 )
1315
+ goto tr95;
1316
+ goto tr94;
1317
+ tr94:
1318
+ #line 1 "NONE"
1319
+ {te = p+1;}
1320
+ #line 296 "ext/ragel/base_lexer.rl"
1321
+ { mark = p; }
1322
+ #line 306 "ext/ragel/base_lexer.rl"
1323
+ {act = 23;}
1324
+ goto st65;
1325
+ st65:
1326
+ if ( ++p == pe )
1327
+ goto _test_eof65;
1328
+ case 65:
1329
+ #line 1330 "ext/c/lexer.c"
1330
+ if ( (*p) == 60 )
1331
+ goto tr95;
1332
+ goto tr94;
1333
+ tr95:
1334
+ #line 296 "ext/ragel/base_lexer.rl"
1335
+ { mark = p; }
1336
+ goto st66;
1337
+ st66:
1338
+ if ( ++p == pe )
1339
+ goto _test_eof66;
1340
+ case 66:
1341
+ #line 1342 "ext/c/lexer.c"
1342
+ switch( (*p) ) {
1343
+ case 33: goto tr98;
1344
+ case 45: goto tr98;
1345
+ case 60: goto tr95;
1346
+ case 63: goto tr98;
1347
+ case 95: goto tr98;
1348
+ }
1349
+ if ( (*p) < 65 ) {
1350
+ if ( 47 <= (*p) && (*p) <= 57 )
1351
+ goto tr98;
1352
+ } else if ( (*p) > 90 ) {
1353
+ if ( 97 <= (*p) && (*p) <= 122 )
1354
+ goto tr98;
1355
+ } else
1356
+ goto tr98;
1357
+ goto tr94;
1358
+ }
1359
+ _test_eof35: cs = 35; goto _test_eof;
1360
+ _test_eof36: cs = 36; goto _test_eof;
1361
+ _test_eof1: cs = 1; goto _test_eof;
1362
+ _test_eof2: cs = 2; goto _test_eof;
1363
+ _test_eof3: cs = 3; goto _test_eof;
1364
+ _test_eof4: cs = 4; goto _test_eof;
1365
+ _test_eof5: cs = 5; goto _test_eof;
1366
+ _test_eof6: cs = 6; goto _test_eof;
1367
+ _test_eof7: cs = 7; goto _test_eof;
1368
+ _test_eof8: cs = 8; goto _test_eof;
1369
+ _test_eof9: cs = 9; goto _test_eof;
1370
+ _test_eof10: cs = 10; goto _test_eof;
1371
+ _test_eof11: cs = 11; goto _test_eof;
1372
+ _test_eof12: cs = 12; goto _test_eof;
1373
+ _test_eof37: cs = 37; goto _test_eof;
1374
+ _test_eof13: cs = 13; goto _test_eof;
1375
+ _test_eof14: cs = 14; goto _test_eof;
1376
+ _test_eof15: cs = 15; goto _test_eof;
1377
+ _test_eof16: cs = 16; goto _test_eof;
1378
+ _test_eof17: cs = 17; goto _test_eof;
1379
+ _test_eof18: cs = 18; goto _test_eof;
1380
+ _test_eof19: cs = 19; goto _test_eof;
1381
+ _test_eof20: cs = 20; goto _test_eof;
1382
+ _test_eof21: cs = 21; goto _test_eof;
1383
+ _test_eof22: cs = 22; goto _test_eof;
1384
+ _test_eof23: cs = 23; goto _test_eof;
1385
+ _test_eof24: cs = 24; goto _test_eof;
1386
+ _test_eof38: cs = 38; goto _test_eof;
1387
+ _test_eof39: cs = 39; goto _test_eof;
1388
+ _test_eof40: cs = 40; goto _test_eof;
1389
+ _test_eof41: cs = 41; goto _test_eof;
1390
+ _test_eof42: cs = 42; goto _test_eof;
1391
+ _test_eof43: cs = 43; goto _test_eof;
1392
+ _test_eof25: cs = 25; goto _test_eof;
1393
+ _test_eof26: cs = 26; goto _test_eof;
1394
+ _test_eof44: cs = 44; goto _test_eof;
1395
+ _test_eof45: cs = 45; goto _test_eof;
1396
+ _test_eof46: cs = 46; goto _test_eof;
1397
+ _test_eof47: cs = 47; goto _test_eof;
1398
+ _test_eof48: cs = 48; goto _test_eof;
1399
+ _test_eof49: cs = 49; goto _test_eof;
1400
+ _test_eof50: cs = 50; goto _test_eof;
1401
+ _test_eof51: cs = 51; goto _test_eof;
1402
+ _test_eof52: cs = 52; goto _test_eof;
1403
+ _test_eof53: cs = 53; goto _test_eof;
1404
+ _test_eof54: cs = 54; goto _test_eof;
1405
+ _test_eof27: cs = 27; goto _test_eof;
1406
+ _test_eof28: cs = 28; goto _test_eof;
1407
+ _test_eof55: cs = 55; goto _test_eof;
1408
+ _test_eof56: cs = 56; goto _test_eof;
1409
+ _test_eof29: cs = 29; goto _test_eof;
1410
+ _test_eof57: cs = 57; goto _test_eof;
1411
+ _test_eof30: cs = 30; goto _test_eof;
1412
+ _test_eof58: cs = 58; goto _test_eof;
1413
+ _test_eof59: cs = 59; goto _test_eof;
1414
+ _test_eof60: cs = 60; goto _test_eof;
1415
+ _test_eof61: cs = 61; goto _test_eof;
1416
+ _test_eof62: cs = 62; goto _test_eof;
1417
+ _test_eof31: cs = 31; goto _test_eof;
1418
+ _test_eof32: cs = 32; goto _test_eof;
1419
+ _test_eof33: cs = 33; goto _test_eof;
1420
+ _test_eof63: cs = 63; goto _test_eof;
1421
+ _test_eof34: cs = 34; goto _test_eof;
1422
+ _test_eof64: cs = 64; goto _test_eof;
1423
+ _test_eof65: cs = 65; goto _test_eof;
1424
+ _test_eof66: cs = 66; goto _test_eof;
1425
+
1426
+ _test_eof: {}
1427
+ if ( p == eof )
1428
+ {
1429
+ switch ( cs ) {
1430
+ case 36: goto tr46;
1431
+ case 1: goto tr0;
1432
+ case 2: goto tr0;
1433
+ case 3: goto tr0;
1434
+ case 4: goto tr0;
1435
+ case 5: goto tr0;
1436
+ case 6: goto tr0;
1437
+ case 7: goto tr0;
1438
+ case 8: goto tr0;
1439
+ case 9: goto tr0;
1440
+ case 10: goto tr0;
1441
+ case 11: goto tr0;
1442
+ case 12: goto tr0;
1443
+ case 37: goto tr50;
1444
+ case 13: goto tr0;
1445
+ case 14: goto tr0;
1446
+ case 15: goto tr0;
1447
+ case 16: goto tr0;
1448
+ case 17: goto tr0;
1449
+ case 18: goto tr0;
1450
+ case 19: goto tr0;
1451
+ case 20: goto tr0;
1452
+ case 21: goto tr0;
1453
+ case 22: goto tr0;
1454
+ case 23: goto tr0;
1455
+ case 24: goto tr0;
1456
+ case 38: goto tr51;
1457
+ case 39: goto tr52;
1458
+ case 40: goto tr52;
1459
+ case 42: goto tr57;
1460
+ case 44: goto tr65;
1461
+ case 45: goto tr66;
1462
+ case 46: goto tr66;
1463
+ case 47: goto tr66;
1464
+ case 48: goto tr66;
1465
+ case 49: goto tr66;
1466
+ case 50: goto tr66;
1467
+ case 51: goto tr66;
1468
+ case 52: goto tr66;
1469
+ case 53: goto tr66;
1470
+ case 54: goto tr66;
1471
+ case 56: goto tr81;
1472
+ case 29: goto tr34;
1473
+ case 57: goto tr81;
1474
+ case 30: goto tr34;
1475
+ case 58: goto tr82;
1476
+ case 59: goto tr81;
1477
+ case 61: goto tr85;
1478
+ case 63: goto tr92;
1479
+ case 65: goto tr96;
1480
+ case 66: goto tr97;
1481
+ }
1482
+ }
1483
+
1484
+ _out: {}
1485
+ }
1486
+
1487
+ #line 91 "ext/c/lexer.rl"
1488
+
1489
+ oga_ivar_set(self, "@act", INT2NUM(act));
1490
+ oga_ivar_set(self, "@cs", INT2NUM(cs));
1491
+
1492
+ return Qnil;
1493
+ }
1494
+
1495
+ /**
1496
+ * Resets the internal state of the lexer.
1497
+ */
1498
+ VALUE oga_xml_lexer_reset(VALUE self)
1499
+ {
1500
+ oga_ivar_set(self, "@act", INT2NUM(0));
1501
+ oga_ivar_set(self, "@cs", INT2NUM(c_lexer_start));
1502
+
1503
+ return Qnil;
1504
+ }
1505
+
1506
+
1507
+ #line 111 "ext/c/lexer.rl"
1508
+
1509
+
1510
+ void Init_liboga_xml_lexer()
1511
+ {
1512
+ VALUE mOga = rb_const_get(rb_cObject, rb_intern("Oga"));
1513
+ VALUE mXML = rb_const_get(mOga, rb_intern("XML"));
1514
+ VALUE cLexer = rb_define_class_under(mXML, "Lexer", rb_cObject);
1515
+
1516
+ rb_define_method(cLexer, "advance_native", oga_xml_lexer_advance, 1);
1517
+ rb_define_method(cLexer, "reset_native", oga_xml_lexer_reset, 0);
1518
+ }