xrb 0.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +1 -0
  3. data/bake/xrb/entities.rb +60 -0
  4. data/bake/xrb/parsers.rb +66 -0
  5. data/ext/Makefile +270 -0
  6. data/ext/XRB_Extension.bundle +0 -0
  7. data/ext/escape.o +0 -0
  8. data/ext/extconf.h +5 -0
  9. data/ext/extconf.rb +21 -0
  10. data/ext/markup.o +0 -0
  11. data/ext/mkmf.log +122 -0
  12. data/ext/query.o +0 -0
  13. data/ext/tag.o +0 -0
  14. data/ext/template.o +0 -0
  15. data/ext/xrb/escape.c +152 -0
  16. data/ext/xrb/escape.h +15 -0
  17. data/ext/xrb/markup.c +1949 -0
  18. data/ext/xrb/markup.h +6 -0
  19. data/ext/xrb/markup.rl +226 -0
  20. data/ext/xrb/query.c +619 -0
  21. data/ext/xrb/query.h +6 -0
  22. data/ext/xrb/query.rl +82 -0
  23. data/ext/xrb/tag.c +204 -0
  24. data/ext/xrb/tag.h +21 -0
  25. data/ext/xrb/template.c +1114 -0
  26. data/ext/xrb/template.h +6 -0
  27. data/ext/xrb/template.rl +77 -0
  28. data/ext/xrb/xrb.c +72 -0
  29. data/ext/xrb/xrb.h +132 -0
  30. data/ext/xrb.o +0 -0
  31. data/lib/xrb/buffer.rb +103 -0
  32. data/lib/xrb/builder.rb +229 -0
  33. data/lib/xrb/entities.rb +2137 -0
  34. data/lib/xrb/entities.xrb +15 -0
  35. data/lib/xrb/error.rb +81 -0
  36. data/lib/xrb/fallback/markup.rb +1657 -0
  37. data/lib/xrb/fallback/markup.rl +227 -0
  38. data/lib/xrb/fallback/query.rb +548 -0
  39. data/lib/xrb/fallback/query.rl +88 -0
  40. data/lib/xrb/fallback/template.rb +829 -0
  41. data/lib/xrb/fallback/template.rl +80 -0
  42. data/lib/xrb/markup.rb +56 -0
  43. data/lib/xrb/native.rb +15 -0
  44. data/lib/xrb/parsers.rb +16 -0
  45. data/lib/xrb/query.rb +80 -0
  46. data/lib/xrb/reference.rb +108 -0
  47. data/lib/xrb/strings.rb +47 -0
  48. data/lib/xrb/tag.rb +115 -0
  49. data/lib/xrb/template.rb +128 -0
  50. data/lib/xrb/uri.rb +100 -0
  51. data/lib/xrb/version.rb +8 -0
  52. data/lib/xrb.rb +11 -0
  53. data/license.md +23 -0
  54. data/readme.md +34 -0
  55. data.tar.gz.sig +0 -0
  56. metadata +118 -58
  57. metadata.gz.sig +2 -0
  58. data/README +0 -60
  59. data/app/helpers/ui_helper.rb +0 -80
  60. data/app/models/xrb/element.rb +0 -9
  61. data/lib/xrb/engine.rb +0 -4
  62. data/rails/init.rb +0 -1
  63. data/xrb.gemspec +0 -12
