xrb 0.7.0 → 0.9.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.
data/ext/xrb/template.c CHANGED
@@ -5,16 +5,16 @@
5
5
 
6
6
 
7
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;
8
+ static const int XRB_template_parser_start = 34;
9
+ static const int XRB_template_parser_first_final = 34;
10
10
  static const int XRB_template_parser_error = 0;
11
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;
12
+ static const int XRB_template_parser_en_parse_nested_expression = 11;
13
+ static const int XRB_template_parser_en_parse_expression = 22;
14
+ static const int XRB_template_parser_en_main = 34;
15
15
 
16
16
 
17
- #line 50 "ext/xrb/template.rl"
17
+ #line 89 "ext/xrb/template.rl"
18
18
 
19
19
 
20
20
  VALUE XRB_Native_parse_template(VALUE self, VALUE buffer, VALUE delegate) {
@@ -25,9 +25,9 @@ VALUE XRB_Native_parse_template(VALUE self, VALUE buffer, VALUE delegate) {
25
25
  VALUE newline = rb_obj_freeze(rb_enc_str_new("\n", 1, encoding));
26
26
 
27
27
  const char *s, *p, *pe, *eof, *ts, *te;
28
- unsigned long cs, act, top = 0, stack[32] = {0};
28
+ unsigned long cs, top = 0, stack[32] = {0}, act;
29
29
 
30
- XRB_Token expression = {0}, instruction = {0};
30
+ XRB_Token expression = {0}, instruction = {0}, text = {0}, delimiter = {0};
31
31
 
32
32
  s = p = RSTRING_PTR(string);
33
33
  eof = pe = p + RSTRING_LEN(string);
@@ -50,63 +50,66 @@ VALUE XRB_Native_parse_template(VALUE self, VALUE buffer, VALUE delegate) {
50
50
 
51
51
  _again:
52
52
  switch ( cs ) {
53
- case 43: goto st43;
54
- case 44: goto st44;
55
- case 45: goto st45;
53
+ case 34: goto st34;
54
+ case 35: goto st35;
55
+ case 36: goto st36;
56
56
  case 1: goto st1;
57
57
  case 2: goto st2;
58
58
  case 3: goto st3;
59
59
  case 4: goto st4;
60
60
  case 5: goto st5;
61
- case 46: goto st46;
61
+ case 37: goto st37;
62
+ case 38: goto st38;
63
+ case 39: goto st39;
64
+ case 40: goto st40;
65
+ case 41: goto st41;
66
+ case 42: goto st42;
67
+ case 43: goto st43;
68
+ case 44: goto st44;
69
+ case 45: goto st45;
62
70
  case 6: goto st6;
63
71
  case 7: goto st7;
64
72
  case 8: goto st8;
73
+ case 46: goto st46;
74
+ case 47: goto st47;
75
+ case 48: goto st48;
76
+ case 49: goto st49;
77
+ case 50: goto st50;
65
78
  case 9: goto st9;
66
79
  case 10: goto st10;
80
+ case 51: goto st51;
67
81
  case 11: goto st11;
68
82
  case 12: goto st12;
69
- case 47: goto st47;
70
83
  case 13: goto st13;
71
84
  case 14: goto st14;
72
85
  case 15: goto st15;
73
- case 0: goto st0;
74
86
  case 16: goto st16;
75
87
  case 17: goto st17;
88
+ case 52: goto st52;
76
89
  case 18: goto st18;
90
+ case 53: goto st53;
77
91
  case 19: goto st19;
78
92
  case 20: goto st20;
79
- case 48: goto st48;
80
93
  case 21: goto st21;
94
+ case 54: goto st54;
95
+ case 55: goto st55;
96
+ case 0: goto st0;
81
97
  case 22: goto st22;
82
98
  case 23: goto st23;
83
99
  case 24: goto st24;
84
100
  case 25: goto st25;
85
101
  case 26: goto st26;
86
102
  case 27: goto st27;
87
- case 49: goto st49;
88
103
  case 28: goto st28;
89
- case 50: goto st50;
90
104
  case 29: goto st29;
105
+ case 56: goto st56;
91
106
  case 30: goto st30;
107
+ case 57: goto st57;
92
108
  case 31: goto st31;
93
- case 51: goto st51;
94
- case 52: goto st52;
95
109
  case 32: goto st32;
96
110
  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;
111
+ case 58: goto st58;
112
+ case 59: goto st59;
110
113
  default: break;
111
114
  }
112
115
 
@@ -116,124 +119,212 @@ _resume:
116
119
  switch ( cs )
117
120
  {
118
121
  tr0:
119
- #line 43 "ext/xrb/template.rl"
122
+ #line 75 "ext/xrb/template.rl"
120
123
  {{p = ((te))-1;}{
121
- rb_funcall(delegate, id_text, 1, XRB_string(ts, te, encoding));
124
+ text.begin = ts;
125
+ text.end = te;
126
+
127
+ rb_funcall(delegate, id_text, 1, XRB_Token_string(text, encoding));
122
128
  }}
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:
129
+ goto st34;
130
+ tr7:
131
131
  #line 23 "ext/xrb/template.rl"
132
132
  {
133
133
  XRB_raise_error("failed to parse instruction", buffer, p-s);
134
134
  }
135
- #line 43 "ext/xrb/template.rl"
135
+ #line 64 "ext/xrb/template.rl"
136
136
  {{p = ((te))-1;}{
137
- rb_funcall(delegate, id_text, 1, XRB_string(ts, te, encoding));
137
+ if (delimiter.begin && delimiter.end) {
138
+ text.end = delimiter.begin;
139
+
140
+ // Backtrack:
141
+ p = delimiter.begin - 1;
142
+ }
143
+
144
+ rb_funcall(delegate, id_text, 1, XRB_Token_string(text, encoding));
138
145
  }}
139
- goto st43;
140
- tr14:
146
+ goto st34;
147
+ tr11:
141
148
  #line 1 "NONE"
142
149
  { switch( act ) {
143
- case 3:
150
+ case 4:
144
151
  {{p = ((te))-1;}
145
152
  rb_funcall(delegate, id_instruction, 1, XRB_Token_string(instruction, encoding));
146
153
  }
147
154
  break;
148
- case 6:
155
+ case 5:
149
156
  {{p = ((te))-1;}
150
- rb_funcall(delegate, id_text, 1, XRB_string(ts, te, encoding));
157
+ if (delimiter.begin && delimiter.end) {
158
+ text.end = delimiter.begin;
159
+
160
+ // Backtrack:
161
+ p = delimiter.begin - 1;
162
+ }
163
+
164
+ rb_funcall(delegate, id_text, 1, XRB_Token_string(text, encoding));
151
165
  }
152
166
  break;
153
167
  }
154
168
  }
155
- goto st43;
156
- tr15:
169
+ goto st34;
170
+ tr12:
157
171
  #line 19 "ext/xrb/template.rl"
158
172
  {te = p+1;{
159
173
  rb_funcall(delegate, id_instruction, 2, XRB_Token_string(instruction, encoding), newline);
160
174
  }}
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));
175
+ goto st34;
176
+ tr72:
177
+ #line 52 "ext/xrb/template.rl"
178
+ {
179
+ text.end = p;
180
+ }
181
+ #line 56 "ext/xrb/template.rl"
182
+ {
183
+ delimiter.begin = p;
184
+ }
185
+ #line 64 "ext/xrb/template.rl"
186
+ {te = p;p--;{
187
+ if (delimiter.begin && delimiter.end) {
188
+ text.end = delimiter.begin;
189
+
190
+ // Backtrack:
191
+ p = delimiter.begin - 1;
192
+ }
193
+
194
+ rb_funcall(delegate, id_text, 1, XRB_Token_string(text, encoding));
166
195
  }}
167
- goto st43;
196
+ goto st34;
168
197
  tr77:
169
- #line 43 "ext/xrb/template.rl"
198
+ #line 75 "ext/xrb/template.rl"
170
199
  {te = p;p--;{
171
- rb_funcall(delegate, id_text, 1, XRB_string(ts, te, encoding));
200
+ text.begin = ts;
201
+ text.end = te;
202
+
203
+ rb_funcall(delegate, id_text, 1, XRB_Token_string(text, encoding));
204
+ }}
205
+ goto st34;
206
+ tr78:
207
+ #line 60 "ext/xrb/template.rl"
208
+ {
209
+ delimiter.end = p;
210
+ }
211
+ #line 64 "ext/xrb/template.rl"
212
+ {te = p+1;{
213
+ if (delimiter.begin && delimiter.end) {
214
+ text.end = delimiter.begin;
215
+
216
+ // Backtrack:
217
+ p = delimiter.begin - 1;
218
+ }
219
+
220
+ rb_funcall(delegate, id_text, 1, XRB_Token_string(text, encoding));
172
221
  }}
173
- goto st43;
174
- tr80:
175
- #line 43 "ext/xrb/template.rl"
222
+ goto st34;
223
+ tr86:
224
+ #line 64 "ext/xrb/template.rl"
176
225
  {te = p;p--;{
177
- rb_funcall(delegate, id_text, 1, XRB_string(ts, te, encoding));
226
+ if (delimiter.begin && delimiter.end) {
227
+ text.end = delimiter.begin;
228
+
229
+ // Backtrack:
230
+ p = delimiter.begin - 1;
231
+ }
232
+
233
+ rb_funcall(delegate, id_text, 1, XRB_Token_string(text, encoding));
178
234
  }}
179
- goto st43;
180
- tr82:
181
- cs = 43;
182
- #line 27 "ext/xrb/template.rl"
235
+ goto st34;
236
+ tr87:
237
+ #line 58 "parsers/xrb/template.rl"
238
+ {te = p+1;{{stack[top++] = 34;goto st22;}}}
239
+ #line 60 "ext/xrb/template.rl"
183
240
  {
184
- expression.begin = p;
241
+ delimiter.end = p;
185
242
  }
186
- #line 53 "parsers/xrb/template.rl"
187
- {te = p;p--;{cs = 32;}}
188
- goto _again;
189
- tr83:
243
+ goto st34;
244
+ tr91:
190
245
  #line 15 "ext/xrb/template.rl"
191
246
  {te = p;p--;{
192
247
  rb_funcall(delegate, id_instruction, 1, XRB_Token_string(instruction, encoding));
193
248
  }}
194
- goto st43;
195
- st43:
249
+ goto st34;
250
+ st34:
196
251
  #line 1 "NONE"
197
252
  {ts = 0;}
198
253
  if ( ++p == pe )
199
- goto _test_eof43;
200
- case 43:
254
+ goto _test_eof34;
255
+ case 34:
201
256
  #line 1 "NONE"
202
257
  {ts = p;}
203
- #line 204 "ext/xrb/template.c"
258
+ #line 259 "ext/xrb/template.c"
204
259
  switch( (*p) ) {
205
- case 10: goto tr2;
206
- case 32: goto tr74;
207
- case 35: goto st12;
208
- case 60: goto st13;
260
+ case 10: goto tr69;
261
+ case 32: goto tr68;
262
+ case 35: goto tr70;
263
+ case 60: goto tr71;
209
264
  }
210
265
  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:
266
+ goto tr68;
267
+ goto tr67;
268
+ tr67:
269
+ #line 45 "ext/xrb/template.rl"
270
+ {
271
+ text.begin = p;
272
+
273
+ delimiter.begin = NULL;
274
+ delimiter.end = NULL;
275
+ }
276
+ goto st35;
277
+ st35:
218
278
  if ( ++p == pe )
219
- goto _test_eof44;
220
- case 44:
221
- #line 222 "ext/xrb/template.c"
279
+ goto _test_eof35;
280
+ case 35:
281
+ #line 282 "ext/xrb/template.c"
222
282
  switch( (*p) ) {
223
- case 10: goto tr2;
224
- case 35: goto st4;
225
- case 60: goto st5;
283
+ case 10: goto tr74;
284
+ case 35: goto tr75;
285
+ case 60: goto tr76;
226
286
  }
227
- goto tr6;
287
+ goto st35;
228
288
  tr2:
229
289
  #line 1 "NONE"
230
290
  {te = p+1;}
231
- goto st45;
232
- st45:
291
+ goto st36;
292
+ tr69:
293
+ #line 1 "NONE"
294
+ {te = p+1;}
295
+ #line 45 "ext/xrb/template.rl"
296
+ {
297
+ text.begin = p;
298
+
299
+ delimiter.begin = NULL;
300
+ delimiter.end = NULL;
301
+ }
302
+ #line 52 "ext/xrb/template.rl"
303
+ {
304
+ text.end = p;
305
+ }
306
+ #line 56 "ext/xrb/template.rl"
307
+ {
308
+ delimiter.begin = p;
309
+ }
310
+ goto st36;
311
+ tr74:
312
+ #line 1 "NONE"
313
+ {te = p+1;}
314
+ #line 52 "ext/xrb/template.rl"
315
+ {
316
+ text.end = p;
317
+ }
318
+ #line 56 "ext/xrb/template.rl"
319
+ {
320
+ delimiter.begin = p;
321
+ }
322
+ goto st36;
323
+ st36:
233
324
  if ( ++p == pe )
234
- goto _test_eof45;
235
- case 45:
236
- #line 237 "ext/xrb/template.c"
325
+ goto _test_eof36;
326
+ case 36:
327
+ #line 328 "ext/xrb/template.c"
237
328
  switch( (*p) ) {
238
329
  case 10: goto tr2;
239
330
  case 35: goto st2;
@@ -254,88 +345,345 @@ st2:
254
345
  if ( ++p == pe )
255
346
  goto _test_eof2;
256
347
  case 2:
257
- if ( (*p) == 123 )
258
- goto tr0;
348
+ switch( (*p) ) {
349
+ case 10: goto tr2;
350
+ case 35: goto st2;
351
+ case 60: goto st3;
352
+ case 123: goto tr0;
353
+ }
259
354
  goto st1;
260
355
  st3:
261
356
  if ( ++p == pe )
262
357
  goto _test_eof3;
263
358
  case 3:
264
- if ( (*p) == 63 )
265
- goto tr0;
359
+ switch( (*p) ) {
360
+ case 10: goto tr2;
361
+ case 35: goto st2;
362
+ case 60: goto st3;
363
+ case 63: goto st4;
364
+ }
266
365
  goto st1;
267
366
  st4:
268
367
  if ( ++p == pe )
269
368
  goto _test_eof4;
270
369
  case 4:
271
- if ( (*p) == 123 )
272
- goto tr5;
273
- goto tr6;
370
+ switch( (*p) ) {
371
+ case 10: goto tr2;
372
+ case 35: goto st2;
373
+ case 60: goto st3;
374
+ case 114: goto st5;
375
+ }
376
+ goto st1;
274
377
  st5:
275
378
  if ( ++p == pe )
276
379
  goto _test_eof5;
277
380
  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:
381
+ switch( (*p) ) {
382
+ case 32: goto tr0;
383
+ case 35: goto st2;
384
+ case 60: goto st3;
385
+ }
386
+ if ( 9 <= (*p) && (*p) <= 13 )
387
+ goto tr0;
388
+ goto st1;
389
+ tr75:
390
+ #line 52 "ext/xrb/template.rl"
391
+ {
392
+ text.end = p;
393
+ }
394
+ #line 56 "ext/xrb/template.rl"
395
+ {
396
+ delimiter.begin = p;
397
+ }
398
+ goto st37;
399
+ st37:
288
400
  if ( ++p == pe )
289
- goto _test_eof46;
290
- case 46:
291
- #line 292 "ext/xrb/template.c"
401
+ goto _test_eof37;
402
+ case 37:
403
+ #line 404 "ext/xrb/template.c"
292
404
  switch( (*p) ) {
293
- case 10: goto tr2;
294
- case 32: goto tr74;
295
- case 35: goto st4;
296
- case 60: goto st6;
405
+ case 10: goto tr74;
406
+ case 35: goto tr75;
407
+ case 60: goto tr76;
408
+ case 123: goto tr78;
409
+ }
410
+ goto st35;
411
+ tr76:
412
+ #line 52 "ext/xrb/template.rl"
413
+ {
414
+ text.end = p;
415
+ }
416
+ #line 56 "ext/xrb/template.rl"
417
+ {
418
+ delimiter.begin = p;
419
+ }
420
+ goto st38;
421
+ st38:
422
+ if ( ++p == pe )
423
+ goto _test_eof38;
424
+ case 38:
425
+ #line 426 "ext/xrb/template.c"
426
+ switch( (*p) ) {
427
+ case 10: goto tr74;
428
+ case 35: goto tr75;
429
+ case 60: goto tr76;
430
+ case 63: goto st39;
431
+ }
432
+ goto st35;
433
+ st39:
434
+ if ( ++p == pe )
435
+ goto _test_eof39;
436
+ case 39:
437
+ switch( (*p) ) {
438
+ case 10: goto tr74;
439
+ case 35: goto tr75;
440
+ case 60: goto tr76;
441
+ case 114: goto st40;
442
+ }
443
+ goto st35;
444
+ st40:
445
+ if ( ++p == pe )
446
+ goto _test_eof40;
447
+ case 40:
448
+ switch( (*p) ) {
449
+ case 32: goto tr78;
450
+ case 35: goto tr75;
451
+ case 60: goto tr76;
452
+ }
453
+ if ( 9 <= (*p) && (*p) <= 13 )
454
+ goto tr78;
455
+ goto st35;
456
+ tr68:
457
+ #line 45 "ext/xrb/template.rl"
458
+ {
459
+ text.begin = p;
460
+
461
+ delimiter.begin = NULL;
462
+ delimiter.end = NULL;
463
+ }
464
+ goto st41;
465
+ st41:
466
+ if ( ++p == pe )
467
+ goto _test_eof41;
468
+ case 41:
469
+ #line 470 "ext/xrb/template.c"
470
+ switch( (*p) ) {
471
+ case 10: goto tr74;
472
+ case 32: goto st41;
473
+ case 35: goto tr75;
474
+ case 60: goto tr82;
475
+ }
476
+ if ( 9 <= (*p) && (*p) <= 13 )
477
+ goto st41;
478
+ goto st35;
479
+ tr82:
480
+ #line 52 "ext/xrb/template.rl"
481
+ {
482
+ text.end = p;
483
+ }
484
+ #line 56 "ext/xrb/template.rl"
485
+ {
486
+ delimiter.begin = p;
487
+ }
488
+ goto st42;
489
+ st42:
490
+ if ( ++p == pe )
491
+ goto _test_eof42;
492
+ case 42:
493
+ #line 494 "ext/xrb/template.c"
494
+ switch( (*p) ) {
495
+ case 10: goto tr74;
496
+ case 35: goto tr75;
497
+ case 60: goto tr76;
498
+ case 63: goto st43;
499
+ }
500
+ goto st35;
501
+ st43:
502
+ if ( ++p == pe )
503
+ goto _test_eof43;
504
+ case 43:
505
+ switch( (*p) ) {
506
+ case 10: goto tr74;
507
+ case 35: goto tr75;
508
+ case 60: goto tr76;
509
+ case 114: goto st44;
510
+ }
511
+ goto st35;
512
+ st44:
513
+ if ( ++p == pe )
514
+ goto _test_eof44;
515
+ case 44:
516
+ switch( (*p) ) {
517
+ case 32: goto tr85;
518
+ case 35: goto tr75;
519
+ case 60: goto tr76;
297
520
  }
298
521
  if ( 9 <= (*p) && (*p) <= 13 )
299
- goto tr74;
300
- goto tr6;
522
+ goto tr85;
523
+ goto st35;
524
+ tr85:
525
+ #line 1 "NONE"
526
+ {te = p+1;}
527
+ #line 7 "ext/xrb/template.rl"
528
+ {
529
+ instruction.begin = p;
530
+ }
531
+ #line 60 "ext/xrb/template.rl"
532
+ {
533
+ delimiter.end = p;
534
+ }
535
+ #line 64 "ext/xrb/template.rl"
536
+ {act = 5;}
537
+ goto st45;
538
+ st45:
539
+ if ( ++p == pe )
540
+ goto _test_eof45;
541
+ case 45:
542
+ #line 543 "ext/xrb/template.c"
543
+ if ( (*p) == 63 )
544
+ goto tr9;
545
+ goto st6;
301
546
  st6:
302
547
  if ( ++p == pe )
303
548
  goto _test_eof6;
304
549
  case 6:
305
550
  if ( (*p) == 63 )
306
- goto st7;
307
- goto tr6;
551
+ goto tr9;
552
+ goto st6;
553
+ tr9:
554
+ #line 11 "ext/xrb/template.rl"
555
+ {
556
+ instruction.end = p;
557
+ }
558
+ goto st7;
308
559
  st7:
309
560
  if ( ++p == pe )
310
561
  goto _test_eof7;
311
562
  case 7:
312
- if ( (*p) == 114 )
563
+ #line 564 "ext/xrb/template.c"
564
+ if ( (*p) == 62 )
313
565
  goto st8;
314
- goto tr5;
566
+ goto st6;
315
567
  st8:
316
568
  if ( ++p == pe )
317
569
  goto _test_eof8;
318
570
  case 8:
319
- if ( (*p) == 32 )
320
- goto tr10;
571
+ switch( (*p) ) {
572
+ case 10: goto tr12;
573
+ case 32: goto st8;
574
+ }
321
575
  if ( 9 <= (*p) && (*p) <= 13 )
322
- goto tr10;
323
- goto tr5;
324
- tr10:
325
- #line 7 "ext/xrb/template.rl"
576
+ goto st8;
577
+ goto tr11;
578
+ tr70:
579
+ #line 45 "ext/xrb/template.rl"
326
580
  {
327
- instruction.begin = p;
581
+ text.begin = p;
582
+
583
+ delimiter.begin = NULL;
584
+ delimiter.end = NULL;
328
585
  }
586
+ #line 52 "ext/xrb/template.rl"
587
+ {
588
+ text.end = p;
589
+ }
590
+ #line 56 "ext/xrb/template.rl"
591
+ {
592
+ delimiter.begin = p;
593
+ }
594
+ goto st46;
595
+ st46:
596
+ if ( ++p == pe )
597
+ goto _test_eof46;
598
+ case 46:
599
+ #line 600 "ext/xrb/template.c"
600
+ switch( (*p) ) {
601
+ case 10: goto tr74;
602
+ case 35: goto tr75;
603
+ case 60: goto tr76;
604
+ case 123: goto tr87;
605
+ }
606
+ goto st35;
607
+ tr71:
608
+ #line 45 "ext/xrb/template.rl"
609
+ {
610
+ text.begin = p;
611
+
612
+ delimiter.begin = NULL;
613
+ delimiter.end = NULL;
614
+ }
615
+ #line 52 "ext/xrb/template.rl"
616
+ {
617
+ text.end = p;
618
+ }
619
+ #line 56 "ext/xrb/template.rl"
620
+ {
621
+ delimiter.begin = p;
622
+ }
623
+ goto st47;
624
+ st47:
625
+ if ( ++p == pe )
626
+ goto _test_eof47;
627
+ case 47:
628
+ #line 629 "ext/xrb/template.c"
629
+ switch( (*p) ) {
630
+ case 10: goto tr74;
631
+ case 35: goto tr75;
632
+ case 60: goto tr76;
633
+ case 63: goto st48;
634
+ }
635
+ goto st35;
636
+ st48:
637
+ if ( ++p == pe )
638
+ goto _test_eof48;
639
+ case 48:
640
+ switch( (*p) ) {
641
+ case 10: goto tr74;
642
+ case 35: goto tr75;
643
+ case 60: goto tr76;
644
+ case 114: goto st49;
645
+ }
646
+ goto st35;
647
+ st49:
648
+ if ( ++p == pe )
649
+ goto _test_eof49;
650
+ case 49:
651
+ switch( (*p) ) {
652
+ case 32: goto tr90;
653
+ case 35: goto tr75;
654
+ case 60: goto tr76;
655
+ }
656
+ if ( 9 <= (*p) && (*p) <= 13 )
657
+ goto tr90;
658
+ goto st35;
659
+ tr90:
660
+ #line 1 "NONE"
661
+ {te = p+1;}
662
+ #line 7 "ext/xrb/template.rl"
663
+ {
664
+ instruction.begin = p;
665
+ }
666
+ #line 60 "ext/xrb/template.rl"
667
+ {
668
+ delimiter.end = p;
669
+ }
670
+ goto st50;
671
+ st50:
672
+ if ( ++p == pe )
673
+ goto _test_eof50;
674
+ case 50:
675
+ #line 676 "ext/xrb/template.c"
676
+ if ( (*p) == 63 )
677
+ goto tr14;
329
678
  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:
679
+ st9:
680
+ if ( ++p == pe )
681
+ goto _test_eof9;
682
+ case 9:
683
+ if ( (*p) == 63 )
684
+ goto tr14;
685
+ goto st9;
686
+ tr14:
339
687
  #line 11 "ext/xrb/template.rl"
340
688
  {
341
689
  instruction.end = p;
@@ -345,188 +693,207 @@ st10:
345
693
  if ( ++p == pe )
346
694
  goto _test_eof10;
347
695
  case 10:
348
- #line 349 "ext/xrb/template.c"
696
+ #line 697 "ext/xrb/template.c"
349
697
  if ( (*p) == 62 )
350
- goto st11;
698
+ goto tr15;
351
699
  goto st9;
700
+ tr15:
701
+ #line 1 "NONE"
702
+ {te = p+1;}
703
+ #line 15 "ext/xrb/template.rl"
704
+ {act = 4;}
705
+ goto st51;
706
+ st51:
707
+ if ( ++p == pe )
708
+ goto _test_eof51;
709
+ case 51:
710
+ #line 711 "ext/xrb/template.c"
711
+ switch( (*p) ) {
712
+ case 10: goto tr12;
713
+ case 32: goto st8;
714
+ }
715
+ if ( 9 <= (*p) && (*p) <= 13 )
716
+ goto st8;
717
+ goto tr91;
718
+ tr19:
719
+ #line 18 "parsers/xrb/template.rl"
720
+ {{stack[top++] = 11;goto st11;}}
721
+ goto st11;
352
722
  st11:
723
+ #line 1 "NONE"
724
+ {ts = 0;}
353
725
  if ( ++p == pe )
354
726
  goto _test_eof11;
355
727
  case 11:
728
+ #line 729 "ext/xrb/template.c"
356
729
  switch( (*p) ) {
357
- case 10: goto tr15;
358
- case 32: goto st11;
730
+ case 34: goto st12;
731
+ case 39: goto st20;
732
+ case 123: goto tr19;
733
+ case 125: goto tr20;
359
734
  }
360
- if ( 9 <= (*p) && (*p) <= 13 )
361
- goto st11;
362
- goto tr14;
735
+ goto st11;
736
+ tr35:
737
+ #line 14 "parsers/xrb/template.rl"
738
+ {{stack[top++] = 12;goto st11;}}
739
+ goto st12;
363
740
  st12:
741
+ #line 1 "NONE"
742
+ {ts = 0;}
364
743
  if ( ++p == pe )
365
744
  goto _test_eof12;
366
745
  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;
746
+ #line 747 "ext/xrb/template.c"
747
+ switch( (*p) ) {
748
+ case 34: goto st13;
749
+ case 35: goto st19;
750
+ }
751
+ goto st12;
752
+ tr25:
753
+ #line 18 "parsers/xrb/template.rl"
754
+ {{stack[top++] = 13;goto st11;}}
755
+ goto st13;
756
+ tr27:
757
+ #line 14 "parsers/xrb/template.rl"
758
+ {{stack[top++] = 13;goto st11;}}
759
+ #line 18 "parsers/xrb/template.rl"
760
+ {{stack[top++] = 13;goto st11;}}
761
+ goto st13;
375
762
  st13:
763
+ #line 1 "NONE"
764
+ {ts = 0;}
376
765
  if ( ++p == pe )
377
766
  goto _test_eof13;
378
767
  case 13:
379
- if ( (*p) == 63 )
380
- goto st14;
381
- goto tr6;
768
+ #line 769 "ext/xrb/template.c"
769
+ switch( (*p) ) {
770
+ case 35: goto st14;
771
+ case 39: goto st15;
772
+ case 123: goto tr25;
773
+ case 125: goto tr26;
774
+ }
775
+ goto st13;
382
776
  st14:
383
777
  if ( ++p == pe )
384
778
  goto _test_eof14;
385
779
  case 14:
386
780
  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;
781
+ case 35: goto st14;
782
+ case 39: goto st15;
783
+ case 123: goto tr27;
784
+ case 125: goto tr26;
785
+ }
786
+ goto st13;
787
+ tr34:
788
+ #line 14 "parsers/xrb/template.rl"
789
+ {{stack[top++] = 15;goto st11;}}
402
790
  goto st15;
403
791
  st15:
792
+ #line 1 "NONE"
793
+ {ts = 0;}
404
794
  if ( ++p == pe )
405
795
  goto _test_eof15;
406
796
  case 15:
797
+ #line 798 "ext/xrb/template.c"
407
798
  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);
799
+ case 34: goto st16;
800
+ case 35: goto st18;
801
+ case 39: goto st16;
434
802
  }
435
- goto st0;
436
- #line 437 "ext/xrb/template.c"
437
- st0:
438
- cs = 0;
439
- goto _out;
803
+ goto st15;
804
+ tr31:
805
+ #line 18 "parsers/xrb/template.rl"
806
+ {{stack[top++] = 16;goto st11;}}
807
+ goto st16;
808
+ tr33:
809
+ #line 14 "parsers/xrb/template.rl"
810
+ {{stack[top++] = 16;goto st11;}}
811
+ #line 18 "parsers/xrb/template.rl"
812
+ {{stack[top++] = 16;goto st11;}}
813
+ goto st16;
440
814
  st16:
815
+ #line 1 "NONE"
816
+ {ts = 0;}
441
817
  if ( ++p == pe )
442
818
  goto _test_eof16;
443
819
  case 16:
444
- if ( (*p) == 63 )
445
- goto st17;
820
+ #line 821 "ext/xrb/template.c"
821
+ switch( (*p) ) {
822
+ case 35: goto st17;
823
+ case 123: goto tr31;
824
+ case 125: goto tr32;
825
+ }
446
826
  goto st16;
447
827
  st17:
448
828
  if ( ++p == pe )
449
829
  goto _test_eof17;
450
830
  case 17:
451
- if ( (*p) == 62 )
452
- goto tr23;
831
+ switch( (*p) ) {
832
+ case 35: goto st17;
833
+ case 123: goto tr33;
834
+ case 125: goto tr32;
835
+ }
453
836
  goto st16;
837
+ tr32:
838
+ #line 20 "parsers/xrb/template.rl"
839
+ {{cs = stack[--top];goto _again;}}
840
+ goto st52;
841
+ st52:
842
+ if ( ++p == pe )
843
+ goto _test_eof52;
844
+ case 52:
845
+ #line 846 "ext/xrb/template.c"
846
+ switch( (*p) ) {
847
+ case 34: goto st16;
848
+ case 35: goto st18;
849
+ case 39: goto st16;
850
+ }
851
+ goto st15;
454
852
  st18:
455
853
  if ( ++p == pe )
456
854
  goto _test_eof18;
457
855
  case 18:
458
856
  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;
857
+ case 34: goto st16;
858
+ case 35: goto st18;
859
+ case 39: goto st16;
860
+ case 123: goto tr34;
861
+ }
480
862
  goto st15;
