oga 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,67 @@
1
+ # Manually Creating Documents
2
+
3
+ Besides being able to parse documents, Oga also allows you to create documents
4
+ manually. This can be useful if you want to dynamically generate XML/HTML.
5
+
6
+ Documents can be greated in two ways:
7
+
8
+ 1. Full blown documents (using {Oga::XML::Document})
9
+ 2. XML fragments (using just {Oga::XML::Element} and the likes)
10
+
11
+ For example, lets create a document with a specific encoding and a single
12
+ element:
13
+
14
+ xml_decl = Oga::XML::XmlDeclaration.new(:encoding => 'UTF-16')
15
+ document = Oga::XML::Document.new(:xml_declaration => xml_decl)
16
+ element = Oga::XML::Element.new(:name => 'example')
17
+
18
+ document.children << element
19
+
20
+ If you now serialize this back to XML (by calling `document.to_xml`) you'd get
21
+ the following XML:
22
+
23
+ <?xml version="1.0" encoding="UTF-16" ?>
24
+ <example />
25
+
26
+ You can also serialize elements on their own:
27
+
28
+ element.to_xml
29
+
30
+ This would output:
31
+
32
+ <example />
33
+
34
+ ## Adding/Removing Attributes
35
+
36
+ The easiest way to add (or remove) attributes is by using {Oga::XML::Element#set}
37
+ and {Oga::XML::Element#unset}. For example, to add an attribute:
38
+
39
+ element = Oga::XML::Element.new(:name => 'example')
40
+
41
+ element.set('class', 'foo')
42
+
43
+ element.to_xml # => "<example class=\"foo\" />"
44
+
45
+ And to remove an attribute:
46
+
47
+ element.unset('class')
48
+
49
+ ## Modifying Text
50
+
51
+ Modifying text of elements can be done in two ways:
52
+
53
+ 1. Adding {Oga::XML::Text} instances to the list of child nodes of an
54
+ {Oga::XML::Element} instance
55
+ 2. Using {Oga::XML::Element#inner\_text=}
56
+
57
+ The second option is the easiest and recommended way of doing this. Usage is
58
+ quite simple:
59
+
60
+ element = Oga::XML::Element.new(:name => 'p')
61
+
62
+ element.inner_text = 'Hello'
63
+
64
+ element.to_xml => "<p>Hello</p>"
65
+
66
+ Special characters such as `&` and `<` are escaped automatically when calling
67
+ {Oga::XML::Element#to_xml}.
@@ -0,0 +1,63 @@
1
+ # XML Namespaces
2
+
3
+ Oga fully supports registering XML namespaces and querying elements using these
4
+ namespaces, including alternative default namespaces.
5
+
6
+ Namespaces can be registered in two ways:
7
+
8
+ 1. Namespaces defined in the document itself (e.g. `xmlns:foo="..."`)
9
+ 2. By using {Oga::XML::Element#register\_namespace}
10
+
11
+ Note that manually registering namespaces does not alter the input document when
12
+ serialized back to XML. To do so you'll have to manually add the corresponding
13
+ attributes using {Oga::XML::Element#set}.
14
+
15
+ ## Document Namespaces
16
+
17
+ Documents can contain two types of namespaces:
18
+
19
+ 1. Named namespaces
20
+ 2. Default namespaces
21
+
22
+ The first are registered as following:
23
+
24
+ <root xmlns:foo="http://foo.com">
25
+
26
+ </root>
27
+
28
+ Here we register a new namespace with prefix "foo" and URI "http://foo.com".
29
+
30
+ Default namespaces are registered in a similar fashion, except they come without
31
+ a prefix:
32
+
33
+ <root xmlns="http://foo.com">
34
+
35
+ </root>
36
+
37
+ ## Manually Registered Namespaces
38
+
39
+ If you ever want to register a namespace yourself, without having to first
40
+ change the input document, you can do so as following:
41
+
42
+ element = Oga::XML::Element.new(:name => 'root')
43
+
44
+ element.register_namespace('foo', 'http://foo.com')
45
+
46
+ Trying to register an already existing namespace will result in `ArgumentError`
47
+ being raised.
48
+
49
+ ## Listing Namespaces
50
+
51
+ To query all the namespaces available to an element you can use
52
+ {Oga::XML::Element#available\_namespaces}. This method returns a Hash
53
+ containing all {Oga::XML::Namespace} instances available to the element. The
54
+ keys are the namespace prefixes, the values the Namespace instances. Inner
55
+ namespaces overwrite outer namespaces.
56
+
57
+ Example:
58
+
59
+ element = Oga::XML::Element.new(:name => 'root')
60
+
61
+ element.register_namespace('foo', 'http://foo.com')
62
+
63
+ element.available_namespaces # => {"foo" => Namespace(name: "foo", uri: "http://foo.com")}
@@ -24,8 +24,11 @@ on `ts` and `te`) so the macro ignores this argument.
24
24
  #define oga_ivar_set(owner, name, value) \
25
25
  rb_ivar_set(owner, rb_intern(name), value)
26
26
 
27
+ #define advance_line(amount) \
28
+ rb_funcall(self, rb_intern("advance_line"), 1, INT2NUM(amount));
27
29
 
28
- #line 26 "ext/c/lexer.rl"
30
+
31
+ #line 29 "ext/c/lexer.rl"
29
32
 
30
33
  /**
31
34
  * Calls a method defined in the Ruby side of the lexer. The String value is
@@ -65,21 +68,23 @@ void liboga_xml_lexer_callback_simple(VALUE self, const char *name)
65
68
  }
66
69
 
67
70
 
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
+ #line 72 "ext/c/lexer.c"
72
+ static const int c_lexer_start = 29;
73
+ static const int c_lexer_first_final = 29;
71
74
  static const int c_lexer_error = 0;
72
75
 
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;
76
+ static const int c_lexer_en_proc_ins_body = 35;
77
+ static const int c_lexer_en_string_squote = 37;
78
+ static const int c_lexer_en_string_dquote = 39;
79
+ static const int c_lexer_en_doctype = 41;
80
+ static const int c_lexer_en_xml_decl = 53;
81
+ static const int c_lexer_en_element_name = 56;
82
+ static const int c_lexer_en_element_head = 58;
83
+ static const int c_lexer_en_text = 60;
84
+ static const int c_lexer_en_main = 29;
80
85
 
81
86
 
82
- #line 65 "ext/c/lexer.rl"
87
+ #line 68 "ext/c/lexer.rl"
83
88
 
84
89
  /**
85
90
  * Lexes the String specifies as the method argument. Token values have the
@@ -90,10 +95,14 @@ static const int c_lexer_en_main = 35;
90
95
  */
91
96
  VALUE oga_xml_lexer_advance(VALUE self, VALUE data_block)
92
97
  {
98
+ OgaLexerState *state;
99
+
93
100
  /* Make sure that all data passed back to Ruby has the proper encoding. */
94
101
  rb_encoding *encoding = rb_enc_get(data_block);
95
102
 
96
- char *data_str_val = StringValuePtr(data_block);
103
+ char *data_str_val = StringValueCStr(data_block);
104
+
105
+ Data_Get_Struct(self, OgaLexerState, state);
97
106
 
98
107
  const char *p = data_str_val;
99
108
  const char *pe = data_str_val + strlen(data_str_val);
@@ -102,20 +111,19 @@ VALUE oga_xml_lexer_advance(VALUE self, VALUE data_block)
102
111
  const char *te = 0;
103
112
  const char *mark = 0;
104
113
 
105
- int act = NUM2INT(oga_ivar_get(self, "@act"));
106
- int cs = NUM2INT(oga_ivar_get(self, "@cs"));
114
+ int lines = state->lines;
107
115
 
108
116
 
109
- #line 110 "ext/c/lexer.c"
117
+ #line 118 "ext/c/lexer.c"
110
118
  {
111
119
  if ( p == pe )
112
120
  goto _test_eof;
113
121
  goto _resume;
114
122
 
115
123
  _again:
116
- switch ( cs ) {
117
- case 35: goto st35;
118
- case 36: goto st36;
124
+ switch ( ( state->cs) ) {
125
+ case 29: goto st29;
126
+ case 30: goto st30;
119
127
  case 1: goto st1;
120
128
  case 2: goto st2;
121
129
  case 3: goto st3;
@@ -128,7 +136,7 @@ _again:
128
136
  case 10: goto st10;
129
137
  case 11: goto st11;
130
138
  case 12: goto st12;
131
- case 37: goto st37;
139
+ case 31: goto st31;
132
140
  case 13: goto st13;
133
141
  case 14: goto st14;
134
142
  case 15: goto st15;
@@ -141,15 +149,19 @@ _again:
141
149
  case 22: goto st22;
142
150
  case 23: goto st23;
143
151
  case 24: goto st24;
152
+ case 32: goto st32;
153
+ case 33: goto st33;
154
+ case 34: goto st34;
155
+ case 35: goto st35;
156
+ case 36: goto st36;
157
+ case 37: goto st37;
144
158
  case 38: goto st38;
145
159
  case 39: goto st39;
146
160
  case 40: goto st40;
147
161
  case 41: goto st41;
162
+ case 0: goto st0;
148
163
  case 42: goto st42;
149
164
  case 43: goto st43;
150
- case 0: goto st0;
151
- case 25: goto st25;
152
- case 26: goto st26;
153
165
  case 44: goto st44;
154
166
  case 45: goto st45;
155
167
  case 46: goto st46;
@@ -159,168 +171,160 @@ _again:
159
171
  case 50: goto st50;
160
172
  case 51: goto st51;
161
173
  case 52: goto st52;
174
+ case 25: goto st25;
175
+ case 26: goto st26;
162
176
  case 53: goto st53;
163
177
  case 54: goto st54;
164
- case 27: goto st27;
165
- case 28: goto st28;
166
178
  case 55: goto st55;
167
179
  case 56: goto st56;
168
- case 29: goto st29;
169
180
  case 57: goto st57;
170
- case 30: goto st30;
171
181
  case 58: goto st58;
182
+ case 27: goto st27;
172
183
  case 59: goto st59;
184
+ case 28: goto st28;
173
185
  case 60: goto st60;
174
186
  case 61: goto st61;
175
187
  case 62: goto st62;
176
- case 31: goto st31;
177
- case 32: goto st32;
178
- case 33: goto st33;
179
188
  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
- case 67: goto st67;
185
189
  default: break;
186
190
  }
187
191
 
188
192
  if ( ++p == pe )
189
193
  goto _test_eof;
190
194
  _resume:
191
- switch ( cs )
195
+ switch ( ( state->cs) )
192
196
  {
193
197
  tr0:
194
- cs = 35;
195
- #line 280 "ext/ragel/base_lexer.rl"
198
+ ( state->cs) = 29;
199
+ #line 324 "ext/ragel/base_lexer.rl"
196
200
  {{p = ((te))-1;}{
197
201
  p--;
198
- cs = 64;
202
+ ( state->cs) = 60;
199
203
  }}
200
204
  goto _again;
201
205
  tr7:
202
- #line 56 "ext/ragel/base_lexer.rl"
206
+ #line 61 "ext/ragel/base_lexer.rl"
203
207
  {te = p+1;{
204
208
  callback("on_comment", data, encoding, ts + 4, te - 3);
205
209
  }}
206
- goto st35;
210
+ goto st29;
207
211
  tr23:
208
- #line 72 "ext/ragel/base_lexer.rl"
212
+ #line 77 "ext/ragel/base_lexer.rl"
209
213
  {te = p+1;{
210
214
  callback("on_cdata", data, encoding, ts + 9, te - 3);
211
215
  }}
212
- goto st35;
216
+ goto st29;
213
217
  tr26:
214
- #line 222 "ext/ragel/base_lexer.rl"
218
+ #line 265 "ext/ragel/base_lexer.rl"
215
219
  {te = p+1;{
216
220
  callback_simple("on_element_end");
217
221
  }}
218
- goto st35;
219
- tr44:
220
- cs = 35;
221
- #line 280 "ext/ragel/base_lexer.rl"
222
+ goto st29;
223
+ tr34:
224
+ ( state->cs) = 29;
225
+ #line 324 "ext/ragel/base_lexer.rl"
222
226
  {te = p+1;{
223
227
  p--;
224
- cs = 64;
228
+ ( state->cs) = 60;
225
229
  }}
226
230
  goto _again;
227
- tr46:
228
- cs = 35;
229
- #line 280 "ext/ragel/base_lexer.rl"
231
+ tr36:
232
+ ( state->cs) = 29;
233
+ #line 324 "ext/ragel/base_lexer.rl"
230
234
  {te = p;p--;{
231
235
  p--;
232
- cs = 64;
236
+ ( state->cs) = 60;
233
237
  }}
234
238
  goto _again;
235
- tr48:
236
- cs = 35;
237
- #line 216 "ext/ragel/base_lexer.rl"
239
+ tr38:
240
+ ( state->cs) = 29;
241
+ #line 259 "ext/ragel/base_lexer.rl"
238
242
  {te = p+1;{
239
243
  callback_simple("on_element_start");
240
244
  p--;
241
- cs = 60;
245
+ ( state->cs) = 56;
242
246
  }}
243
247
  goto _again;
244
- tr50:
245
- cs = 35;
246
- #line 140 "ext/ragel/base_lexer.rl"
248
+ tr40:
249
+ ( state->cs) = 29;
250
+ #line 181 "ext/ragel/base_lexer.rl"
247
251
  {te = p;p--;{
248
252
  callback_simple("on_doctype_start");
249
- cs = 43;
253
+ ( state->cs) = 41;
250
254
  }}
251
255
  goto _again;
252
- tr51:
253
- cs = 35;
256
+ tr41:
257
+ ( state->cs) = 29;
254
258
  #line 1 "NONE"
255
- { switch( act ) {
256
- case 26:
259
+ { switch( ( state->act) ) {
260
+ case 32:
257
261
  {{p = ((te))-1;}
258
262
  callback_simple("on_xml_decl_start");
259
- cs = 55;
263
+ ( state->cs) = 53;
260
264
  }
261
265
  break;
262
- case 29:
266
+ case 35:
263
267
  {{p = ((te))-1;}
264
268
  callback_simple("on_proc_ins_start");
265
269
  callback("on_proc_ins_name", data, encoding, ts + 2, te);
266
270
 
267
271
  mark = te;
268
272
 
269
- cs = 41;
273
+ ( state->cs) = 35;
270
274
  }
271
275
  break;
272
276
  }
273
277
  }
274
278
  goto _again;
275
- tr52:
276
- cs = 35;
277
- #line 90 "ext/ragel/base_lexer.rl"
279
+ tr42:
280
+ ( state->cs) = 29;
281
+ #line 95 "ext/ragel/base_lexer.rl"
278
282
  {te = p;p--;{
279
283
  callback_simple("on_proc_ins_start");
280
284
  callback("on_proc_ins_name", data, encoding, ts + 2, te);
281
285
 
282
286
  mark = te;
283
287
 
284
- cs = 41;
288
+ ( state->cs) = 35;
285
289
  }}
286
290
  goto _again;
287
- st35:
291
+ st29:
288
292
  #line 1 "NONE"
289
293
  {ts = 0;}
290
294
  if ( ++p == pe )
291
- goto _test_eof35;
292
- case 35:
295
+ goto _test_eof29;
296
+ case 29:
293
297
  #line 1 "NONE"
294
298
  {ts = p;}
295
- #line 296 "ext/c/lexer.c"
299
+ #line 300 "ext/c/lexer.c"
296
300
  if ( (*p) == 60 )
297
- goto tr45;
298
- goto tr44;
299
- tr45:
301
+ goto tr35;
302
+ goto tr34;
303
+ tr35:
300
304
  #line 1 "NONE"
301
305
  {te = p+1;}
302
- goto st36;
303
- st36:
306
+ goto st30;
307
+ st30:
304
308
  if ( ++p == pe )
305
- goto _test_eof36;
306
- case 36:
307
- #line 308 "ext/c/lexer.c"
309
+ goto _test_eof30;
310
+ case 30:
311
+ #line 312 "ext/c/lexer.c"
308
312
  switch( (*p) ) {
309
313
  case 33: goto st1;
310
- case 45: goto tr48;
314
+ case 45: goto tr38;
311
315
  case 47: goto st22;
312
316
  case 63: goto st24;
313
- case 95: goto tr48;
317
+ case 95: goto tr38;
314
318
  }
315
319
  if ( (*p) < 65 ) {
316
320
  if ( 48 <= (*p) && (*p) <= 57 )
317
- goto tr48;
321
+ goto tr38;
318
322
  } else if ( (*p) > 90 ) {
319
323
  if ( 97 <= (*p) && (*p) <= 122 )
320
- goto tr48;
324
+ goto tr38;
321
325
  } else
322
- goto tr48;
323
- goto tr46;
326
+ goto tr38;
327
+ goto tr36;
324
328
  st1:
325
329
  if ( ++p == pe )
326
330
  goto _test_eof1;
@@ -421,19 +425,19 @@ st12:
421
425
  goto _test_eof12;
422
426
  case 12:
423
427
  switch( (*p) ) {
424
- case 9: goto st37;
425
- case 32: goto st37;
428
+ case 9: goto st31;
429
+ case 32: goto st31;
426
430
  }
427
431
  goto tr0;
428
- st37:
432
+ st31:
429
433
  if ( ++p == pe )
430
- goto _test_eof37;
431
- case 37:
434
+ goto _test_eof31;
435
+ case 31:
432
436
  switch( (*p) ) {
433
- case 9: goto st37;
434
- case 32: goto st37;
437
+ case 9: goto st31;
438
+ case 32: goto st31;
435
439
  }
436
- goto tr50;
440
+ goto tr40;
437
441
  st13:
438
442
  if ( ++p == pe )
439
443
  goto _test_eof13;
@@ -542,7 +546,7 @@ case 24:
542
546
  switch( (*p) ) {
543
547
  case 45: goto tr27;
544
548
  case 95: goto tr27;
545
- case 120: goto st39;
549
+ case 120: goto st33;
546
550
  }
547
551
  if ( (*p) < 65 ) {
548
552
  if ( 48 <= (*p) && (*p) <= 57 )
@@ -556,20 +560,20 @@ case 24:
556
560
  tr27:
557
561
  #line 1 "NONE"
558
562
  {te = p+1;}
559
- #line 90 "ext/ragel/base_lexer.rl"
560
- {act = 29;}
561
- goto st38;
562
- tr54:
563
+ #line 95 "ext/ragel/base_lexer.rl"
564
+ {( state->act) = 35;}
565
+ goto st32;
566
+ tr44:
563
567
  #line 1 "NONE"
564
568
  {te = p+1;}
565
- #line 182 "ext/ragel/base_lexer.rl"
566
- {act = 26;}
567
- goto st38;
568
- st38:
569
+ #line 224 "ext/ragel/base_lexer.rl"
570
+ {( state->act) = 32;}
571
+ goto st32;
572
+ st32:
569
573
  if ( ++p == pe )
570
- goto _test_eof38;
571
- case 38:
572
- #line 573 "ext/c/lexer.c"
574
+ goto _test_eof32;
575
+ case 32:
576
+ #line 577 "ext/c/lexer.c"
573
577
  switch( (*p) ) {
574
578
  case 45: goto tr27;
575
579
  case 95: goto tr27;
@@ -582,15 +586,15 @@ case 38:
582
586
  goto tr27;
583
587
  } else
584
588
  goto tr27;
585
- goto tr51;
586
- st39:
589
+ goto tr41;
590
+ st33:
587
591
  if ( ++p == pe )
588
- goto _test_eof39;
589
- case 39:
592
+ goto _test_eof33;
593
+ case 33:
590
594
  switch( (*p) ) {
591
595
  case 45: goto tr27;
592
596
  case 95: goto tr27;
593
- case 109: goto st40;
597
+ case 109: goto st34;
594
598
  }
595
599
  if ( (*p) < 65 ) {
596
600
  if ( 48 <= (*p) && (*p) <= 57 )
@@ -600,15 +604,15 @@ case 39:
600
604
  goto tr27;
601
605
  } else
602
606
  goto tr27;
603
- goto tr52;
604
- st40:
607
+ goto tr42;
608
+ st34:
605
609
  if ( ++p == pe )
606
- goto _test_eof40;
607
- case 40:
610
+ goto _test_eof34;
611
+ case 34:
608
612
  switch( (*p) ) {
609
613
  case 45: goto tr27;
610
614
  case 95: goto tr27;
611
- case 108: goto tr54;
615
+ case 108: goto tr44;
612
616
  }
613
617
  if ( (*p) < 65 ) {
614
618
  if ( 48 <= (*p) && (*p) <= 57 )
@@ -618,710 +622,799 @@ case 40:
618
622
  goto tr27;
619
623
  } else
620
624
  goto tr27;
621
- goto tr52;
622
- tr55:
623
- #line 107 "ext/ragel/base_lexer.rl"
625
+ goto tr42;
626
+ tr45:
627
+ #line 114 "ext/ragel/base_lexer.rl"
624
628
  {te = p+1;}
625
- goto st41;
626
- tr57:
627
- #line 107 "ext/ragel/base_lexer.rl"
629
+ goto st35;
630
+ tr47:
631
+ #line 114 "ext/ragel/base_lexer.rl"
628
632
  {te = p;p--;}
629
- goto st41;
630
- tr58:
631
- cs = 41;
632
- #line 100 "ext/ragel/base_lexer.rl"
633
+ goto st35;
634
+ tr48:
635
+ ( state->cs) = 35;
636
+ #line 105 "ext/ragel/base_lexer.rl"
633
637
  {te = p+1;{
634
638
  callback("on_text", data, encoding, mark, ts);
635
639
  callback_simple("on_proc_ins_end");
636
640
 
637
- cs = 35;
641
+ mark = 0;
642
+
643
+ ( state->cs) = 29;
638
644
  }}
639
645
  goto _again;
640
- st41:
646
+ st35:
641
647
  #line 1 "NONE"
642
648
  {ts = 0;}
643
649
  if ( ++p == pe )
644
- goto _test_eof41;
645
- case 41:
650
+ goto _test_eof35;
651
+ case 35:
646
652
  #line 1 "NONE"
647
653
  {ts = p;}
648
- #line 649 "ext/c/lexer.c"
654
+ #line 655 "ext/c/lexer.c"
649
655
  if ( (*p) == 63 )
650
- goto st42;
651
- goto tr55;
652
- st42:
656
+ goto st36;
657
+ goto tr45;
658
+ st36:
653
659
  if ( ++p == pe )
654
- goto _test_eof42;
655
- case 42:
660
+ goto _test_eof36;
661
+ case 36:
656
662
  if ( (*p) == 62 )
657
- goto tr58;
658
- goto tr57;
659
- tr30:
660
- #line 124 "ext/ragel/base_lexer.rl"
663
+ goto tr48;
664
+ goto tr47;
665
+ tr50:
666
+ #line 152 "ext/ragel/base_lexer.rl"
661
667
  {te = p+1;{
662
- callback("on_string", data, encoding, ts + 1, te - 1);
668
+ callback_simple("on_string_squote");
669
+
670
+ {( state->cs) = ( state->stack)[--( state->top)];goto _again;}
671
+ }}
672
+ goto st37;
673
+ tr51:
674
+ #line 126 "ext/ragel/base_lexer.rl"
675
+ {te = p;p--;{
676
+ callback("on_string_body", data, encoding, ts, te);
677
+
678
+ if ( lines > 0 )
679
+ {
680
+ advance_line(lines);
681
+
682
+ lines = 0;
683
+ }
663
684
  }}
664
- goto st43;
665
- tr33:
666
- #line 154 "ext/ragel/base_lexer.rl"
685
+ goto st37;
686
+ st37:
687
+ #line 1 "NONE"
688
+ {ts = 0;}
689
+ if ( ++p == pe )
690
+ goto _test_eof37;
691
+ case 37:
692
+ #line 1 "NONE"
693
+ {ts = p;}
694
+ #line 695 "ext/c/lexer.c"
695
+ if ( (*p) == 39 )
696
+ goto tr50;
697
+ goto tr49;
698
+ tr49:
699
+ #line 40 "ext/ragel/base_lexer.rl"
700
+ {
701
+ if ( (*p) == '\n' ) lines++;
702
+ }
703
+ goto st38;
704
+ st38:
705
+ if ( ++p == pe )
706
+ goto _test_eof38;
707
+ case 38:
708
+ #line 709 "ext/c/lexer.c"
709
+ if ( (*p) == 39 )
710
+ goto tr51;
711
+ goto tr49;
712
+ tr53:
713
+ #line 162 "ext/ragel/base_lexer.rl"
714
+ {te = p+1;{
715
+ callback_simple("on_string_dquote");
716
+
717
+ {( state->cs) = ( state->stack)[--( state->top)];goto _again;}
718
+ }}
719
+ goto st39;
720
+ tr54:
721
+ #line 126 "ext/ragel/base_lexer.rl"
722
+ {te = p;p--;{
723
+ callback("on_string_body", data, encoding, ts, te);
724
+
725
+ if ( lines > 0 )
726
+ {
727
+ advance_line(lines);
728
+
729
+ lines = 0;
730
+ }
731
+ }}
732
+ goto st39;
733
+ st39:
734
+ #line 1 "NONE"
735
+ {ts = 0;}
736
+ if ( ++p == pe )
737
+ goto _test_eof39;
738
+ case 39:
739
+ #line 1 "NONE"
740
+ {ts = p;}
741
+ #line 742 "ext/c/lexer.c"
742
+ if ( (*p) == 34 )
743
+ goto tr53;
744
+ goto tr52;
745
+ tr52:
746
+ #line 40 "ext/ragel/base_lexer.rl"
747
+ {
748
+ if ( (*p) == '\n' ) lines++;
749
+ }
750
+ goto st40;
751
+ st40:
752
+ if ( ++p == pe )
753
+ goto _test_eof40;
754
+ case 40:
755
+ #line 756 "ext/c/lexer.c"
756
+ if ( (*p) == 34 )
757
+ goto tr54;
758
+ goto tr52;
759
+ tr30:
760
+ #line 195 "ext/ragel/base_lexer.rl"
667
761
  {te = p+1;{
668
762
  callback("on_doctype_inline", data, encoding, ts + 1, te - 1);
669
763
  }}
670
- goto st43;
671
- tr59:
672
- #line 163 "ext/ragel/base_lexer.rl"
764
+ goto st41;
765
+ tr55:
766
+ #line 205 "ext/ragel/base_lexer.rl"
673
767
  {te = p+1;}
674
- goto st43;
675
- tr61:
676
- cs = 43;
677
- #line 169 "ext/ragel/base_lexer.rl"
768
+ goto st41;
769
+ tr56:
770
+ #line 143 "ext/ragel/base_lexer.rl"
771
+ {te = p+1;{
772
+ callback_simple("on_string_dquote");
773
+
774
+ {( state->stack)[( state->top)++] = 41; goto st39;}
775
+ }}
776
+ goto st41;
777
+ tr57:
778
+ #line 137 "ext/ragel/base_lexer.rl"
779
+ {te = p+1;{
780
+ callback_simple("on_string_squote");
781
+
782
+ {( state->stack)[( state->top)++] = 41; goto st37;}
783
+ }}
784
+ goto st41;
785
+ tr59:
786
+ ( state->cs) = 41;
787
+ #line 211 "ext/ragel/base_lexer.rl"
678
788
  {te = p+1;{
679
789
  callback_simple("on_doctype_end");
680
- cs = 35;
790
+ ( state->cs) = 29;
681
791
  }}
682
792
  goto _again;
683
- tr65:
793
+ tr63:
684
794
  #line 1 "NONE"
685
- { switch( act ) {
686
- case 3:
795
+ { switch( ( state->act) ) {
796
+ case 7:
687
797
  {{p = ((te))-1;}
688
798
  callback("on_doctype_type", data, encoding, ts, te);
689
799
  }
690
800
  break;
691
- case 7:
801
+ case 12:
692
802
  {{p = ((te))-1;}
693
803
  callback("on_doctype_name", data, encoding, ts, te);
694
804
  }
695
805
  break;
696
806
  }
697
807
  }
698
- goto st43;
699
- tr66:
700
- #line 165 "ext/ragel/base_lexer.rl"
808
+ goto st41;
809
+ tr64:
810
+ #line 207 "ext/ragel/base_lexer.rl"
701
811
  {te = p;p--;{
702
812
  callback("on_doctype_name", data, encoding, ts, te);
703
813
  }}
704
- goto st43;
705
- st43:
814
+ goto st41;
815
+ st41:
706
816
  #line 1 "NONE"
707
817
  {ts = 0;}
708
818
  if ( ++p == pe )
709
- goto _test_eof43;
710
- case 43:
819
+ goto _test_eof41;
820
+ case 41:
711
821
  #line 1 "NONE"
712
822
  {ts = p;}
713
- #line 714 "ext/c/lexer.c"
823
+ #line 824 "ext/c/lexer.c"
714
824
  switch( (*p) ) {
715
- case 9: goto tr59;
716
- case 32: goto tr59;
717
- case 34: goto st25;
718
- case 39: goto st26;
719
- case 45: goto tr60;
720
- case 62: goto tr61;
721
- case 80: goto st45;
722
- case 83: goto st50;
723
- case 91: goto st27;
724
- case 95: goto tr60;
825
+ case 9: goto tr55;
826
+ case 32: goto tr55;
827
+ case 34: goto tr56;
828
+ case 39: goto tr57;
829
+ case 45: goto tr58;
830
+ case 62: goto tr59;
831
+ case 80: goto st43;
832
+ case 83: goto st48;
833
+ case 91: goto st25;
834
+ case 95: goto tr58;
725
835
  }
726
836
  if ( (*p) < 65 ) {
727
837
  if ( 48 <= (*p) && (*p) <= 57 )
728
- goto tr60;
838
+ goto tr58;
729
839
  } else if ( (*p) > 90 ) {
730
840
  if ( 97 <= (*p) && (*p) <= 122 )
731
- goto tr60;
841
+ goto tr58;
732
842
  } else
733
- goto tr60;
843
+ goto tr58;
734
844
  goto st0;
735
845
  st0:
736
- cs = 0;
846
+ ( state->cs) = 0;
737
847
  goto _out;
738
- st25:
739
- if ( ++p == pe )
740
- goto _test_eof25;
741
- case 25:
742
- if ( (*p) == 34 )
743
- goto tr30;
744
- goto st25;
745
- st26:
746
- if ( ++p == pe )
747
- goto _test_eof26;
748
- case 26:
749
- if ( (*p) == 39 )
750
- goto tr30;
751
- goto st26;
752
- tr60:
848
+ tr58:
753
849
  #line 1 "NONE"
754
850
  {te = p+1;}
755
- #line 165 "ext/ragel/base_lexer.rl"
756
- {act = 7;}
757
- goto st44;
758
- tr71:
851
+ #line 207 "ext/ragel/base_lexer.rl"
852
+ {( state->act) = 12;}
853
+ goto st42;
854
+ tr69:
759
855
  #line 1 "NONE"
760
856
  {te = p+1;}
761
- #line 148 "ext/ragel/base_lexer.rl"
762
- {act = 3;}
763
- goto st44;
857
+ #line 189 "ext/ragel/base_lexer.rl"
858
+ {( state->act) = 7;}
859
+ goto st42;
860
+ st42:
861
+ if ( ++p == pe )
862
+ goto _test_eof42;
863
+ case 42:
864
+ #line 865 "ext/c/lexer.c"
865
+ switch( (*p) ) {
866
+ case 45: goto tr58;
867
+ case 95: goto tr58;
868
+ }
869
+ if ( (*p) < 65 ) {
870
+ if ( 48 <= (*p) && (*p) <= 57 )
871
+ goto tr58;
872
+ } else if ( (*p) > 90 ) {
873
+ if ( 97 <= (*p) && (*p) <= 122 )
874
+ goto tr58;
875
+ } else
876
+ goto tr58;
877
+ goto tr63;
878
+ st43:
879
+ if ( ++p == pe )
880
+ goto _test_eof43;
881
+ case 43:
882
+ switch( (*p) ) {
883
+ case 45: goto tr58;
884
+ case 85: goto st44;
885
+ case 95: goto tr58;
886
+ }
887
+ if ( (*p) < 65 ) {
888
+ if ( 48 <= (*p) && (*p) <= 57 )
889
+ goto tr58;
890
+ } else if ( (*p) > 90 ) {
891
+ if ( 97 <= (*p) && (*p) <= 122 )
892
+ goto tr58;
893
+ } else
894
+ goto tr58;
895
+ goto tr64;
764
896
  st44:
765
897
  if ( ++p == pe )
766
898
  goto _test_eof44;
767
899
  case 44:
768
- #line 769 "ext/c/lexer.c"
769
900
  switch( (*p) ) {
770
- case 45: goto tr60;
771
- case 95: goto tr60;
901
+ case 45: goto tr58;
902
+ case 66: goto st45;
903
+ case 95: goto tr58;
772
904
  }
773
905
  if ( (*p) < 65 ) {
774
906
  if ( 48 <= (*p) && (*p) <= 57 )
775
- goto tr60;
907
+ goto tr58;
776
908
  } else if ( (*p) > 90 ) {
777
909
  if ( 97 <= (*p) && (*p) <= 122 )
778
- goto tr60;
910
+ goto tr58;
779
911
  } else
780
- goto tr60;
781
- goto tr65;
912
+ goto tr58;
913
+ goto tr64;
782
914
  st45:
783
915
  if ( ++p == pe )
784
916
  goto _test_eof45;
785
917
  case 45:
786
918
  switch( (*p) ) {
787
- case 45: goto tr60;
788
- case 85: goto st46;
789
- case 95: goto tr60;
919
+ case 45: goto tr58;
920
+ case 76: goto st46;
921
+ case 95: goto tr58;
790
922
  }
791
923
  if ( (*p) < 65 ) {
792
924
  if ( 48 <= (*p) && (*p) <= 57 )
793
- goto tr60;
925
+ goto tr58;
794
926
  } else if ( (*p) > 90 ) {
795
927
  if ( 97 <= (*p) && (*p) <= 122 )
796
- goto tr60;
928
+ goto tr58;
797
929
  } else
798
- goto tr60;
799
- goto tr66;
930
+ goto tr58;
931
+ goto tr64;
800
932
  st46:
801
933
  if ( ++p == pe )
802
934
  goto _test_eof46;
803
935
  case 46:
804
936
  switch( (*p) ) {
805
- case 45: goto tr60;
806
- case 66: goto st47;
807
- case 95: goto tr60;
937
+ case 45: goto tr58;
938
+ case 73: goto st47;
939
+ case 95: goto tr58;
808
940
  }
809
941
  if ( (*p) < 65 ) {
810
942
  if ( 48 <= (*p) && (*p) <= 57 )
811
- goto tr60;
943
+ goto tr58;
812
944
  } else if ( (*p) > 90 ) {
813
945
  if ( 97 <= (*p) && (*p) <= 122 )
814
- goto tr60;
946
+ goto tr58;
815
947
  } else
816
- goto tr60;
817
- goto tr66;
948
+ goto tr58;
949
+ goto tr64;
818
950
  st47:
819
951
  if ( ++p == pe )
820
952
  goto _test_eof47;
821
953
  case 47:
822
954
  switch( (*p) ) {
823
- case 45: goto tr60;
824
- case 76: goto st48;
825
- case 95: goto tr60;
955
+ case 45: goto tr58;
956
+ case 67: goto tr69;
957
+ case 95: goto tr58;
826
958
  }
827
959
  if ( (*p) < 65 ) {
828
960
  if ( 48 <= (*p) && (*p) <= 57 )
829
- goto tr60;
961
+ goto tr58;
830
962
  } else if ( (*p) > 90 ) {
831
963
  if ( 97 <= (*p) && (*p) <= 122 )
832
- goto tr60;
964
+ goto tr58;
833
965
  } else
834
- goto tr60;
835
- goto tr66;
966
+ goto tr58;
967
+ goto tr64;
836
968
  st48:
837
969
  if ( ++p == pe )
838
970
  goto _test_eof48;
839
971
  case 48:
840
972
  switch( (*p) ) {
841
- case 45: goto tr60;
842
- case 73: goto st49;
843
- case 95: goto tr60;
973
+ case 45: goto tr58;
974
+ case 89: goto st49;
975
+ case 95: goto tr58;
844
976
  }
845
977
  if ( (*p) < 65 ) {
846
978
  if ( 48 <= (*p) && (*p) <= 57 )
847
- goto tr60;
979
+ goto tr58;
848
980
  } else if ( (*p) > 90 ) {
849
981
  if ( 97 <= (*p) && (*p) <= 122 )
850
- goto tr60;
982
+ goto tr58;
851
983
  } else
852
- goto tr60;
853
- goto tr66;
984
+ goto tr58;
985
+ goto tr64;
854
986
  st49:
855
987
  if ( ++p == pe )
856
988
  goto _test_eof49;
857
989
  case 49:
858
990
  switch( (*p) ) {
859
- case 45: goto tr60;
860
- case 67: goto tr71;
861
- case 95: goto tr60;
991
+ case 45: goto tr58;
992
+ case 83: goto st50;
993
+ case 95: goto tr58;
862
994
  }
863
995
  if ( (*p) < 65 ) {
864
996
  if ( 48 <= (*p) && (*p) <= 57 )
865
- goto tr60;
997
+ goto tr58;
866
998
  } else if ( (*p) > 90 ) {
867
999
  if ( 97 <= (*p) && (*p) <= 122 )
868
- goto tr60;
1000
+ goto tr58;
869
1001
  } else
870
- goto tr60;
871
- goto tr66;
1002
+ goto tr58;
1003
+ goto tr64;
872
1004
  st50:
873
1005
  if ( ++p == pe )
874
1006
  goto _test_eof50;
875
1007
  case 50:
876
1008
  switch( (*p) ) {
877
- case 45: goto tr60;
878
- case 89: goto st51;
879
- case 95: goto tr60;
1009
+ case 45: goto tr58;
1010
+ case 84: goto st51;
1011
+ case 95: goto tr58;
880
1012
  }
881
1013
  if ( (*p) < 65 ) {
882
1014
  if ( 48 <= (*p) && (*p) <= 57 )
883
- goto tr60;
1015
+ goto tr58;
884
1016
  } else if ( (*p) > 90 ) {
885
1017
  if ( 97 <= (*p) && (*p) <= 122 )
886
- goto tr60;
1018
+ goto tr58;
887
1019
  } else
888
- goto tr60;
889
- goto tr66;
1020
+ goto tr58;
1021
+ goto tr64;
890
1022
  st51:
891
1023
  if ( ++p == pe )
892
1024
  goto _test_eof51;
893
1025
  case 51:
894
1026
  switch( (*p) ) {
895
- case 45: goto tr60;
896
- case 83: goto st52;
897
- case 95: goto tr60;
1027
+ case 45: goto tr58;
1028
+ case 69: goto st52;
1029
+ case 95: goto tr58;
898
1030
  }
899
1031
  if ( (*p) < 65 ) {
900
1032
  if ( 48 <= (*p) && (*p) <= 57 )
901
- goto tr60;
1033
+ goto tr58;
902
1034
  } else if ( (*p) > 90 ) {
903
1035
  if ( 97 <= (*p) && (*p) <= 122 )
904
- goto tr60;
1036
+ goto tr58;
905
1037
  } else
906
- goto tr60;
907
- goto tr66;
1038
+ goto tr58;
1039
+ goto tr64;
908
1040
  st52:
909
1041
  if ( ++p == pe )
910
1042
  goto _test_eof52;
911
1043
  case 52:
912
1044
  switch( (*p) ) {
913
- case 45: goto tr60;
914
- case 84: goto st53;
915
- case 95: goto tr60;
1045
+ case 45: goto tr58;
1046
+ case 77: goto tr69;
1047
+ case 95: goto tr58;
916
1048
  }
917
1049
  if ( (*p) < 65 ) {
918
1050
  if ( 48 <= (*p) && (*p) <= 57 )
919
- goto tr60;
1051
+ goto tr58;
920
1052
  } else if ( (*p) > 90 ) {
921
1053
  if ( 97 <= (*p) && (*p) <= 122 )
922
- goto tr60;
1054
+ goto tr58;
923
1055
  } else
924
- goto tr60;
925
- goto tr66;
926
- st53:
927
- if ( ++p == pe )
928
- goto _test_eof53;
929
- case 53:
930
- switch( (*p) ) {
931
- case 45: goto tr60;
932
- case 69: goto st54;
933
- case 95: goto tr60;
934
- }
935
- if ( (*p) < 65 ) {
936
- if ( 48 <= (*p) && (*p) <= 57 )
937
- goto tr60;
938
- } else if ( (*p) > 90 ) {
939
- if ( 97 <= (*p) && (*p) <= 122 )
940
- goto tr60;
941
- } else
942
- goto tr60;
943
- goto tr66;
944
- st54:
945
- if ( ++p == pe )
946
- goto _test_eof54;
947
- case 54:
948
- switch( (*p) ) {
949
- case 45: goto tr60;
950
- case 77: goto tr71;
951
- case 95: goto tr60;
952
- }
953
- if ( (*p) < 65 ) {
954
- if ( 48 <= (*p) && (*p) <= 57 )
955
- goto tr60;
956
- } else if ( (*p) > 90 ) {
957
- if ( 97 <= (*p) && (*p) <= 122 )
958
- goto tr60;
959
- } else
960
- goto tr60;
961
- goto tr66;
962
- st27:
1056
+ goto tr58;
1057
+ goto tr64;
1058
+ st25:
963
1059
  if ( ++p == pe )
964
- goto _test_eof27;
965
- case 27:
966
- goto st28;
967
- st28:
1060
+ goto _test_eof25;
1061
+ case 25:
1062
+ goto st26;
1063
+ st26:
968
1064
  if ( ++p == pe )
969
- goto _test_eof28;
970
- case 28:
1065
+ goto _test_eof26;
1066
+ case 26:
971
1067
  if ( (*p) == 93 )
972
- goto tr33;
973
- goto st28;
974
- tr34:
975
- #line 201 "ext/ragel/base_lexer.rl"
976
- {{p = ((te))-1;}}
977
- goto st55;
978
- tr36:
979
- #line 124 "ext/ragel/base_lexer.rl"
1068
+ goto tr30;
1069
+ goto st26;
1070
+ tr74:
1071
+ #line 244 "ext/ragel/base_lexer.rl"
1072
+ {te = p+1;}
1073
+ goto st53;
1074
+ tr75:
1075
+ #line 143 "ext/ragel/base_lexer.rl"
980
1076
  {te = p+1;{
981
- callback("on_string", data, encoding, ts + 1, te - 1);
1077
+ callback_simple("on_string_dquote");
1078
+
1079
+ {( state->stack)[( state->top)++] = 53; goto st39;}
982
1080
  }}
983
- goto st55;
1081
+ goto st53;
984
1082
  tr76:
985
- #line 201 "ext/ragel/base_lexer.rl"
986
- {te = p+1;}
987
- goto st55;
988
- tr81:
989
- #line 201 "ext/ragel/base_lexer.rl"
990
- {te = p;p--;}
991
- goto st55;
992
- tr82:
993
- #line 195 "ext/ragel/base_lexer.rl"
1083
+ #line 137 "ext/ragel/base_lexer.rl"
1084
+ {te = p+1;{
1085
+ callback_simple("on_string_squote");
1086
+
1087
+ {( state->stack)[( state->top)++] = 53; goto st37;}
1088
+ }}
1089
+ goto st53;
1090
+ tr79:
1091
+ #line 237 "ext/ragel/base_lexer.rl"
994
1092
  {te = p;p--;{
995
1093
  callback("on_attribute", data, encoding, ts, te);
996
1094
  }}
997
- goto st55;
998
- tr83:
999
- cs = 55;
1000
- #line 189 "ext/ragel/base_lexer.rl"
1095
+ goto st53;
1096
+ tr80:
1097
+ #line 244 "ext/ragel/base_lexer.rl"
1098
+ {te = p;p--;}
1099
+ goto st53;
1100
+ tr81:
1101
+ ( state->cs) = 53;
1102
+ #line 231 "ext/ragel/base_lexer.rl"
1001
1103
  {te = p+1;{
1002
1104
  callback_simple("on_xml_decl_end");
1003
- cs = 35;
1105
+ ( state->cs) = 29;
1004
1106
  }}
1005
1107
  goto _again;
1006
- st55:
1108
+ st53:
1007
1109
  #line 1 "NONE"
1008
1110
  {ts = 0;}
1009
1111
  if ( ++p == pe )
1010
- goto _test_eof55;
1011
- case 55:
1112
+ goto _test_eof53;
1113
+ case 53:
1012
1114
  #line 1 "NONE"
1013
1115
  {ts = p;}
1014
- #line 1015 "ext/c/lexer.c"
1116
+ #line 1117 "ext/c/lexer.c"
1015
1117
  switch( (*p) ) {
1016
- case 34: goto tr77;
1017
- case 39: goto tr78;
1018
- case 45: goto st58;
1019
- case 63: goto st59;
1020
- case 95: goto st58;
1118
+ case 34: goto tr75;
1119
+ case 39: goto tr76;
1120
+ case 45: goto st54;
1121
+ case 63: goto st55;
1122
+ case 95: goto st54;
1021
1123
  }
1022
1124
  if ( (*p) < 65 ) {
1023
1125
  if ( 48 <= (*p) && (*p) <= 57 )
1024
- goto st58;
1126
+ goto st54;
1025
1127
  } else if ( (*p) > 90 ) {
1026
1128
  if ( 97 <= (*p) && (*p) <= 122 )
1027
- goto st58;
1129
+ goto st54;
1028
1130
  } else
1029
- goto st58;
1030
- goto tr76;
1031
- tr77:
1032
- #line 1 "NONE"
1033
- {te = p+1;}
1034
- goto st56;
1035
- st56:
1036
- if ( ++p == pe )
1037
- goto _test_eof56;
1038
- case 56:
1039
- #line 1040 "ext/c/lexer.c"
1040
- if ( (*p) == 34 )
1041
- goto tr36;
1042
- goto st29;
1043
- st29:
1044
- if ( ++p == pe )
1045
- goto _test_eof29;
1046
- case 29:
1047
- if ( (*p) == 34 )
1048
- goto tr36;
1049
- goto st29;
1050
- tr78:
1051
- #line 1 "NONE"
1052
- {te = p+1;}
1053
- goto st57;
1054
- st57:
1055
- if ( ++p == pe )
1056
- goto _test_eof57;
1057
- case 57:
1058
- #line 1059 "ext/c/lexer.c"
1059
- if ( (*p) == 39 )
1060
- goto tr36;
1061
- goto st30;
1062
- st30:
1063
- if ( ++p == pe )
1064
- goto _test_eof30;
1065
- case 30:
1066
- if ( (*p) == 39 )
1067
- goto tr36;
1068
- goto st30;
1069
- st58:
1131
+ goto st54;
1132
+ goto tr74;
1133
+ st54:
1070
1134
  if ( ++p == pe )
1071
- goto _test_eof58;
1072
- case 58:
1135
+ goto _test_eof54;
1136
+ case 54:
1073
1137
  switch( (*p) ) {
1074
- case 45: goto st58;
1075
- case 95: goto st58;
1138
+ case 45: goto st54;
1139
+ case 95: goto st54;
1076
1140
  }
1077
1141
  if ( (*p) < 65 ) {
1078
1142
  if ( 48 <= (*p) && (*p) <= 57 )
1079
- goto st58;
1143
+ goto st54;
1080
1144
  } else if ( (*p) > 90 ) {
1081
1145
  if ( 97 <= (*p) && (*p) <= 122 )
1082
- goto st58;
1146
+ goto st54;
1083
1147
  } else
1084
- goto st58;
1085
- goto tr82;
1086
- st59:
1148
+ goto st54;
1149
+ goto tr79;
1150
+ st55:
1087
1151
  if ( ++p == pe )
1088
- goto _test_eof59;
1089
- case 59:
1152
+ goto _test_eof55;
1153
+ case 55:
1090
1154
  if ( (*p) == 62 )
1091
- goto tr83;
1092
- goto tr81;
1093
- tr85:
1094
- cs = 60;
1095
- #line 232 "ext/ragel/base_lexer.rl"
1155
+ goto tr81;
1156
+ goto tr80;
1157
+ tr83:
1158
+ ( state->cs) = 56;
1159
+ #line 275 "ext/ragel/base_lexer.rl"
1096
1160
  {te = p;p--;{
1097
1161
  callback("on_element_name", data, encoding, ts, te);
1098
- cs = 62;
1162
+ ( state->cs) = 58;
1099
1163
  }}
1100
1164
  goto _again;
1101
- tr86:
1102
- #line 228 "ext/ragel/base_lexer.rl"
1165
+ tr84:
1166
+ #line 271 "ext/ragel/base_lexer.rl"
1103
1167
  {te = p+1;{
1104
1168
  callback("on_element_ns", data, encoding, ts, te - 1);
1105
1169
  }}
1106
- goto st60;
1107
- st60:
1170
+ goto st56;
1171
+ st56:
1108
1172
  #line 1 "NONE"
1109
1173
  {ts = 0;}
1110
1174
  if ( ++p == pe )
1111
- goto _test_eof60;
1112
- case 60:
1175
+ goto _test_eof56;
1176
+ case 56:
1113
1177
  #line 1 "NONE"
1114
1178
  {ts = p;}
1115
- #line 1116 "ext/c/lexer.c"
1179
+ #line 1180 "ext/c/lexer.c"
1116
1180
  switch( (*p) ) {
1117
- case 45: goto st61;
1118
- case 95: goto st61;
1181
+ case 45: goto st57;
1182
+ case 95: goto st57;
1119
1183
  }
1120
1184
  if ( (*p) < 65 ) {
1121
1185
  if ( 48 <= (*p) && (*p) <= 57 )
1122
- goto st61;
1186
+ goto st57;
1123
1187
  } else if ( (*p) > 90 ) {
1124
1188
  if ( 97 <= (*p) && (*p) <= 122 )
1125
- goto st61;
1189
+ goto st57;
1126
1190
  } else
1127
- goto st61;
1191
+ goto st57;
1128
1192
  goto st0;
1129
- st61:
1193
+ st57:
1130
1194
  if ( ++p == pe )
1131
- goto _test_eof61;
1132
- case 61:
1195
+ goto _test_eof57;
1196
+ case 57:
1133
1197
  switch( (*p) ) {
1134
- case 45: goto st61;
1135
- case 58: goto tr86;
1136
- case 95: goto st61;
1198
+ case 45: goto st57;
1199
+ case 58: goto tr84;
1200
+ case 95: goto st57;
1137
1201
  }
1138
1202
  if ( (*p) < 65 ) {
1139
1203
  if ( 48 <= (*p) && (*p) <= 57 )
1140
- goto st61;
1204
+ goto st57;
1141
1205
  } else if ( (*p) > 90 ) {
1142
1206
  if ( 97 <= (*p) && (*p) <= 122 )
1143
- goto st61;
1207
+ goto st57;
1144
1208
  } else
1145
- goto st61;
1146
- goto tr85;
1147
- tr38:
1148
- #line 243 "ext/ragel/base_lexer.rl"
1209
+ goto st57;
1210
+ goto tr83;
1211
+ tr31:
1212
+ #line 286 "ext/ragel/base_lexer.rl"
1149
1213
  {te = p+1;{
1150
1214
  callback_simple("advance_line");
1151
1215
  }}
1152
- goto st62;
1153
- tr41:
1154
- #line 124 "ext/ragel/base_lexer.rl"
1155
- {te = p+1;{
1156
- callback("on_string", data, encoding, ts + 1, te - 1);
1157
- }}
1158
- goto st62;
1159
- tr43:
1160
- cs = 62;
1161
- #line 266 "ext/ragel/base_lexer.rl"
1216
+ goto st58;
1217
+ tr33:
1218
+ ( state->cs) = 58;
1219
+ #line 310 "ext/ragel/base_lexer.rl"
1162
1220
  {te = p+1;{
1163
1221
  callback_simple("on_element_end");
1164
- cs = 35;
1222
+ ( state->cs) = 29;
1165
1223
  }}
1166
1224
  goto _again;
1167
- tr87:
1168
- #line 241 "ext/ragel/base_lexer.rl"
1225
+ tr85:
1226
+ #line 284 "ext/ragel/base_lexer.rl"
1169
1227
  {te = p+1;}
1170
- goto st62;
1228
+ goto st58;
1229
+ tr87:
1230
+ #line 143 "ext/ragel/base_lexer.rl"
1231
+ {te = p+1;{
1232
+ callback_simple("on_string_dquote");
1233
+
1234
+ {( state->stack)[( state->top)++] = 58; goto st39;}
1235
+ }}
1236
+ goto st58;
1237
+ tr88:
1238
+ #line 137 "ext/ragel/base_lexer.rl"
1239
+ {te = p+1;{
1240
+ callback_simple("on_string_squote");
1241
+
1242
+ {( state->stack)[( state->top)++] = 58; goto st37;}
1243
+ }}
1244
+ goto st58;
1171
1245
  tr91:
1172
- cs = 62;
1173
- #line 260 "ext/ragel/base_lexer.rl"
1246
+ ( state->cs) = 58;
1247
+ #line 304 "ext/ragel/base_lexer.rl"
1174
1248
  {te = p+1;{
1175
1249
  callback_simple("on_element_open_end");
1176
- cs = 35;
1250
+ ( state->cs) = 29;
1177
1251
  }}
1178
1252
  goto _again;
1179
1253
  tr92:
1180
- #line 252 "ext/ragel/base_lexer.rl"
1254
+ #line 295 "ext/ragel/base_lexer.rl"
1181
1255
  {te = p;p--;{
1182
1256
  callback("on_attribute", data, encoding, ts, te);
1183
1257
  }}
1184
- goto st62;
1258
+ goto st58;
1185
1259
  tr93:
1186
- #line 248 "ext/ragel/base_lexer.rl"
1260
+ #line 291 "ext/ragel/base_lexer.rl"
1187
1261
  {te = p+1;{
1188
1262
  callback("on_attribute_ns", data, encoding, ts, te - 1);
1189
1263
  }}
1190
- goto st62;
1191
- st62:
1264
+ goto st58;
1265
+ st58:
1192
1266
  #line 1 "NONE"
1193
1267
  {ts = 0;}
1194
1268
  if ( ++p == pe )
1195
- goto _test_eof62;
1196
- case 62:
1269
+ goto _test_eof58;
1270
+ case 58:
1197
1271
  #line 1 "NONE"
1198
1272
  {ts = p;}
1199
- #line 1200 "ext/c/lexer.c"
1273
+ #line 1274 "ext/c/lexer.c"
1200
1274
  switch( (*p) ) {
1201
- case 9: goto tr87;
1202
- case 10: goto tr38;
1203
- case 13: goto st31;
1204
- case 32: goto tr87;
1205
- case 34: goto st32;
1206
- case 39: goto st33;
1207
- case 45: goto st63;
1208
- case 47: goto st34;
1209
- case 61: goto tr87;
1275
+ case 9: goto tr85;
1276
+ case 10: goto tr31;
1277
+ case 13: goto st27;
1278
+ case 32: goto tr85;
1279
+ case 34: goto tr87;
1280
+ case 39: goto tr88;
1281
+ case 45: goto st59;
1282
+ case 47: goto st28;
1283
+ case 61: goto tr85;
1210
1284
  case 62: goto tr91;
1211
- case 95: goto st63;
1285
+ case 95: goto st59;
1212
1286
  }
1213
1287
  if ( (*p) < 65 ) {
1214
1288
  if ( 48 <= (*p) && (*p) <= 57 )
1215
- goto st63;
1289
+ goto st59;
1216
1290
  } else if ( (*p) > 90 ) {
1217
1291
  if ( 97 <= (*p) && (*p) <= 122 )
1218
- goto st63;
1292
+ goto st59;
1219
1293
  } else
1220
- goto st63;
1294
+ goto st59;
1221
1295
  goto st0;
1222
- st31:
1296
+ st27:
1223
1297
  if ( ++p == pe )
1224
- goto _test_eof31;
1225
- case 31:
1298
+ goto _test_eof27;
1299
+ case 27:
1226
1300
  if ( (*p) == 10 )
1227
- goto tr38;
1301
+ goto tr31;
1228
1302
  goto st0;
1229
- st32:
1230
- if ( ++p == pe )
1231
- goto _test_eof32;
1232
- case 32:
1233
- if ( (*p) == 34 )
1234
- goto tr41;
1235
- goto st32;
1236
- st33:
1237
- if ( ++p == pe )
1238
- goto _test_eof33;
1239
- case 33:
1240
- if ( (*p) == 39 )
1241
- goto tr41;
1242
- goto st33;
1243
- st63:
1303
+ st59:
1244
1304
  if ( ++p == pe )
1245
- goto _test_eof63;
1246
- case 63:
1305
+ goto _test_eof59;
1306
+ case 59:
1247
1307
  switch( (*p) ) {
1248
- case 45: goto st63;
1308
+ case 45: goto st59;
1249
1309
  case 58: goto tr93;
1250
- case 95: goto st63;
1310
+ case 95: goto st59;
1251
1311
  }
1252
1312
  if ( (*p) < 65 ) {
1253
1313
  if ( 48 <= (*p) && (*p) <= 57 )
1254
- goto st63;
1314
+ goto st59;
1255
1315
  } else if ( (*p) > 90 ) {
1256
1316
  if ( 97 <= (*p) && (*p) <= 122 )
1257
- goto st63;
1317
+ goto st59;
1258
1318
  } else
1259
- goto st63;
1319
+ goto st59;
1260
1320
  goto tr92;
1261
- st34:
1321
+ st28:
1262
1322
  if ( ++p == pe )
1263
- goto _test_eof34;
1264
- case 34:
1323
+ goto _test_eof28;
1324
+ case 28:
1265
1325
  if ( (*p) == 62 )
1266
- goto tr43;
1326
+ goto tr33;
1267
1327
  goto st0;
1268
1328
  tr96:
1269
- cs = 64;
1270
- #line 314 "ext/ragel/base_lexer.rl"
1329
+ ( state->cs) = 60;
1330
+ #line 339 "ext/ragel/base_lexer.rl"
1271
1331
  {te = p;p--;{
1272
1332
  callback("on_text", data, encoding, ts, te);
1273
- cs = 35;
1333
+
1334
+ if ( lines > 0 )
1335
+ {
1336
+ advance_line(lines);
1337
+
1338
+ lines = 0;
1339
+ }
1340
+
1341
+ ( state->cs) = 29;
1274
1342
  }}
1275
1343
  goto _again;
1276
1344
  tr98:
1277
- cs = 64;
1278
- #line 304 "ext/ragel/base_lexer.rl"
1345
+ ( state->cs) = 60;
1346
+ #line 353 "ext/ragel/base_lexer.rl"
1279
1347
  {te = p+1;{
1280
1348
  callback("on_text", data, encoding, ts, mark);
1281
1349
 
1282
1350
  p = mark - 1;
1283
1351
  mark = 0;
1284
1352
 
1285
- cs = 35;
1353
+ if ( lines > 0 )
1354
+ {
1355
+ advance_line(lines);
1356
+
1357
+ lines = 0;
1358
+ }
1359
+
1360
+ ( state->cs) = 29;
1286
1361
  }}
1287
1362
  goto _again;
1288
1363
  tr99:
1289
- cs = 64;
1290
- #line 297 "ext/ragel/base_lexer.rl"
1364
+ ( state->cs) = 60;
1365
+ #line 339 "ext/ragel/base_lexer.rl"
1291
1366
  {te = p+1;{
1292
1367
  callback("on_text", data, encoding, ts, te);
1293
1368
 
1294
- cs = 35;
1369
+ if ( lines > 0 )
1370
+ {
1371
+ advance_line(lines);
1372
+
1373
+ lines = 0;
1374
+ }
1375
+
1376
+ ( state->cs) = 29;
1295
1377
  }}
1296
1378
  goto _again;
1297
- st64:
1379
+ st60:
1298
1380
  #line 1 "NONE"
1299
1381
  {ts = 0;}
1300
1382
  if ( ++p == pe )
1301
- goto _test_eof64;
1302
- case 64:
1383
+ goto _test_eof60;
1384
+ case 60:
1303
1385
  #line 1 "NONE"
1304
1386
  {ts = p;}
1305
- #line 1306 "ext/c/lexer.c"
1387
+ #line 1388 "ext/c/lexer.c"
1306
1388
  if ( (*p) == 60 )
1307
1389
  goto tr95;
1308
- goto st65;
1309
- st65:
1390
+ goto tr94;
1391
+ tr94:
1392
+ #line 40 "ext/ragel/base_lexer.rl"
1393
+ {
1394
+ if ( (*p) == '\n' ) lines++;
1395
+ }
1396
+ goto st61;
1397
+ st61:
1310
1398
  if ( ++p == pe )
1311
- goto _test_eof65;
1312
- case 65:
1399
+ goto _test_eof61;
1400
+ case 61:
1401
+ #line 1402 "ext/c/lexer.c"
1313
1402
  if ( (*p) == 60 )
1314
1403
  goto tr97;
1315
- goto st65;
1404
+ goto tr94;
1316
1405
  tr97:
1317
- #line 304 "ext/ragel/base_lexer.rl"
1406
+ #line 40 "ext/ragel/base_lexer.rl"
1407
+ {
1408
+ if ( (*p) == '\n' ) lines++;
1409
+ }
1410
+ #line 353 "ext/ragel/base_lexer.rl"
1318
1411
  { mark = p; }
1319
- goto st66;
1320
- st66:
1412
+ goto st62;
1413
+ st62:
1321
1414
  if ( ++p == pe )
1322
- goto _test_eof66;
1323
- case 66:
1324
- #line 1325 "ext/c/lexer.c"
1415
+ goto _test_eof62;
1416
+ case 62:
1417
+ #line 1418 "ext/c/lexer.c"
1325
1418
  switch( (*p) ) {
1326
1419
  case 33: goto tr98;
1327
1420
  case 45: goto tr98;
@@ -1337,16 +1430,20 @@ case 66:
1337
1430
  goto tr98;
1338
1431
  } else
1339
1432
  goto tr98;
1340
- goto st65;
1433
+ goto tr94;
1341
1434
  tr95:
1342
- #line 304 "ext/ragel/base_lexer.rl"
1435
+ #line 40 "ext/ragel/base_lexer.rl"
1436
+ {
1437
+ if ( (*p) == '\n' ) lines++;
1438
+ }
1439
+ #line 353 "ext/ragel/base_lexer.rl"
1343
1440
  { mark = p; }
1344
- goto st67;
1345
- st67:
1441
+ goto st63;
1442
+ st63:
1346
1443
  if ( ++p == pe )
1347
- goto _test_eof67;
1348
- case 67:
1349
- #line 1350 "ext/c/lexer.c"
1444
+ goto _test_eof63;
1445
+ case 63:
1446
+ #line 1447 "ext/c/lexer.c"
1350
1447
  switch( (*p) ) {
1351
1448
  case 33: goto tr99;
1352
1449
  case 45: goto tr99;
@@ -1362,81 +1459,77 @@ case 67:
1362
1459
  goto tr99;
1363
1460
  } else
1364
1461
  goto tr99;
1365
- goto st65;
1462
+ goto tr94;
1366
1463
  }
1367
- _test_eof35: cs = 35; goto _test_eof;
1368
- _test_eof36: cs = 36; goto _test_eof;
1369
- _test_eof1: cs = 1; goto _test_eof;
1370
- _test_eof2: cs = 2; goto _test_eof;
1371
- _test_eof3: cs = 3; goto _test_eof;
1372
- _test_eof4: cs = 4; goto _test_eof;
1373
- _test_eof5: cs = 5; goto _test_eof;
1374
- _test_eof6: cs = 6; goto _test_eof;
1375
- _test_eof7: cs = 7; goto _test_eof;
1376
- _test_eof8: cs = 8; goto _test_eof;
1377
- _test_eof9: cs = 9; goto _test_eof;
1378
- _test_eof10: cs = 10; goto _test_eof;
1379
- _test_eof11: cs = 11; goto _test_eof;
1380
- _test_eof12: cs = 12; goto _test_eof;
1381
- _test_eof37: cs = 37; goto _test_eof;
1382
- _test_eof13: cs = 13; goto _test_eof;
1383
- _test_eof14: cs = 14; goto _test_eof;
1384
- _test_eof15: cs = 15; goto _test_eof;
1385
- _test_eof16: cs = 16; goto _test_eof;
1386
- _test_eof17: cs = 17; goto _test_eof;
1387
- _test_eof18: cs = 18; goto _test_eof;
1388
- _test_eof19: cs = 19; goto _test_eof;
1389
- _test_eof20: cs = 20; goto _test_eof;
1390
- _test_eof21: cs = 21; goto _test_eof;
1391
- _test_eof22: cs = 22; goto _test_eof;
1392
- _test_eof23: cs = 23; goto _test_eof;
1393
- _test_eof24: cs = 24; goto _test_eof;
1394
- _test_eof38: cs = 38; goto _test_eof;
1395
- _test_eof39: cs = 39; goto _test_eof;
1396
- _test_eof40: cs = 40; goto _test_eof;
1397
- _test_eof41: cs = 41; goto _test_eof;
1398
- _test_eof42: cs = 42; goto _test_eof;
1399
- _test_eof43: cs = 43; goto _test_eof;
1400
- _test_eof25: cs = 25; goto _test_eof;
1401
- _test_eof26: cs = 26; goto _test_eof;
1402
- _test_eof44: cs = 44; goto _test_eof;
1403
- _test_eof45: cs = 45; goto _test_eof;
1404
- _test_eof46: cs = 46; goto _test_eof;
1405
- _test_eof47: cs = 47; goto _test_eof;
1406
- _test_eof48: cs = 48; goto _test_eof;
1407
- _test_eof49: cs = 49; goto _test_eof;
1408
- _test_eof50: cs = 50; goto _test_eof;
1409
- _test_eof51: cs = 51; goto _test_eof;
1410
- _test_eof52: cs = 52; goto _test_eof;
1411
- _test_eof53: cs = 53; goto _test_eof;
1412
- _test_eof54: cs = 54; goto _test_eof;
1413
- _test_eof27: cs = 27; goto _test_eof;
1414
- _test_eof28: cs = 28; goto _test_eof;
1415
- _test_eof55: cs = 55; goto _test_eof;
1416
- _test_eof56: cs = 56; goto _test_eof;
1417
- _test_eof29: cs = 29; goto _test_eof;
1418
- _test_eof57: cs = 57; goto _test_eof;
1419
- _test_eof30: cs = 30; goto _test_eof;
1420
- _test_eof58: cs = 58; goto _test_eof;
1421
- _test_eof59: cs = 59; goto _test_eof;
1422
- _test_eof60: cs = 60; goto _test_eof;
1423
- _test_eof61: cs = 61; goto _test_eof;
1424
- _test_eof62: cs = 62; goto _test_eof;
1425
- _test_eof31: cs = 31; goto _test_eof;
1426
- _test_eof32: cs = 32; goto _test_eof;
1427
- _test_eof33: cs = 33; goto _test_eof;
1428
- _test_eof63: cs = 63; goto _test_eof;
1429
- _test_eof34: cs = 34; goto _test_eof;
1430
- _test_eof64: cs = 64; goto _test_eof;
1431
- _test_eof65: cs = 65; goto _test_eof;
1432
- _test_eof66: cs = 66; goto _test_eof;
1433
- _test_eof67: cs = 67; goto _test_eof;
1464
+ _test_eof29: ( state->cs) = 29; goto _test_eof;
1465
+ _test_eof30: ( state->cs) = 30; goto _test_eof;
1466
+ _test_eof1: ( state->cs) = 1; goto _test_eof;
1467
+ _test_eof2: ( state->cs) = 2; goto _test_eof;
1468
+ _test_eof3: ( state->cs) = 3; goto _test_eof;
1469
+ _test_eof4: ( state->cs) = 4; goto _test_eof;
1470
+ _test_eof5: ( state->cs) = 5; goto _test_eof;
1471
+ _test_eof6: ( state->cs) = 6; goto _test_eof;
1472
+ _test_eof7: ( state->cs) = 7; goto _test_eof;
1473
+ _test_eof8: ( state->cs) = 8; goto _test_eof;
1474
+ _test_eof9: ( state->cs) = 9; goto _test_eof;
1475
+ _test_eof10: ( state->cs) = 10; goto _test_eof;
1476
+ _test_eof11: ( state->cs) = 11; goto _test_eof;
1477
+ _test_eof12: ( state->cs) = 12; goto _test_eof;
1478
+ _test_eof31: ( state->cs) = 31; goto _test_eof;
1479
+ _test_eof13: ( state->cs) = 13; goto _test_eof;
1480
+ _test_eof14: ( state->cs) = 14; goto _test_eof;
1481
+ _test_eof15: ( state->cs) = 15; goto _test_eof;
1482
+ _test_eof16: ( state->cs) = 16; goto _test_eof;
1483
+ _test_eof17: ( state->cs) = 17; goto _test_eof;
1484
+ _test_eof18: ( state->cs) = 18; goto _test_eof;
1485
+ _test_eof19: ( state->cs) = 19; goto _test_eof;
1486
+ _test_eof20: ( state->cs) = 20; goto _test_eof;
1487
+ _test_eof21: ( state->cs) = 21; goto _test_eof;
1488
+ _test_eof22: ( state->cs) = 22; goto _test_eof;
1489
+ _test_eof23: ( state->cs) = 23; goto _test_eof;
1490
+ _test_eof24: ( state->cs) = 24; goto _test_eof;
1491
+ _test_eof32: ( state->cs) = 32; goto _test_eof;
1492
+ _test_eof33: ( state->cs) = 33; goto _test_eof;
1493
+ _test_eof34: ( state->cs) = 34; goto _test_eof;
1494
+ _test_eof35: ( state->cs) = 35; goto _test_eof;
1495
+ _test_eof36: ( state->cs) = 36; goto _test_eof;
1496
+ _test_eof37: ( state->cs) = 37; goto _test_eof;
1497
+ _test_eof38: ( state->cs) = 38; goto _test_eof;
1498
+ _test_eof39: ( state->cs) = 39; goto _test_eof;
1499
+ _test_eof40: ( state->cs) = 40; goto _test_eof;
1500
+ _test_eof41: ( state->cs) = 41; goto _test_eof;
1501
+ _test_eof42: ( state->cs) = 42; goto _test_eof;
1502
+ _test_eof43: ( state->cs) = 43; goto _test_eof;
1503
+ _test_eof44: ( state->cs) = 44; goto _test_eof;
1504
+ _test_eof45: ( state->cs) = 45; goto _test_eof;
1505
+ _test_eof46: ( state->cs) = 46; goto _test_eof;
1506
+ _test_eof47: ( state->cs) = 47; goto _test_eof;
1507
+ _test_eof48: ( state->cs) = 48; goto _test_eof;
1508
+ _test_eof49: ( state->cs) = 49; goto _test_eof;
1509
+ _test_eof50: ( state->cs) = 50; goto _test_eof;
1510
+ _test_eof51: ( state->cs) = 51; goto _test_eof;
1511
+ _test_eof52: ( state->cs) = 52; goto _test_eof;
1512
+ _test_eof25: ( state->cs) = 25; goto _test_eof;
1513
+ _test_eof26: ( state->cs) = 26; goto _test_eof;
1514
+ _test_eof53: ( state->cs) = 53; goto _test_eof;
1515
+ _test_eof54: ( state->cs) = 54; goto _test_eof;
1516
+ _test_eof55: ( state->cs) = 55; goto _test_eof;
1517
+ _test_eof56: ( state->cs) = 56; goto _test_eof;
1518
+ _test_eof57: ( state->cs) = 57; goto _test_eof;
1519
+ _test_eof58: ( state->cs) = 58; goto _test_eof;
1520
+ _test_eof27: ( state->cs) = 27; goto _test_eof;
1521
+ _test_eof59: ( state->cs) = 59; goto _test_eof;
1522
+ _test_eof28: ( state->cs) = 28; goto _test_eof;
1523
+ _test_eof60: ( state->cs) = 60; goto _test_eof;
1524
+ _test_eof61: ( state->cs) = 61; goto _test_eof;
1525
+ _test_eof62: ( state->cs) = 62; goto _test_eof;
1526
+ _test_eof63: ( state->cs) = 63; goto _test_eof;
1434
1527
 
1435
1528
  _test_eof: {}
1436
1529
  if ( p == eof )
1437
1530
  {
1438
- switch ( cs ) {
1439
- case 36: goto tr46;
1531
+ switch ( ( state->cs) ) {
1532
+ case 30: goto tr36;
1440
1533
  case 1: goto tr0;
1441
1534
  case 2: goto tr0;
1442
1535
  case 3: goto tr0;
@@ -1449,7 +1542,7 @@ case 67:
1449
1542
  case 10: goto tr0;
1450
1543
  case 11: goto tr0;
1451
1544
  case 12: goto tr0;
1452
- case 37: goto tr50;
1545
+ case 31: goto tr40;
1453
1546
  case 13: goto tr0;
1454
1547
  case 14: goto tr0;
1455
1548
  case 15: goto tr0;
@@ -1462,42 +1555,39 @@ case 67:
1462
1555
  case 22: goto tr0;
1463
1556
  case 23: goto tr0;
1464
1557
  case 24: goto tr0;
1558
+ case 32: goto tr41;
1559
+ case 33: goto tr42;
1560
+ case 34: goto tr42;
1561
+ case 36: goto tr47;
1465
1562
  case 38: goto tr51;
1466
- case 39: goto tr52;
1467
- case 40: goto tr52;
1468
- case 42: goto tr57;
1469
- case 44: goto tr65;
1470
- case 45: goto tr66;
1471
- case 46: goto tr66;
1472
- case 47: goto tr66;
1473
- case 48: goto tr66;
1474
- case 49: goto tr66;
1475
- case 50: goto tr66;
1476
- case 51: goto tr66;
1477
- case 52: goto tr66;
1478
- case 53: goto tr66;
1479
- case 54: goto tr66;
1480
- case 56: goto tr81;
1481
- case 29: goto tr34;
1482
- case 57: goto tr81;
1483
- case 30: goto tr34;
1484
- case 58: goto tr82;
1485
- case 59: goto tr81;
1486
- case 61: goto tr85;
1487
- case 63: goto tr92;
1488
- case 65: goto tr96;
1489
- case 66: goto tr96;
1490
- case 67: goto tr96;
1563
+ case 40: goto tr54;
1564
+ case 42: goto tr63;
1565
+ case 43: goto tr64;
1566
+ case 44: goto tr64;
1567
+ case 45: goto tr64;
1568
+ case 46: goto tr64;
1569
+ case 47: goto tr64;
1570
+ case 48: goto tr64;
1571
+ case 49: goto tr64;
1572
+ case 50: goto tr64;
1573
+ case 51: goto tr64;
1574
+ case 52: goto tr64;
1575
+ case 54: goto tr79;
1576
+ case 55: goto tr80;
1577
+ case 57: goto tr83;
1578
+ case 59: goto tr92;
1579
+ case 61: goto tr96;
1580
+ case 62: goto tr96;
1581
+ case 63: goto tr96;
1491
1582
  }
1492
1583
  }
1493
1584
 
1494
1585
  _out: {}
1495
1586
  }
1496
1587
 
1497
- #line 91 "ext/c/lexer.rl"
1588
+ #line 97 "ext/c/lexer.rl"
1498
1589
 
1499
- oga_ivar_set(self, "@act", INT2NUM(act));
1500
- oga_ivar_set(self, "@cs", INT2NUM(cs));
1590
+ state->lines = lines;
1501
1591
 
1502
1592
  return Qnil;
1503
1593
  }
@@ -1507,14 +1597,39 @@ case 67:
1507
1597
  */
1508
1598
  VALUE oga_xml_lexer_reset(VALUE self)
1509
1599
  {
1510
- oga_ivar_set(self, "@act", INT2NUM(0));
1511
- oga_ivar_set(self, "@cs", INT2NUM(c_lexer_start));
1600
+ OgaLexerState *state;
1601
+
1602
+ Data_Get_Struct(self, OgaLexerState, state);
1603
+
1604
+ state->act = 0;
1605
+ state->cs = c_lexer_start;
1606
+ state->lines = 0;
1607
+ state->top = 0;
1512
1608
 
1513
1609
  return Qnil;
1514
1610
  }
1515
1611
 
1612
+ /**
1613
+ * Frees the associated lexer state struct.
1614
+ */
1615
+ void oga_xml_lexer_free(void *state)
1616
+ {
1617
+ free((OgaLexerState *) state);
1618
+ }
1619
+
1620
+ /**
1621
+ * Allocates and wraps the C lexer state struct. This state is used to keep
1622
+ * track of the current position, line numbers, etc.
1623
+ */
1624
+ VALUE oga_xml_lexer_allocate(VALUE klass)
1625
+ {
1626
+ OgaLexerState *state = malloc(sizeof(OgaLexerState));
1516
1627
 
1517
- #line 111 "ext/c/lexer.rl"
1628
+ return Data_Wrap_Struct(klass, NULL, oga_xml_lexer_free, state);
1629
+ }
1630
+
1631
+
1632
+ #line 146 "ext/c/lexer.rl"
1518
1633
 
1519
1634
 
1520
1635
  void Init_liboga_xml_lexer()
@@ -1525,4 +1640,6 @@ void Init_liboga_xml_lexer()
1525
1640
 
1526
1641
  rb_define_method(cLexer, "advance_native", oga_xml_lexer_advance, 1);
1527
1642
  rb_define_method(cLexer, "reset_native", oga_xml_lexer_reset, 0);
1643
+
1644
+ rb_define_alloc_func(cLexer, oga_xml_lexer_allocate);
1528
1645
  }