@@ -0,0 +1,1114 @@
1
+
2
+ #line 1 "ext/xrb/template.rl"
3
+
4
+ #include "template.h"
5
+
6
+
7
+ #line 8 "ext/xrb/template.c"
8
+ static const int XRB_template_parser_start = 43;
9
+ static const int XRB_template_parser_first_final = 43;
10
+ static const int XRB_template_parser_error = 0;
11
+
12
+ static const int XRB_template_parser_en_parse_nested_expression = 21;
13
+ static const int XRB_template_parser_en_parse_expression = 32;
14
+ static const int XRB_template_parser_en_main = 43;
15
+
16
+
17
+ #line 50 "ext/xrb/template.rl"
18
+
19
+
20
+ VALUE XRB_Native_parse_template(VALUE self, VALUE buffer, VALUE delegate) {
21
+ VALUE string = rb_funcall(buffer, id_read, 0);
22
+
23
+ rb_encoding *encoding = rb_enc_get(string);
24
+
25
+ VALUE newline = rb_obj_freeze(rb_enc_str_new("\n", 1, encoding));
26
+
27
+ const char *s, *p, *pe, *eof, *ts, *te;
28
+ unsigned long cs, act, top = 0, stack[32] = {0};
29
+
30
+ XRB_Token expression = {0}, instruction = {0};
31
+
32
+ s = p = RSTRING_PTR(string);
33
+ eof = pe = p + RSTRING_LEN(string);
34
+
35
+
36
+ #line 37 "ext/xrb/template.c"
37
+ {
38
+ cs = XRB_template_parser_start;
39
+ top = 0;
40
+ ts = 0;
41
+ te = 0;
42
+ act = 0;
43
+ }
44
+
45
+ #line 46 "ext/xrb/template.c"
46
+ {
47
+ if ( p == pe )
48
+ goto _test_eof;
49
+ goto _resume;
50
+
51
+ _again:
52
+ switch ( cs ) {
53
+ case 43: goto st43;
54
+ case 44: goto st44;
55
+ case 45: goto st45;
56
+ case 1: goto st1;
57
+ case 2: goto st2;
58
+ case 3: goto st3;
59
+ case 4: goto st4;
60
+ case 5: goto st5;
61
+ case 46: goto st46;
62
+ case 6: goto st6;
63
+ case 7: goto st7;
64
+ case 8: goto st8;
65
+ case 9: goto st9;
66
+ case 10: goto st10;
67
+ case 11: goto st11;
68
+ case 12: goto st12;
69
+ case 47: goto st47;
70
+ case 13: goto st13;
71
+ case 14: goto st14;
72
+ case 15: goto st15;
73
+ case 0: goto st0;
74
+ case 16: goto st16;
75
+ case 17: goto st17;
76
+ case 18: goto st18;
77
+ case 19: goto st19;
78
+ case 20: goto st20;
79
+ case 48: goto st48;
80
+ case 21: goto st21;
81
+ case 22: goto st22;
82
+ case 23: goto st23;
83
+ case 24: goto st24;
84
+ case 25: goto st25;
85
+ case 26: goto st26;
86
+ case 27: goto st27;
87
+ case 49: goto st49;
88
+ case 28: goto st28;
89
+ case 50: goto st50;
90
+ case 29: goto st29;
91
+ case 30: goto st30;
92
+ case 31: goto st31;
93
+ case 51: goto st51;
94
+ case 52: goto st52;
95
+ case 32: goto st32;
96
+ case 33: goto st33;
97
+ case 34: goto st34;
98
+ case 35: goto st35;
99
+ case 36: goto st36;
100
+ case 37: goto st37;
101
+ case 38: goto st38;
102
+ case 53: goto st53;
103
+ case 39: goto st39;
104
+ case 54: goto st54;
105
+ case 40: goto st40;
106
+ case 41: goto st41;
107
+ case 42: goto st42;
108
+ case 55: goto st55;
109
+ case 56: goto st56;
110
+ default: break;
111
+ }
112
+
113
+ if ( ++p == pe )
114
+ goto _test_eof;
115
+ _resume:
116
+ switch ( cs )
117
+ {
118
+ tr0:
119
+ #line 43 "ext/xrb/template.rl"
120
+ {{p = ((te))-1;}{
121
+ rb_funcall(delegate, id_text, 1, XRB_string(ts, te, encoding));
122
+ }}
123
+ goto st43;
124
+ tr5:
125
+ #line 43 "ext/xrb/template.rl"
126
+ {{p = ((te))-1;}{
127
+ rb_funcall(delegate, id_text, 1, XRB_string(ts, te, encoding));
128
+ }}
129
+ goto st43;
130
+ tr9:
131
+ #line 23 "ext/xrb/template.rl"
132
+ {
133
+ XRB_raise_error("failed to parse instruction", buffer, p-s);
134
+ }
135
+ #line 43 "ext/xrb/template.rl"
136
+ {{p = ((te))-1;}{
137
+ rb_funcall(delegate, id_text, 1, XRB_string(ts, te, encoding));
138
+ }}
139
+ goto st43;
140
+ tr14:
141
+ #line 1 "NONE"
142
+ { switch( act ) {
143
+ case 3:
144
+ {{p = ((te))-1;}
145
+ rb_funcall(delegate, id_instruction, 1, XRB_Token_string(instruction, encoding));
146
+ }
147
+ break;
148
+ case 6:
149
+ {{p = ((te))-1;}
150
+ rb_funcall(delegate, id_text, 1, XRB_string(ts, te, encoding));
151
+ }
152
+ break;
153
+ }
154
+ }
155
+ goto st43;
156
+ tr15:
157
+ #line 19 "ext/xrb/template.rl"
158
+ {te = p+1;{
159
+ rb_funcall(delegate, id_instruction, 2, XRB_Token_string(instruction, encoding), newline);
160
+ }}
161
+ goto st43;
162
+ tr23:
163
+ #line 43 "ext/xrb/template.rl"
164
+ {te = p+1;{
165
+ rb_funcall(delegate, id_text, 1, XRB_string(ts, te, encoding));
166
+ }}
167
+ goto st43;
168
+ tr77:
169
+ #line 43 "ext/xrb/template.rl"
170
+ {te = p;p--;{
171
+ rb_funcall(delegate, id_text, 1, XRB_string(ts, te, encoding));
172
+ }}
173
+ goto st43;
174
+ tr80:
175
+ #line 43 "ext/xrb/template.rl"
176
+ {te = p;p--;{
177
+ rb_funcall(delegate, id_text, 1, XRB_string(ts, te, encoding));
178
+ }}
179
+ goto st43;
180
+ tr82:
181
+ cs = 43;
182
+ #line 27 "ext/xrb/template.rl"
183
+ {
184
+ expression.begin = p;
185
+ }
186
+ #line 53 "parsers/xrb/template.rl"
187
+ {te = p;p--;{cs = 32;}}
188
+ goto _again;
189
+ tr83:
190
+ #line 15 "ext/xrb/template.rl"
191
+ {te = p;p--;{
192
+ rb_funcall(delegate, id_instruction, 1, XRB_Token_string(instruction, encoding));
193
+ }}
194
+ goto st43;
195
+ st43:
196
+ #line 1 "NONE"
197
+ {ts = 0;}
198
+ if ( ++p == pe )
199
+ goto _test_eof43;
200
+ case 43:
201
+ #line 1 "NONE"
202
+ {ts = p;}
203
+ #line 204 "ext/xrb/template.c"
204
+ switch( (*p) ) {
205
+ case 10: goto tr2;
206
+ case 32: goto tr74;
207
+ case 35: goto st12;
208
+ case 60: goto st13;
209
+ }
210
+ if ( 9 <= (*p) && (*p) <= 13 )
211
+ goto tr74;
212
+ goto tr6;
213
+ tr6:
214
+ #line 1 "NONE"
215
+ {te = p+1;}
216
+ goto st44;
217
+ st44:
218
+ if ( ++p == pe )
219
+ goto _test_eof44;
220
+ case 44:
221
+ #line 222 "ext/xrb/template.c"
222
+ switch( (*p) ) {
223
+ case 10: goto tr2;
224
+ case 35: goto st4;
225
+ case 60: goto st5;
226
+ }
227
+ goto tr6;
228
+ tr2:
229
+ #line 1 "NONE"
230
+ {te = p+1;}
231
+ goto st45;
232
+ st45:
233
+ if ( ++p == pe )
234
+ goto _test_eof45;
235
+ case 45:
236
+ #line 237 "ext/xrb/template.c"
237
+ switch( (*p) ) {
238
+ case 10: goto tr2;
239
+ case 35: goto st2;
240
+ case 60: goto st3;
241
+ }
242
+ goto st1;
243
+ st1:
244
+ if ( ++p == pe )
245
+ goto _test_eof1;
246
+ case 1:
247
+ switch( (*p) ) {
248
+ case 10: goto tr2;
249
+ case 35: goto st2;
250
+ case 60: goto st3;
251
+ }
252
+ goto st1;
253
+ st2:
254
+ if ( ++p == pe )
255
+ goto _test_eof2;
256
+ case 2:
257
+ if ( (*p) == 123 )
258
+ goto tr0;
259
+ goto st1;
260
+ st3:
261
+ if ( ++p == pe )
262
+ goto _test_eof3;
263
+ case 3:
264
+ if ( (*p) == 63 )
265
+ goto tr0;
266
+ goto st1;
267
+ st4:
268
+ if ( ++p == pe )
269
+ goto _test_eof4;
270
+ case 4:
271
+ if ( (*p) == 123 )
272
+ goto tr5;
273
+ goto tr6;
274
+ st5:
275
+ if ( ++p == pe )
276
+ goto _test_eof5;
277
+ case 5:
278
+ if ( (*p) == 63 )
279
+ goto tr5;
280
+ goto tr6;
281
+ tr74:
282
+ #line 1 "NONE"
283
+ {te = p+1;}
284
+ #line 43 "ext/xrb/template.rl"
285
+ {act = 6;}
286
+ goto st46;
287
+ st46:
288
+ if ( ++p == pe )
289
+ goto _test_eof46;
290
+ case 46:
291
+ #line 292 "ext/xrb/template.c"
292
+ switch( (*p) ) {
293
+ case 10: goto tr2;
294
+ case 32: goto tr74;
295
+ case 35: goto st4;
296
+ case 60: goto st6;
297
+ }
298
+ if ( 9 <= (*p) && (*p) <= 13 )
299
+ goto tr74;
300
+ goto tr6;
301
+ st6:
302
+ if ( ++p == pe )
303
+ goto _test_eof6;
304
+ case 6:
305
+ if ( (*p) == 63 )
306
+ goto st7;
307
+ goto tr6;
308
+ st7:
309
+ if ( ++p == pe )
310
+ goto _test_eof7;
311
+ case 7:
312
+ if ( (*p) == 114 )
313
+ goto st8;
314
+ goto tr5;
315
+ st8:
316
+ if ( ++p == pe )
317
+ goto _test_eof8;
318
+ case 8:
319
+ if ( (*p) == 32 )
320
+ goto tr10;
321
+ if ( 9 <= (*p) && (*p) <= 13 )
322
+ goto tr10;
323
+ goto tr5;
324
+ tr10:
325
+ #line 7 "ext/xrb/template.rl"
326
+ {
327
+ instruction.begin = p;
328
+ }
329
+ goto st9;
330
+ st9:
331
+ if ( ++p == pe )
332
+ goto _test_eof9;
333
+ case 9:
334
+ #line 335 "ext/xrb/template.c"
335
+ if ( (*p) == 63 )
336
+ goto tr12;
337
+ goto st9;
338
+ tr12:
339
+ #line 11 "ext/xrb/template.rl"
340
+ {
341
+ instruction.end = p;
342
+ }
343
+ goto st10;
344
+ st10:
345
+ if ( ++p == pe )
346
+ goto _test_eof10;
347
+ case 10:
348
+ #line 349 "ext/xrb/template.c"
349
+ if ( (*p) == 62 )
350
+ goto st11;
351
+ goto st9;
352
+ st11:
353
+ if ( ++p == pe )
354
+ goto _test_eof11;
355
+ case 11:
356
+ switch( (*p) ) {
357
+ case 10: goto tr15;
358
+ case 32: goto st11;
359
+ }
360
+ if ( 9 <= (*p) && (*p) <= 13 )
361
+ goto st11;
362
+ goto tr14;
363
+ st12:
364
+ if ( ++p == pe )
365
+ goto _test_eof12;
366
+ case 12:
367
+ if ( (*p) == 123 )
368
+ goto st47;
369
+ goto tr6;
370
+ st47:
371
+ if ( ++p == pe )
372
+ goto _test_eof47;
373
+ case 47:
374
+ goto tr82;
375
+ st13:
376
+ if ( ++p == pe )
377
+ goto _test_eof13;
378
+ case 13:
379
+ if ( (*p) == 63 )
380
+ goto st14;
381
+ goto tr6;
382
+ st14:
383
+ if ( ++p == pe )
384
+ goto _test_eof14;
385
+ case 14:
386
+ switch( (*p) ) {
387
+ case 47: goto tr19;
388
+ case 96: goto tr19;
389
+ case 114: goto st18;
390
+ }
391
+ if ( (*p) < 59 ) {
392
+ if ( 0 <= (*p) && (*p) <= 44 )
393
+ goto tr19;
394
+ } else if ( (*p) > 64 ) {
395
+ if ( (*p) > 94 ) {
396
+ if ( 123 <= (*p) )
397
+ goto tr19;
398
+ } else if ( (*p) >= 91 )
399
+ goto tr19;
400
+ } else
401
+ goto tr19;
402
+ goto st15;
403
+ st15:
404
+ if ( ++p == pe )
405
+ goto _test_eof15;
406
+ case 15:
407
+ switch( (*p) ) {
408
+ case 32: goto st16;
409
+ case 47: goto tr19;
410
+ case 96: goto tr19;
411
+ }
412
+ if ( (*p) < 14 ) {
413
+ if ( (*p) > 8 ) {
414
+ if ( 9 <= (*p) && (*p) <= 13 )
415
+ goto st16;
416
+ } else if ( (*p) >= 0 )
417
+ goto tr19;
418
+ } else if ( (*p) > 44 ) {
419
+ if ( (*p) < 91 ) {
420
+ if ( 59 <= (*p) && (*p) <= 64 )
421
+ goto tr19;
422
+ } else if ( (*p) > 94 ) {
423
+ if ( 123 <= (*p) )
424
+ goto tr19;
425
+ } else
426
+ goto tr19;
427
+ } else
428
+ goto tr19;
429
+ goto st15;
430
+ tr19:
431
+ #line 23 "ext/xrb/template.rl"
432
+ {
433
+ XRB_raise_error("failed to parse instruction", buffer, p-s);
434
+ }
435
+ goto st0;
436
+ #line 437 "ext/xrb/template.c"
437
+ st0:
438
+ cs = 0;
439
+ goto _out;
440
+ st16:
441
+ if ( ++p == pe )
442
+ goto _test_eof16;
443
+ case 16:
444
+ if ( (*p) == 63 )
445
+ goto st17;
446
+ goto st16;
447
+ st17:
448
+ if ( ++p == pe )
449
+ goto _test_eof17;
450
+ case 17:
451
+ if ( (*p) == 62 )
452
+ goto tr23;
453
+ goto st16;
454
+ st18:
455
+ if ( ++p == pe )
456
+ goto _test_eof18;
457
+ case 18:
458
+ switch( (*p) ) {
459
+ case 32: goto tr24;
460
+ case 47: goto tr19;
461
+ case 96: goto tr19;
462
+ }
463
+ if ( (*p) < 14 ) {
464
+ if ( (*p) > 8 ) {
465
+ if ( 9 <= (*p) && (*p) <= 13 )
466
+ goto tr24;
467
+ } else if ( (*p) >= 0 )
468
+ goto tr19;
469
+ } else if ( (*p) > 44 ) {
470
+ if ( (*p) < 91 ) {
471
+ if ( 59 <= (*p) && (*p) <= 64 )
472
+ goto tr19;
473
+ } else if ( (*p) > 94 ) {
474
+ if ( 123 <= (*p) )
475
+ goto tr19;
476
+ } else
477
+ goto tr19;
478
+ } else
479
+ goto tr19;
480
+ goto st15;
481
+ tr24:
482
+ #line 7 "ext/xrb/template.rl"
483
+ {
484
+ instruction.begin = p;
485
+ }
486
+ goto st19;
487
+ st19:
488
+ if ( ++p == pe )
489
+ goto _test_eof19;
490
+ case 19:
491
+ #line 492 "ext/xrb/template.c"
492
+ if ( (*p) == 63 )
493
+ goto tr26;
494
+ goto st19;
495
+ tr26:
496
+ #line 11 "ext/xrb/template.rl"
497
+ {
498
+ instruction.end = p;
499
+ }
500
+ goto st20;
501
+ st20:
502
+ if ( ++p == pe )
503
+ goto _test_eof20;
504
+ case 20:
505
+ #line 506 "ext/xrb/template.c"
506
+ if ( (*p) == 62 )
507
+ goto tr27;
508
+ goto st19;
509
+ tr27:
510
+ #line 1 "NONE"
511
+ {te = p+1;}
512
+ #line 15 "ext/xrb/template.rl"
513
+ {act = 3;}
514
+ goto st48;
515
+ st48:
516
+ if ( ++p == pe )
517
+ goto _test_eof48;
518
+ case 48:
519
+ #line 520 "ext/xrb/template.c"
520
+ switch( (*p) ) {
521
+ case 10: goto tr15;
522
+ case 32: goto st11;
523
+ }
524
+ if ( 9 <= (*p) && (*p) <= 13 )
525
+ goto st11;
526
+ goto tr83;
527
+ tr31:
528
+ #line 17 "parsers/xrb/template.rl"
529
+ {{stack[top++] = 21;goto st21;}}
530
+ goto st21;
531
+ st21:
532
+ #line 1 "NONE"
533
+ {ts = 0;}
534
+ if ( ++p == pe )
535
+ goto _test_eof21;
536
+ case 21:
537
+ #line 538 "ext/xrb/template.c"
538
+ switch( (*p) ) {
539
+ case 34: goto st22;
540
+ case 39: goto st30;
541
+ case 123: goto tr31;
542
+ case 125: goto tr32;
543
+ }
544
+ goto st21;
545
+ tr47:
546
+ #line 13 "parsers/xrb/template.rl"
547
+ {{stack[top++] = 22;goto st21;}}
548
+ goto st22;
549
+ st22:
550
+ #line 1 "NONE"
551
+ {ts = 0;}
552
+ if ( ++p == pe )
553
+ goto _test_eof22;
554
+ case 22:
555
+ #line 556 "ext/xrb/template.c"
556
+ switch( (*p) ) {
557
+ case 34: goto st23;
558
+ case 35: goto st29;
559
+ }
560
+ goto st22;
561
+ tr37:
562
+ #line 17 "parsers/xrb/template.rl"
563
+ {{stack[top++] = 23;goto st21;}}
564
+ goto st23;
565
+ tr39:
566
+ #line 13 "parsers/xrb/template.rl"
567
+ {{stack[top++] = 23;goto st21;}}
568
+ #line 17 "parsers/xrb/template.rl"
569
+ {{stack[top++] = 23;goto st21;}}
570
+ goto st23;
571
+ st23:
572
+ #line 1 "NONE"
573
+ {ts = 0;}
574
+ if ( ++p == pe )
575
+ goto _test_eof23;
576
+ case 23:
577
+ #line 578 "ext/xrb/template.c"
578
+ switch( (*p) ) {
579
+ case 35: goto st24;
580
+ case 39: goto st25;
581
+ case 123: goto tr37;
582
+ case 125: goto tr38;
583
+ }
584
+ goto st23;
585
+ st24:
586
+ if ( ++p == pe )
587
+ goto _test_eof24;
588
+ case 24:
589
+ switch( (*p) ) {
590
+ case 35: goto st24;
591
+ case 39: goto st25;
592
+ case 123: goto tr39;
593
+ case 125: goto tr38;
594
+ }
595
+ goto st23;
596
+ tr46:
597
+ #line 13 "parsers/xrb/template.rl"
598
+ {{stack[top++] = 25;goto st21;}}
599
+ goto st25;
600
+ st25:
601
+ #line 1 "NONE"
602
+ {ts = 0;}
603
+ if ( ++p == pe )
604
+ goto _test_eof25;
605
+ case 25:
606
+ #line 607 "ext/xrb/template.c"
607
+ switch( (*p) ) {
608
+ case 34: goto st26;
609
+ case 35: goto st28;
610
+ case 39: goto st26;
611
+ }
612
+ goto st25;
613
+ tr43:
614
+ #line 17 "parsers/xrb/template.rl"
615
+ {{stack[top++] = 26;goto st21;}}
616
+ goto st26;
617
+ tr45:
618
+ #line 13 "parsers/xrb/template.rl"
619
+ {{stack[top++] = 26;goto st21;}}
620
+ #line 17 "parsers/xrb/template.rl"
621
+ {{stack[top++] = 26;goto st21;}}
622
+ goto st26;
623
+ st26:
624
+ #line 1 "NONE"
625
+ {ts = 0;}
626
+ if ( ++p == pe )
627
+ goto _test_eof26;
628
+ case 26:
629
+ #line 630 "ext/xrb/template.c"
630
+ switch( (*p) ) {
631
+ case 35: goto st27;
632
+ case 123: goto tr43;
633
+ case 125: goto tr44;
634
+ }
635
+ goto st26;
636
+ st27:
637
+ if ( ++p == pe )
638
+ goto _test_eof27;
639
+ case 27:
640
+ switch( (*p) ) {
641
+ case 35: goto st27;
642
+ case 123: goto tr45;
643
+ case 125: goto tr44;
644
+ }
645
+ goto st26;
646
+ tr44:
647
+ #line 20 "parsers/xrb/template.rl"
648
+ {{cs = stack[--top];goto _again;}}
649
+ goto st49;
650
+ st49:
651
+ if ( ++p == pe )
652
+ goto _test_eof49;
653
+ case 49:
654
+ #line 655 "ext/xrb/template.c"
655
+ switch( (*p) ) {
656
+ case 34: goto st26;
657
+ case 35: goto st28;
658
+ case 39: goto st26;
659
+ }
660
+ goto st25;
661
+ st28:
662
+ if ( ++p == pe )
663
+ goto _test_eof28;
664
+ case 28:
665
+ switch( (*p) ) {
666
+ case 34: goto st26;
667
+ case 35: goto st28;
668
+ case 39: goto st26;
669
+ case 123: goto tr46;
670
+ }
671
+ goto st25;
672
+ tr38:
673
+ #line 20 "parsers/xrb/template.rl"
674
+ {{cs = stack[--top];goto _again;}}
675
+ goto st50;
676
+ st50:
677
+ if ( ++p == pe )
678
+ goto _test_eof50;
679
+ case 50:
680
+ #line 681 "ext/xrb/template.c"
681
+ switch( (*p) ) {
682
+ case 34: goto st23;
683
+ case 35: goto st29;
684
+ }
685
+ goto st22;
686
+ st29:
687
+ if ( ++p == pe )
688
+ goto _test_eof29;
689
+ case 29:
690
+ switch( (*p) ) {
691
+ case 34: goto st23;
692
+ case 35: goto st29;
693
+ case 123: goto tr47;
694
+ }
695
+ goto st22;
696
+ st30:
697
+ if ( ++p == pe )
698
+ goto _test_eof30;
699
+ case 30:
700
+ if ( (*p) == 39 )
701
+ goto st31;
702
+ goto st30;
703
+ tr49:
704
+ #line 17 "parsers/xrb/template.rl"
705
+ {{stack[top++] = 31;goto st21;}}
706
+ goto st31;
707
+ st31:
708
+ #line 1 "NONE"
709
+ {ts = 0;}
710
+ if ( ++p == pe )
711
+ goto _test_eof31;
712
+ case 31:
713
+ #line 714 "ext/xrb/template.c"
714
+ switch( (*p) ) {
715
+ case 34: goto st25;
716
+ case 123: goto tr49;
717
+ case 125: goto tr50;
718
+ }
719
+ goto st31;
720
+ tr50:
721
+ #line 20 "parsers/xrb/template.rl"
722
+ {{cs = stack[--top];goto _again;}}
723
+ goto st51;
724
+ st51:
725
+ if ( ++p == pe )
726
+ goto _test_eof51;
727
+ case 51:
728
+ #line 729 "ext/xrb/template.c"
729
+ if ( (*p) == 39 )
730
+ goto st31;
731
+ goto st30;
732
+ tr32:
733
+ #line 20 "parsers/xrb/template.rl"
734
+ {{cs = stack[--top];goto _again;}}
735
+ goto st52;
736
+ st52:
737
+ if ( ++p == pe )
738
+ goto _test_eof52;
739
+ case 52:
740
+ #line 741 "ext/xrb/template.c"
741
+ goto st0;
742
+ tr54:
743
+ #line 17 "parsers/xrb/template.rl"
744
+ {{stack[top++] = 32;goto st21;}}
745
+ goto st32;
746
+ st32:
747
+ #line 1 "NONE"
748
+ {ts = 0;}
749
+ if ( ++p == pe )
750
+ goto _test_eof32;
751
+ case 32:
752
+ #line 753 "ext/xrb/template.c"
753
+ switch( (*p) ) {
754
+ case 34: goto st33;
755
+ case 39: goto st41;
756
+ case 123: goto tr54;
757
+ case 125: goto tr55;
758
+ }
759
+ goto st32;
760
+ tr70:
761
+ #line 13 "parsers/xrb/template.rl"
762
+ {{stack[top++] = 33;goto st21;}}
763
+ goto st33;
764
+ st33:
765
+ #line 1 "NONE"
766
+ {ts = 0;}
767
+ if ( ++p == pe )
768
+ goto _test_eof33;
769
+ case 33:
770
+ #line 771 "ext/xrb/template.c"
771
+ switch( (*p) ) {
772
+ case 34: goto st34;
773
+ case 35: goto st40;
774
+ }
775
+ goto st33;
776
+ tr60:
777
+ #line 17 "parsers/xrb/template.rl"
778
+ {{stack[top++] = 34;goto st21;}}
779
+ goto st34;
780
+ tr62:
781
+ #line 13 "parsers/xrb/template.rl"
782
+ {{stack[top++] = 34;goto st21;}}
783
+ #line 17 "parsers/xrb/template.rl"
784
+ {{stack[top++] = 34;goto st21;}}
785
+ goto st34;
786
+ st34:
787
+ #line 1 "NONE"
788
+ {ts = 0;}
789
+ if ( ++p == pe )
790
+ goto _test_eof34;
791
+ case 34:
792
+ #line 793 "ext/xrb/template.c"
793
+ switch( (*p) ) {
794
+ case 35: goto st35;
795
+ case 39: goto st36;
796
+ case 123: goto tr60;
797
+ case 125: goto tr61;
798
+ }
799
+ goto st34;
800
+ st35:
801
+ if ( ++p == pe )
802
+ goto _test_eof35;
803
+ case 35:
804
+ switch( (*p) ) {
805
+ case 35: goto st35;
806
+ case 39: goto st36;
807
+ case 123: goto tr62;
808
+ case 125: goto tr61;
809
+ }
810
+ goto st34;
811
+ tr69:
812
+ #line 13 "parsers/xrb/template.rl"
813
+ {{stack[top++] = 36;goto st21;}}
814
+ goto st36;
815
+ st36:
816
+ #line 1 "NONE"
817
+ {ts = 0;}
818
+ if ( ++p == pe )
819
+ goto _test_eof36;
820
+ case 36:
821
+ #line 822 "ext/xrb/template.c"
822
+ switch( (*p) ) {
823
+ case 34: goto st37;
824
+ case 35: goto st39;
825
+ case 39: goto st37;
826
+ }
827
+ goto st36;
828
+ tr66:
829
+ #line 17 "parsers/xrb/template.rl"
830
+ {{stack[top++] = 37;goto st21;}}
831
+ goto st37;
832
+ tr68:
833
+ #line 13 "parsers/xrb/template.rl"
834
+ {{stack[top++] = 37;goto st21;}}
835
+ #line 17 "parsers/xrb/template.rl"
836
+ {{stack[top++] = 37;goto st21;}}
837
+ goto st37;
838
+ st37:
839
+ #line 1 "NONE"
840
+ {ts = 0;}
841
+ if ( ++p == pe )
842
+ goto _test_eof37;
843
+ case 37:
844
+ #line 845 "ext/xrb/template.c"
845
+ switch( (*p) ) {
846
+ case 35: goto st38;
847
+ case 123: goto tr66;
848
+ case 125: goto tr67;
849
+ }
850
+ goto st37;
851
+ st38:
852
+ if ( ++p == pe )
853
+ goto _test_eof38;
854
+ case 38:
855
+ switch( (*p) ) {
856
+ case 35: goto st38;
857
+ case 123: goto tr68;
858
+ case 125: goto tr67;
859
+ }
860
+ goto st37;
861
+ tr67:
862
+ cs = 53;
863
+ #line 31 "ext/xrb/template.rl"
864
+ {
865
+ expression.end = p;
866
+ }
867
+ #line 35 "ext/xrb/template.rl"
868
+ {
869
+ rb_funcall(delegate, id_expression, 1, XRB_Token_string(expression, encoding));
870
+ }
871
+ #line 21 "parsers/xrb/template.rl"
872
+ {cs = 43;}
873
+ goto _again;
874
+ st53:
875
+ if ( ++p == pe )
876
+ goto _test_eof53;
877
+ case 53:
878
+ #line 879 "ext/xrb/template.c"
879
+ switch( (*p) ) {
880
+ case 34: goto st37;
881
+ case 35: goto st39;
882
+ case 39: goto st37;
883
+ }
884
+ goto st36;
885
+ st39:
886
+ if ( ++p == pe )
887
+ goto _test_eof39;
888
+ case 39:
889
+ switch( (*p) ) {
890
+ case 34: goto st37;
891
+ case 35: goto st39;
892
+ case 39: goto st37;
893
+ case 123: goto tr69;
894
+ }
895
+ goto st36;
896
+ tr61:
897
+ cs = 54;
898
+ #line 31 "ext/xrb/template.rl"
899
+ {
900
+ expression.end = p;
901
+ }
902
+ #line 35 "ext/xrb/template.rl"
903
+ {
904
+ rb_funcall(delegate, id_expression, 1, XRB_Token_string(expression, encoding));
905
+ }
906
+ #line 21 "parsers/xrb/template.rl"
907
+ {cs = 43;}
908
+ goto _again;
909
+ st54:
910
+ if ( ++p == pe )
911
+ goto _test_eof54;
912
+ case 54:
913
+ #line 914 "ext/xrb/template.c"
914
+ switch( (*p) ) {
915
+ case 34: goto st34;
916
+ case 35: goto st40;
917
+ }
918
+ goto st33;
919
+ st40:
920
+ if ( ++p == pe )
921
+ goto _test_eof40;
922
+ case 40:
923
+ switch( (*p) ) {
924
+ case 34: goto st34;
925
+ case 35: goto st40;
926
+ case 123: goto tr70;
927
+ }
928
+ goto st33;
929
+ st41:
930
+ if ( ++p == pe )
931
+ goto _test_eof41;
932
+ case 41:
933
+ if ( (*p) == 39 )
934
+ goto st42;
935
+ goto st41;
936
+ tr72:
937
+ #line 17 "parsers/xrb/template.rl"
938
+ {{stack[top++] = 42;goto st21;}}
939
+ goto st42;
940
+ st42:
941
+ #line 1 "NONE"
942
+ {ts = 0;}
943
+ if ( ++p == pe )
944
+ goto _test_eof42;
945
+ case 42:
946
+ #line 947 "ext/xrb/template.c"
947
+ switch( (*p) ) {
948
+ case 34: goto st36;
949
+ case 123: goto tr72;
950
+ case 125: goto tr73;
951
+ }
952
+ goto st42;
953
+ tr73:
954
+ cs = 55;
955
+ #line 31 "ext/xrb/template.rl"
956
+ {
957
+ expression.end = p;
958
+ }
959
+ #line 35 "ext/xrb/template.rl"
960
+ {
961
+ rb_funcall(delegate, id_expression, 1, XRB_Token_string(expression, encoding));
962
+ }
963
+ #line 21 "parsers/xrb/template.rl"
964
+ {cs = 43;}
965
+ goto _again;
966
+ st55:
967
+ if ( ++p == pe )
968
+ goto _test_eof55;
969
+ case 55:
970
+ #line 971 "ext/xrb/template.c"
971
+ if ( (*p) == 39 )
972
+ goto st42;
973
+ goto st41;
974
+ tr55:
975
+ cs = 56;
976
+ #line 31 "ext/xrb/template.rl"
977
+ {
978
+ expression.end = p;
979
+ }
980
+ #line 35 "ext/xrb/template.rl"
981
+ {
982
+ rb_funcall(delegate, id_expression, 1, XRB_Token_string(expression, encoding));
983
+ }
984
+ #line 21 "parsers/xrb/template.rl"
985
+ {cs = 43;}
986
+ goto _again;
987
+ st56:
988
+ if ( ++p == pe )
989
+ goto _test_eof56;
990
+ case 56:
991
+ #line 992 "ext/xrb/template.c"
992
+ goto st0;
993
+ }
994
+ _test_eof43: cs = 43; goto _test_eof;
995
+ _test_eof44: cs = 44; goto _test_eof;
996
+ _test_eof45: cs = 45; goto _test_eof;
997
+ _test_eof1: cs = 1; goto _test_eof;
998
+ _test_eof2: cs = 2; goto _test_eof;
999
+ _test_eof3: cs = 3; goto _test_eof;
1000
+ _test_eof4: cs = 4; goto _test_eof;
1001
+ _test_eof5: cs = 5; goto _test_eof;
1002
+ _test_eof46: cs = 46; goto _test_eof;
1003
+ _test_eof6: cs = 6; goto _test_eof;
1004
+ _test_eof7: cs = 7; goto _test_eof;
1005
+ _test_eof8: cs = 8; goto _test_eof;
1006
+ _test_eof9: cs = 9; goto _test_eof;
1007
+ _test_eof10: cs = 10; goto _test_eof;
1008
+ _test_eof11: cs = 11; goto _test_eof;
1009
+ _test_eof12: cs = 12; goto _test_eof;
1010
+ _test_eof47: cs = 47; goto _test_eof;
1011
+ _test_eof13: cs = 13; goto _test_eof;
1012
+ _test_eof14: cs = 14; goto _test_eof;
1013
+ _test_eof15: cs = 15; goto _test_eof;
1014
+ _test_eof16: cs = 16; goto _test_eof;
1015
+ _test_eof17: cs = 17; goto _test_eof;
1016
+ _test_eof18: cs = 18; goto _test_eof;
1017
+ _test_eof19: cs = 19; goto _test_eof;
1018
+ _test_eof20: cs = 20; goto _test_eof;
1019
+ _test_eof48: cs = 48; goto _test_eof;
1020
+ _test_eof21: cs = 21; goto _test_eof;
1021
+ _test_eof22: cs = 22; goto _test_eof;
1022
+ _test_eof23: cs = 23; goto _test_eof;
1023
+ _test_eof24: cs = 24; goto _test_eof;
1024
+ _test_eof25: cs = 25; goto _test_eof;
1025
+ _test_eof26: cs = 26; goto _test_eof;
1026
+ _test_eof27: cs = 27; goto _test_eof;
1027
+ _test_eof49: cs = 49; goto _test_eof;
1028
+ _test_eof28: cs = 28; goto _test_eof;
1029
+ _test_eof50: cs = 50; goto _test_eof;
1030
+ _test_eof29: cs = 29; goto _test_eof;
1031
+ _test_eof30: cs = 30; goto _test_eof;
1032
+ _test_eof31: cs = 31; goto _test_eof;
1033
+ _test_eof51: cs = 51; goto _test_eof;
1034
+ _test_eof52: cs = 52; goto _test_eof;
1035
+ _test_eof32: cs = 32; goto _test_eof;
1036
+ _test_eof33: cs = 33; goto _test_eof;
1037
+ _test_eof34: cs = 34; goto _test_eof;
1038
+ _test_eof35: cs = 35; goto _test_eof;
1039
+ _test_eof36: cs = 36; goto _test_eof;
1040
+ _test_eof37: cs = 37; goto _test_eof;
1041
+ _test_eof38: cs = 38; goto _test_eof;
1042
+ _test_eof53: cs = 53; goto _test_eof;
1043
+ _test_eof39: cs = 39; goto _test_eof;
1044
+ _test_eof54: cs = 54; goto _test_eof;
1045
+ _test_eof40: cs = 40; goto _test_eof;
1046
+ _test_eof41: cs = 41; goto _test_eof;
1047
+ _test_eof42: cs = 42; goto _test_eof;
1048
+ _test_eof55: cs = 55; goto _test_eof;
1049
+ _test_eof56: cs = 56; goto _test_eof;
1050
+
1051
+ _test_eof: {}
1052
+ if ( p == eof )
1053
+ {
1054
+ switch ( cs ) {
1055
+ case 44: goto tr77;
1056
+ case 45: goto tr80;
1057
+ case 1: goto tr0;
1058
+ case 2: goto tr0;
1059
+ case 3: goto tr0;
1060
+ case 4: goto tr5;
1061
+ case 5: goto tr5;
1062
+ case 46: goto tr77;
1063
+ case 6: goto tr5;
1064
+ case 7: goto tr5;
1065
+ case 8: goto tr9;
1066
+ case 9: goto tr9;
1067
+ case 10: goto tr9;
1068
+ case 11: goto tr14;
1069
+ case 47: goto tr82;
1070
+ case 48: goto tr83;
1071
+ case 14:
1072
+ case 15:
1073
+ case 16:
1074
+ case 17:
1075
+ case 18:
1076
+ case 19:
1077
+ case 20:
1078
+ #line 23 "ext/xrb/template.rl"
1079
+ {
1080
+ XRB_raise_error("failed to parse instruction", buffer, p-s);
1081
+ }
1082
+ break;
1083
+ case 32:
1084
+ case 33:
1085
+ case 34:
1086
+ case 35:
1087
+ case 36:
1088
+ case 37:
1089
+ case 38:
1090
+ case 39:
1091
+ case 40:
1092
+ case 41:
1093
+ case 42:
1094
+ #line 39 "ext/xrb/template.rl"
1095
+ {
1096
+ XRB_raise_error("failed to parse expression", buffer, p-s);
1097
+ }
1098
+ break;
1099
+ #line 1100 "ext/xrb/template.c"
1100
+ }
1101
+ }
1102
+
1103
+ _out: {}
1104
+ }
1105
+
1106
+ #line 70 "ext/xrb/template.rl"
1107
+
1108
+
1109
+ if (p != eof) {
1110
+ XRB_raise_error("could not parse all input", buffer, p-s);
1111
+ }
1112
+
1113
+ return Qnil;
1114
+ }