481
- tr24:
482
- #line 7 "ext/xrb/template.rl"
483
- {
484
- instruction.begin = p;
863
+ tr26:
864
+ #line 20 "parsers/xrb/template.rl"
865
+ {{cs = stack[--top];goto _again;}}
866
+ goto st53;
867
+ st53:
868
+ if ( ++p == pe )
869
+ goto _test_eof53;
870
+ case 53:
871
+ #line 872 "ext/xrb/template.c"
872
+ switch( (*p) ) {
873
+ case 34: goto st13;
874
+ case 35: goto st19;
485
875
  }
486
- goto st19;
876
+ goto st12;
487
877
  st19:
488
878
  if ( ++p == pe )
489
879
  goto _test_eof19;
490
880
  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;
881
+ switch( (*p) ) {
882
+ case 34: goto st13;
883
+ case 35: goto st19;
884
+ case 123: goto tr35;
499
885
  }
500
- goto st20;
886
+ goto st12;
501
887
  st20:
502
888
  if ( ++p == pe )
503
889
  goto _test_eof20;
504
890
  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;}}
891
+ if ( (*p) == 39 )
892
+ goto st21;
893
+ goto st20;
894
+ tr37:
895
+ #line 18 "parsers/xrb/template.rl"
896
+ {{stack[top++] = 21;goto st11;}}
530
897
  goto st21;
531
898
  st21:
532
899
  #line 1 "NONE"
@@ -534,39 +901,69 @@ st21:
534
901
  if ( ++p == pe )
535
902
  goto _test_eof21;
536
903
  case 21:
537
- #line 538 "ext/xrb/template.c"
904
+ #line 905 "ext/xrb/template.c"
538
905
  switch( (*p) ) {
539
- case 34: goto st22;
540
- case 39: goto st30;
541
- case 123: goto tr31;
542
- case 125: goto tr32;
906
+ case 34: goto st15;
907
+ case 123: goto tr37;
908
+ case 125: goto tr38;
543
909
  }
544
910
  goto st21;
545
- tr47:
546
- #line 13 "parsers/xrb/template.rl"
547
- {{stack[top++] = 22;goto st21;}}
548
- goto st22;
911
+ tr38:
912
+ #line 20 "parsers/xrb/template.rl"
913
+ {{cs = stack[--top];goto _again;}}
914
+ goto st54;
915
+ st54:
916
+ if ( ++p == pe )
917
+ goto _test_eof54;
918
+ case 54:
919
+ #line 920 "ext/xrb/template.c"
920
+ if ( (*p) == 39 )
921
+ goto st21;
922
+ goto st20;
923
+ tr20:
924
+ #line 20 "parsers/xrb/template.rl"
925
+ {{cs = stack[--top];goto _again;}}
926
+ goto st55;
927
+ st55:
928
+ if ( ++p == pe )
929
+ goto _test_eof55;
930
+ case 55:
931
+ #line 932 "ext/xrb/template.c"
932
+ goto st0;
933
+ st0:
934
+ cs = 0;
935
+ goto _out;
549
936
  st22:
550
937
  #line 1 "NONE"
551
938
  {ts = 0;}
552
939
  if ( ++p == pe )
553
940
  goto _test_eof22;
554
941
  case 22:
555
- #line 556 "ext/xrb/template.c"
942
+ #line 943 "ext/xrb/template.c"
556
943
  switch( (*p) ) {
557
- case 34: goto st23;
558
- case 35: goto st29;
944
+ case 34: goto tr40;
945
+ case 39: goto tr41;
946
+ case 123: goto tr42;
947
+ case 125: goto tr43;
559
948
  }
560
- goto st22;
561
- tr37:
562
- #line 17 "parsers/xrb/template.rl"
563
- {{stack[top++] = 23;goto st21;}}
949
+ goto tr39;
950
+ tr47:
951
+ #line 18 "parsers/xrb/template.rl"
952
+ {{stack[top++] = 23;goto st11;}}
564
953
  goto st23;
565
954
  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;}}
955
+ #line 27 "ext/xrb/template.rl"
956
+ {
957
+ expression.begin = p;
958
+ }
959
+ goto st23;
960
+ tr42:
961
+ #line 27 "ext/xrb/template.rl"
962
+ {
963
+ expression.begin = p;
964
+ }
965
+ #line 18 "parsers/xrb/template.rl"
966
+ {{stack[top++] = 23;goto st11;}}
570
967
  goto st23;
571
968
  st23:
572
969
  #line 1 "NONE"
@@ -574,28 +971,45 @@ st23:
574
971
  if ( ++p == pe )
575
972
  goto _test_eof23;
576
973
  case 23:
577
- #line 578 "ext/xrb/template.c"
974
+ #line 975 "ext/xrb/template.c"
578
975
  switch( (*p) ) {
579
- case 35: goto st24;
580
- case 39: goto st25;
581
- case 123: goto tr37;
582
- case 125: goto tr38;
976
+ case 34: goto st24;
977
+ case 39: goto st32;
978
+ case 123: goto tr47;
979
+ case 125: goto tr48;
583
980
  }
584
981
  goto st23;
982
+ tr63:
983
+ #line 14 "parsers/xrb/template.rl"
984
+ {{stack[top++] = 24;goto st11;}}
985
+ goto st24;
986
+ tr40:
987
+ #line 27 "ext/xrb/template.rl"
988
+ {
989
+ expression.begin = p;
990
+ }
991
+ goto st24;
585
992
  st24:
993
+ #line 1 "NONE"
994
+ {ts = 0;}
586
995
  if ( ++p == pe )
587
996
  goto _test_eof24;
588
997
  case 24:
998
+ #line 999 "ext/xrb/template.c"
589
999
  switch( (*p) ) {
590
- case 35: goto st24;
591
- case 39: goto st25;
592
- case 123: goto tr39;
593
- case 125: goto tr38;
1000
+ case 34: goto st25;
1001
+ case 35: goto st31;
594
1002
  }
595
- goto st23;
596
- tr46:
597
- #line 13 "parsers/xrb/template.rl"
598
- {{stack[top++] = 25;goto st21;}}
1003
+ goto st24;
1004
+ tr53:
1005
+ #line 18 "parsers/xrb/template.rl"
1006
+ {{stack[top++] = 25;goto st11;}}
1007
+ goto st25;
1008
+ tr55:
1009
+ #line 14 "parsers/xrb/template.rl"
1010
+ {{stack[top++] = 25;goto st11;}}
1011
+ #line 18 "parsers/xrb/template.rl"
1012
+ {{stack[top++] = 25;goto st11;}}
599
1013
  goto st25;
600
1014
  st25:
601
1015
  #line 1 "NONE"
@@ -603,163 +1017,162 @@ st25:
603
1017
  if ( ++p == pe )
604
1018
  goto _test_eof25;
605
1019
  case 25:
606
- #line 607 "ext/xrb/template.c"
1020
+ #line 1021 "ext/xrb/template.c"
607
1021
  switch( (*p) ) {
608
- case 34: goto st26;
609
- case 35: goto st28;
610
- case 39: goto st26;
1022
+ case 35: goto st26;
1023
+ case 39: goto st27;
1024
+ case 123: goto tr53;
1025
+ case 125: goto tr54;
611
1026
  }
612
1027
  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
1028
  st26:
624
- #line 1 "NONE"
625
- {ts = 0;}
626
1029
  if ( ++p == pe )
627
1030
  goto _test_eof26;
628
1031
  case 26:
629
- #line 630 "ext/xrb/template.c"
630
1032
  switch( (*p) ) {
631
- case 35: goto st27;
632
- case 123: goto tr43;
633
- case 125: goto tr44;
1033
+ case 35: goto st26;
1034
+ case 39: goto st27;
1035
+ case 123: goto tr55;
1036
+ case 125: goto tr54;
634
1037
  }
635
- goto st26;
1038
+ goto st25;
1039
+ tr62:
1040
+ #line 14 "parsers/xrb/template.rl"
1041
+ {{stack[top++] = 27;goto st11;}}
1042
+ goto st27;
636
1043
  st27:
1044
+ #line 1 "NONE"
1045
+ {ts = 0;}
637
1046
  if ( ++p == pe )
638
1047
  goto _test_eof27;
639
1048
  case 27:
1049
+ #line 1050 "ext/xrb/template.c"
640
1050
  switch( (*p) ) {
641
- case 35: goto st27;
642
- case 123: goto tr45;
643
- case 125: goto tr44;
1051
+ case 34: goto st28;
1052
+ case 35: goto st30;
1053
+ case 39: goto st28;
644
1054
  }
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;
1055
+ goto st27;
1056
+ tr59:
1057
+ #line 18 "parsers/xrb/template.rl"
1058
+ {{stack[top++] = 28;goto st11;}}
1059
+ goto st28;
1060
+ tr61:
1061
+ #line 14 "parsers/xrb/template.rl"
1062
+ {{stack[top++] = 28;goto st11;}}
1063
+ #line 18 "parsers/xrb/template.rl"
1064
+ {{stack[top++] = 28;goto st11;}}
1065
+ goto st28;
661
1066
  st28:
1067
+ #line 1 "NONE"
1068
+ {ts = 0;}
662
1069
  if ( ++p == pe )
663
1070
  goto _test_eof28;
664
1071
  case 28:
1072
+ #line 1073 "ext/xrb/template.c"
665
1073
  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
1074
  case 35: goto st29;
1075
+ case 123: goto tr59;
1076
+ case 125: goto tr60;
684
1077
  }
685
- goto st22;
1078
+ goto st28;
686
1079
  st29:
687
1080
  if ( ++p == pe )
688
1081
  goto _test_eof29;
689
1082
  case 29:
690
1083
  switch( (*p) ) {
691
- case 34: goto st23;
692
1084
  case 35: goto st29;
693
- case 123: goto tr47;
1085
+ case 123: goto tr61;
1086
+ case 125: goto tr60;
694
1087
  }
695
- goto st22;
1088
+ goto st28;
1089
+ tr60:
1090
+ #line 31 "ext/xrb/template.rl"
1091
+ {
1092
+ expression.end = p;
1093
+ }
1094
+ #line 35 "ext/xrb/template.rl"
1095
+ {
1096
+ if (expression.end > expression.begin) {
1097
+ rb_funcall(delegate, id_expression, 1, XRB_Token_string(expression, encoding));
1098
+ }
1099
+ }
1100
+ #line 21 "parsers/xrb/template.rl"
1101
+ {{cs = stack[--top];goto _again;}}
1102
+ goto st56;
1103
+ st56:
1104
+ if ( ++p == pe )
1105
+ goto _test_eof56;
1106
+ case 56:
1107
+ #line 1108 "ext/xrb/template.c"
1108
+ switch( (*p) ) {
1109
+ case 34: goto st28;
1110
+ case 35: goto st30;
1111
+ case 39: goto st28;
1112
+ }
1113
+ goto st27;
696
1114
  st30:
697
1115
  if ( ++p == pe )
698
1116
  goto _test_eof30;
699
1117
  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;
1118
+ switch( (*p) ) {
1119
+ case 34: goto st28;
1120
+ case 35: goto st30;
1121
+ case 39: goto st28;
1122
+ case 123: goto tr62;
1123
+ }
1124
+ goto st27;
1125
+ tr54:
1126
+ #line 31 "ext/xrb/template.rl"
1127
+ {
1128
+ expression.end = p;
1129
+ }
1130
+ #line 35 "ext/xrb/template.rl"
1131
+ {
1132
+ if (expression.end > expression.begin) {
1133
+ rb_funcall(delegate, id_expression, 1, XRB_Token_string(expression, encoding));
1134
+ }
1135
+ }
1136
+ #line 21 "parsers/xrb/template.rl"
1137
+ {{cs = stack[--top];goto _again;}}
1138
+ goto st57;
1139
+ st57:
1140
+ if ( ++p == pe )
1141
+ goto _test_eof57;
1142
+ case 57:
1143
+ #line 1144 "ext/xrb/template.c"
1144
+ switch( (*p) ) {
1145
+ case 34: goto st25;
1146
+ case 35: goto st31;
1147
+ }
1148
+ goto st24;
707
1149
  st31:
708
- #line 1 "NONE"
709
- {ts = 0;}
710
1150
  if ( ++p == pe )
711
1151
  goto _test_eof31;
712
1152
  case 31:
713
- #line 714 "ext/xrb/template.c"
714
1153
  switch( (*p) ) {
715
1154
  case 34: goto st25;
716
- case 123: goto tr49;
717
- case 125: goto tr50;
1155
+ case 35: goto st31;
1156
+ case 123: goto tr63;
1157
+ }
1158
+ goto st24;
1159
+ tr41:
1160
+ #line 27 "ext/xrb/template.rl"
1161
+ {
1162
+ expression.begin = p;
718
1163
  }
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
1164
  goto st32;
746
1165
  st32:
747
- #line 1 "NONE"
748
- {ts = 0;}
749
1166
  if ( ++p == pe )
750
1167
  goto _test_eof32;
751
1168
  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
- }
1169
+ #line 1170 "ext/xrb/template.c"
1170
+ if ( (*p) == 39 )
1171
+ goto st33;
759
1172
  goto st32;
760
- tr70:
761
- #line 13 "parsers/xrb/template.rl"
762
- {{stack[top++] = 33;goto st21;}}
1173
+ tr65:
1174
+ #line 18 "parsers/xrb/template.rl"
1175
+ {{stack[top++] = 33;goto st11;}}
763
1176
  goto st33;
764
1177
  st33:
765
1178
  #line 1 "NONE"
@@ -767,343 +1180,207 @@ st33:
767
1180
  if ( ++p == pe )
768
1181
  goto _test_eof33;
769
1182
  case 33:
770
- #line 771 "ext/xrb/template.c"
1183
+ #line 1184 "ext/xrb/template.c"
771
1184
  switch( (*p) ) {
772
- case 34: goto st34;
773
- case 35: goto st40;
1185
+ case 34: goto st27;
1186
+ case 123: goto tr65;
1187
+ case 125: goto tr66;
774
1188
  }
775
1189
  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
1190
  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
1191
  #line 31 "ext/xrb/template.rl"
899
1192
  {
900
1193
  expression.end = p;
901
1194
  }
902
1195
  #line 35 "ext/xrb/template.rl"
903
1196
  {
904
- rb_funcall(delegate, id_expression, 1, XRB_Token_string(expression, encoding));
1197
+ if (expression.end > expression.begin) {
1198
+ rb_funcall(delegate, id_expression, 1, XRB_Token_string(expression, encoding));
1199
+ }
905
1200
  }
906
1201
  #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:
1202
+ {{cs = stack[--top];goto _again;}}
1203
+ goto st58;
1204
+ st58:
930
1205
  if ( ++p == pe )
931
- goto _test_eof41;
932
- case 41:
1206
+ goto _test_eof58;
1207
+ case 58:
1208
+ #line 1209 "ext/xrb/template.c"
933
1209
  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;
1210
+ goto st33;
1211
+ goto st32;
1212
+ tr43:
1213
+ #line 27 "ext/xrb/template.rl"
1214
+ {
1215
+ expression.begin = p;
951
1216
  }
952
- goto st42;
953
- tr73:
954
- cs = 55;
955
1217
  #line 31 "ext/xrb/template.rl"
956
1218
  {
957
1219
  expression.end = p;
958
1220
  }
959
1221
  #line 35 "ext/xrb/template.rl"
960
1222
  {
961
- rb_funcall(delegate, id_expression, 1, XRB_Token_string(expression, encoding));
1223
+ if (expression.end > expression.begin) {
1224
+ rb_funcall(delegate, id_expression, 1, XRB_Token_string(expression, encoding));
1225
+ }
962
1226
  }
963
1227
  #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;
1228
+ {{cs = stack[--top];goto _again;}}
1229
+ goto st59;
1230
+ tr48:
976
1231
  #line 31 "ext/xrb/template.rl"
977
1232
  {
978
1233
  expression.end = p;
979
1234
  }
980
1235
  #line 35 "ext/xrb/template.rl"
981
1236
  {
982
- rb_funcall(delegate, id_expression, 1, XRB_Token_string(expression, encoding));
1237
+ if (expression.end > expression.begin) {
1238
+ rb_funcall(delegate, id_expression, 1, XRB_Token_string(expression, encoding));
1239
+ }
983
1240
  }
984
1241
  #line 21 "parsers/xrb/template.rl"
985
- {cs = 43;}
986
- goto _again;
987
- st56:
1242
+ {{cs = stack[--top];goto _again;}}
1243
+ goto st59;
1244
+ st59:
988
1245
  if ( ++p == pe )
989
- goto _test_eof56;
990
- case 56:
991
- #line 992 "ext/xrb/template.c"
1246
+ goto _test_eof59;
1247
+ case 59:
1248
+ #line 1249 "ext/xrb/template.c"
992
1249
  goto st0;
993
1250
  }
994
- _test_eof43: cs = 43; goto _test_eof;
995
- _test_eof44: cs = 44; goto _test_eof;
996
- _test_eof45: cs = 45; goto _test_eof;
1251
+ _test_eof34: cs = 34; goto _test_eof;
1252
+ _test_eof35: cs = 35; goto _test_eof;
1253
+ _test_eof36: cs = 36; goto _test_eof;
997
1254
  _test_eof1: cs = 1; goto _test_eof;
998
1255
  _test_eof2: cs = 2; goto _test_eof;
999
1256
  _test_eof3: cs = 3; goto _test_eof;
1000
1257
  _test_eof4: cs = 4; goto _test_eof;
1001
1258
  _test_eof5: cs = 5; goto _test_eof;
1002
- _test_eof46: cs = 46; goto _test_eof;
1259
+ _test_eof37: cs = 37; goto _test_eof;
1260
+ _test_eof38: cs = 38; goto _test_eof;
1261
+ _test_eof39: cs = 39; goto _test_eof;
1262
+ _test_eof40: cs = 40; goto _test_eof;
1263
+ _test_eof41: cs = 41; goto _test_eof;
1264
+ _test_eof42: cs = 42; goto _test_eof;
1265
+ _test_eof43: cs = 43; goto _test_eof;
1266
+ _test_eof44: cs = 44; goto _test_eof;
1267
+ _test_eof45: cs = 45; goto _test_eof;
1003
1268
  _test_eof6: cs = 6; goto _test_eof;
1004
1269
  _test_eof7: cs = 7; goto _test_eof;
1005
1270
  _test_eof8: cs = 8; goto _test_eof;
1271
+ _test_eof46: cs = 46; goto _test_eof;
1272
+ _test_eof47: cs = 47; goto _test_eof;
1273
+ _test_eof48: cs = 48; goto _test_eof;
1274
+ _test_eof49: cs = 49; goto _test_eof;
1275
+ _test_eof50: cs = 50; goto _test_eof;
1006
1276
  _test_eof9: cs = 9; goto _test_eof;
1007
1277
  _test_eof10: cs = 10; goto _test_eof;
1278
+ _test_eof51: cs = 51; goto _test_eof;
1008
1279
  _test_eof11: cs = 11; goto _test_eof;
1009
1280
  _test_eof12: cs = 12; goto _test_eof;
1010
- _test_eof47: cs = 47; goto _test_eof;
1011
1281
  _test_eof13: cs = 13; goto _test_eof;
1012
1282
  _test_eof14: cs = 14; goto _test_eof;
1013
1283
  _test_eof15: cs = 15; goto _test_eof;
1014
1284
  _test_eof16: cs = 16; goto _test_eof;
1015
1285
  _test_eof17: cs = 17; goto _test_eof;
1286
+ _test_eof52: cs = 52; goto _test_eof;
1016
1287
  _test_eof18: cs = 18; goto _test_eof;
1288
+ _test_eof53: cs = 53; goto _test_eof;
1017
1289
  _test_eof19: cs = 19; goto _test_eof;
1018
1290
  _test_eof20: cs = 20; goto _test_eof;
1019
- _test_eof48: cs = 48; goto _test_eof;
1020
1291
  _test_eof21: cs = 21; goto _test_eof;
1292
+ _test_eof54: cs = 54; goto _test_eof;
1293
+ _test_eof55: cs = 55; goto _test_eof;
1021
1294
  _test_eof22: cs = 22; goto _test_eof;
1022
1295
  _test_eof23: cs = 23; goto _test_eof;
1023
1296
  _test_eof24: cs = 24; goto _test_eof;
1024
1297
  _test_eof25: cs = 25; goto _test_eof;
1025
1298
  _test_eof26: cs = 26; goto _test_eof;
1026
1299
  _test_eof27: cs = 27; goto _test_eof;
1027
- _test_eof49: cs = 49; goto _test_eof;
1028
1300
  _test_eof28: cs = 28; goto _test_eof;
1029
- _test_eof50: cs = 50; goto _test_eof;
1030
1301
  _test_eof29: cs = 29; goto _test_eof;
1302
+ _test_eof56: cs = 56; goto _test_eof;
1031
1303
  _test_eof30: cs = 30; goto _test_eof;
1304
+ _test_eof57: cs = 57; goto _test_eof;
1032
1305
  _test_eof31: cs = 31; goto _test_eof;
1033
- _test_eof51: cs = 51; goto _test_eof;
1034
- _test_eof52: cs = 52; goto _test_eof;
1035
1306
  _test_eof32: cs = 32; goto _test_eof;
1036
1307
  _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;
1308
+ _test_eof58: cs = 58; goto _test_eof;
1309
+ _test_eof59: cs = 59; goto _test_eof;
1050
1310
 
1051
1311
  _test_eof: {}
1052
1312
  if ( p == eof )
1053
1313
  {
1054
1314
  switch ( cs ) {
1055
- case 44: goto tr77;
1056
- case 45: goto tr80;
1315
+ case 35: goto tr72;
1316
+ case 36: goto tr77;
1057
1317
  case 1: goto tr0;
1058
1318
  case 2: goto tr0;
1059
1319
  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"
1320
+ case 4: goto tr0;
1321
+ case 5: goto tr0;
1322
+ case 37: goto tr72;
1323
+ case 38: goto tr72;
1324
+ case 39: goto tr72;
1325
+ case 40: goto tr72;
1326
+ case 41: goto tr72;
1327
+ case 42: goto tr72;
1328
+ case 43: goto tr72;
1329
+ case 44: goto tr72;
1330
+ case 45: goto tr86;
1331
+ case 6: goto tr7;
1332
+ case 7: goto tr7;
1333
+ case 8: goto tr11;
1334
+ case 46: goto tr72;
1335
+ case 47: goto tr72;
1336
+ case 48: goto tr72;
1337
+ case 49: goto tr72;
1338
+ case 50: goto tr86;
1339
+ case 9: goto tr7;
1340
+ case 10: goto tr7;
1341
+ case 51: goto tr91;
1342
+ case 22:
1343
+ case 23:
1344
+ case 24:
1345
+ case 25:
1346
+ case 26:
1347
+ case 27:
1348
+ case 28:
1349
+ case 29:
1350
+ case 30:
1351
+ case 31:
1352
+ case 32:
1353
+ case 33:
1354
+ #line 41 "ext/xrb/template.rl"
1079
1355
  {
1080
- XRB_raise_error("failed to parse instruction", buffer, p-s);
1356
+ XRB_raise_error("failed to parse expression", buffer, p-s);
1081
1357
  }
1082
1358
  break;
1083
- case 32:
1084
- case 33:
1085
1359
  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"
1360
+ #line 45 "ext/xrb/template.rl"
1095
1361
  {
1096
- XRB_raise_error("failed to parse expression", buffer, p-s);
1362
+ text.begin = p;
1363
+
1364
+ delimiter.begin = NULL;
1365
+ delimiter.end = NULL;
1366
+ }
1367
+ #line 52 "ext/xrb/template.rl"
1368
+ {
1369
+ text.end = p;
1370
+ }
1371
+ #line 56 "ext/xrb/template.rl"
1372
+ {
1373
+ delimiter.begin = p;
1097
1374
  }
1098
1375
  break;
1099
- #line 1100 "ext/xrb/template.c"
1376
+ #line 1377 "ext/xrb/template.c"
1100
1377
  }
1101
1378
  }
1102
1379
 
1103
1380
  _out: {}
1104
1381
  }
1105
1382
 
1106
- #line 70 "ext/xrb/template.rl"
1383
+ #line 109 "ext/xrb/template.rl"
1107
1384
 
1108
1385
 
1109
1386
  if (p != eof) {