why-hpricot 0.6.210 → 0.7.229

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,20 +20,26 @@ VALUE hpricot_css(VALUE, VALUE, VALUE, VALUE, VALUE);
20
20
  #define NO_WAY_SERIOUSLY "*** This should not happen, please send a bug report with the HTML you're parsing to why@whytheluckystiff.net. So sorry!"
21
21
 
22
22
  static VALUE sym_xmldecl, sym_doctype, sym_procins, sym_stag, sym_etag, sym_emptytag, sym_comment,
23
- sym_cdata, sym_text, sym_EMPTY, sym_CDATA;
23
+ sym_cdata, sym_name, sym_parent, sym_raw_attributes, sym_raw_string, sym_tagno,
24
+ sym_allowed, sym_text, sym_children, sym_EMPTY, sym_CDATA;
24
25
  static VALUE mHpricot, rb_eHpricotParseError;
25
- static VALUE cBaseEle, cBogusETag, cCData, cComment, cDoc, cDocType, cElem, cETag, cText,
26
+ static VALUE cBogusETag, cCData, cComment, cDoc, cDocType, cElem, cText,
26
27
  cXMLDecl, cProcIns, symAllow, symDeny;
27
28
  static ID s_ElementContent;
28
29
  static ID s_downcase, s_new, s_parent, s_read, s_to_str;
29
- static ID iv_parent;
30
30
  static VALUE reProcInsParse;
31
31
 
32
- typedef struct {
33
- int name;
34
- VALUE tag, attr, etag, raw, EC;
35
- VALUE parent, children;
36
- } hpricot_ele;
32
+ #define H_ELE_TAG 0
33
+ #define H_ELE_PARENT 1
34
+ #define H_ELE_ATTR 2
35
+ #define H_ELE_ETAG 3
36
+ #define H_ELE_RAW 4
37
+ #define H_ELE_EC 5
38
+ #define H_ELE_HASH 6
39
+ #define H_ELE_CHILDREN 7
40
+
41
+ #define H_ELE_GET(ele, idx) RSTRUCT_PTR(ele)[idx]
42
+ #define H_ELE_SET(ele, idx, val) RSTRUCT_PTR(ele)[idx] = val
37
43
 
38
44
  #define OPT(opts, key) (!NIL_P(opts) && RTEST(rb_hash_aref(opts, ID2SYM(rb_intern("" # key)))))
39
45
 
@@ -61,7 +67,7 @@ typedef struct {
61
67
 
62
68
  #define CAT(N, E) if (NIL_P(N)) { SET(N, E); } else { rb_str_cat(N, mark_##N, E - mark_##N); }
63
69
 
64
- #define SLIDE(N) if ( mark_##N > ts ) mark_##N = buf + (mark_##N - ts);
70
+ #define SLIDE(N) if (mark_##N > ts) mark_##N = buf + (mark_##N - ts);
65
71
 
66
72
  #define ATTR(K, V) \
67
73
  if (!NIL_P(K)) { \
@@ -87,11 +93,11 @@ typedef struct {
87
93
 
88
94
  #define EBLK(N, T) CAT(tag, p - T + 1); ELE(N);
89
95
 
90
- #line 134 "hpricot_scan.rl"
96
+ #line 142 "hpricot_scan.rl"
91
97
 
92
98
 
93
99
 
94
- #line 95 "hpricot_scan.c"
100
+ #line 101 "hpricot_scan.c"
95
101
  static const int hpricot_scan_start = 204;
96
102
  static const int hpricot_scan_error = -1;
97
103
 
@@ -100,7 +106,7 @@ static const int hpricot_scan_en_html_cdata = 216;
100
106
  static const int hpricot_scan_en_html_procins = 218;
101
107
  static const int hpricot_scan_en_main = 204;
102
108
 
103
- #line 137 "hpricot_scan.rl"
109
+ #line 145 "hpricot_scan.rl"
104
110
 
105
111
  #define BUFSIZE 16384
106
112
 
@@ -111,7 +117,7 @@ void rb_yield_tokens(VALUE sym, VALUE tag, VALUE attr, VALUE raw, int taint)
111
117
  raw = tag;
112
118
  }
113
119
  ary = rb_ary_new3(4, sym, tag, attr, raw);
114
- if (taint) {
120
+ if (taint) {
115
121
  OBJ_TAINT(ary);
116
122
  OBJ_TAINT(tag);
117
123
  OBJ_TAINT(attr);
@@ -120,16 +126,30 @@ void rb_yield_tokens(VALUE sym, VALUE tag, VALUE attr, VALUE raw, int taint)
120
126
  rb_yield(ary);
121
127
  }
122
128
 
129
+ #ifndef RHASH_TBL
130
+ /* rb_hash_lookup() is only in Ruby 1.8.7 */
131
+ static VALUE
132
+ our_rb_hash_lookup(VALUE hash, VALUE key)
133
+ {
134
+ VALUE val;
135
+
136
+ if (!st_lookup(RHASH(hash)->tbl, key, &val)) {
137
+ return Qnil; /* without Hash#default */
138
+ }
139
+
140
+ return val;
141
+ }
142
+ #define rb_hash_lookup our_rb_hash_lookup
143
+ #endif
144
+
123
145
  static void
124
146
  rb_hpricot_add(VALUE focus, VALUE ele)
125
147
  {
126
- hpricot_ele *he, *he2;
127
- Data_Get_Struct(focus, hpricot_ele, he);
128
- Data_Get_Struct(ele, hpricot_ele, he2);
129
- if (NIL_P(he->children))
130
- he->children = rb_ary_new();
131
- rb_ary_push(he->children, ele);
132
- he2->parent = focus;
148
+ VALUE children = H_ELE_GET(focus, H_ELE_CHILDREN);
149
+ if (NIL_P(children))
150
+ H_ELE_SET(focus, H_ELE_CHILDREN, (children = rb_ary_new2(1)));
151
+ rb_ary_push(children, ele);
152
+ H_ELE_SET(ele, H_ELE_PARENT, focus);
133
153
  }
134
154
 
135
155
  typedef struct {
@@ -140,102 +160,70 @@ typedef struct {
140
160
  unsigned char xml, strict, fixup;
141
161
  } hpricot_state;
142
162
 
143
- static void
144
- hpricot_ele_mark(hpricot_ele *he)
145
- {
146
- rb_gc_mark(he->tag);
147
- rb_gc_mark(he->attr);
148
- rb_gc_mark(he->etag);
149
- rb_gc_mark(he->raw);
150
- rb_gc_mark(he->parent);
151
- rb_gc_mark(he->children);
152
- }
153
-
154
- static void
155
- hpricot_ele_free(hpricot_ele *he)
156
- {
157
- free(he);
158
- }
159
-
160
- #define H_PROP(prop) \
163
+ #define H_PROP(prop, idx) \
161
164
  static VALUE hpricot_ele_set_##prop(VALUE self, VALUE x) { \
162
- hpricot_ele *he; \
163
- Data_Get_Struct(self, hpricot_ele, he); \
164
- he->prop = x; \
165
+ H_ELE_SET(self, idx, x); \
165
166
  return self; \
166
167
  } \
168
+ static VALUE hpricot_ele_clear_##prop(VALUE self) { \
169
+ H_ELE_SET(self, idx, Qnil); \
170
+ return Qtrue; \
171
+ } \
167
172
  static VALUE hpricot_ele_get_##prop(VALUE self) { \
168
- hpricot_ele *he; \
169
- Data_Get_Struct(self, hpricot_ele, he); \
170
- return he->prop; \
173
+ return H_ELE_GET(self, idx); \
171
174
  }
172
175
 
173
176
  #define H_ATTR(prop) \
174
177
  static VALUE hpricot_ele_set_##prop(VALUE self, VALUE x) { \
175
- hpricot_ele *he; \
176
- Data_Get_Struct(self, hpricot_ele, he); \
177
- rb_hash_aset(he->attr, ID2SYM(rb_intern("" # prop)), x); \
178
+ rb_hash_aset(H_ELE_GET(self, H_ELE_ATTR), ID2SYM(rb_intern("" # prop)), x); \
178
179
  return self; \
179
180
  } \
180
181
  static VALUE hpricot_ele_get_##prop(VALUE self) { \
181
- hpricot_ele *he; \
182
- Data_Get_Struct(self, hpricot_ele, he); \
183
- return rb_hash_aref(he->attr, ID2SYM(rb_intern("" # prop))); \
182
+ return rb_hash_aref(H_ELE_GET(self, H_ELE_ATTR), ID2SYM(rb_intern("" # prop))); \
184
183
  }
185
184
 
186
- H_PROP(tag);
187
- H_PROP(attr);
188
- H_PROP(etag);
189
- H_PROP(parent);
190
- H_PROP(children);
185
+ H_PROP(name, H_ELE_TAG);
186
+ H_PROP(raw, H_ELE_RAW);
187
+ H_PROP(parent, H_ELE_PARENT);
188
+ H_PROP(attr, H_ELE_ATTR);
189
+ H_PROP(etag, H_ELE_ETAG);
190
+ H_PROP(children, H_ELE_CHILDREN);
191
+ H_ATTR(target);
191
192
  H_ATTR(encoding);
192
193
  H_ATTR(version);
193
194
  H_ATTR(standalone);
194
195
  H_ATTR(system_id);
195
196
  H_ATTR(public_id);
196
197
 
197
- static VALUE
198
- hpricot_ele_get_raw(VALUE self, VALUE x) {
199
- hpricot_ele *he;
200
- Data_Get_Struct(self, hpricot_ele, he);
201
- return he->raw;
202
- }
203
-
204
- static VALUE
205
- hpricot_ele_clear_raw(VALUE self)
206
- {
207
- hpricot_ele *he;
208
- Data_Get_Struct(self, hpricot_ele, he);
209
- he->raw = Qnil;
210
- return Qtrue;
211
- }
212
-
213
198
  #define H_ELE(klass) \
214
- hpricot_ele *he = ALLOC(hpricot_ele); \
215
- he->name = 0; \
216
- he->tag = tag; \
217
- he->attr = attr; \
218
- he->raw = Qnil; \
219
- he->EC = ec; \
220
- he->etag = he->parent = he->children = Qnil; \
221
- if (raw != NULL && (sym == sym_emptytag || sym == sym_stag || sym == sym_etag || sym == sym_doctype)) { \
222
- he->raw = rb_str_new(raw, rawlen); \
199
+ ele = rb_obj_alloc(klass); \
200
+ if (klass == cElem) { \
201
+ H_ELE_SET(ele, H_ELE_TAG, tag); \
202
+ H_ELE_SET(ele, H_ELE_ATTR, attr); \
203
+ H_ELE_SET(ele, H_ELE_EC, ec); \
204
+ if (raw != NULL && (sym == sym_emptytag || sym == sym_stag || sym == sym_doctype)) { \
205
+ H_ELE_SET(ele, H_ELE_RAW, rb_str_new(raw, rawlen)); \
206
+ } \
207
+ } else if (klass == cDocType || klass == cProcIns || klass == cXMLDecl || klass == cBogusETag) { \
208
+ if (klass == cBogusETag) { \
209
+ H_ELE_SET(ele, H_ELE_TAG, tag); \
210
+ if (raw != NULL) \
211
+ H_ELE_SET(ele, H_ELE_ATTR, rb_str_new(raw, rawlen)); \
212
+ } else { \
213
+ if (klass == cDocType) \
214
+ ATTR(ID2SYM(rb_intern("target")), tag); \
215
+ H_ELE_SET(ele, H_ELE_ATTR, attr); \
216
+ if (klass != cProcIns) { \
217
+ tag = Qnil; \
218
+ if (raw != NULL) tag = rb_str_new(raw, rawlen); \
219
+ } \
220
+ H_ELE_SET(ele, H_ELE_TAG, tag); \
221
+ } \
222
+ } else { \
223
+ H_ELE_SET(ele, H_ELE_TAG, tag); \
223
224
  } \
224
- ele = Data_Wrap_Struct(klass, hpricot_ele_mark, hpricot_ele_free, he); \
225
225
  S->last = ele
226
226
 
227
- VALUE
228
- hpricot_ele_alloc(VALUE klass)
229
- {
230
- VALUE ele;
231
- hpricot_ele *he = ALLOC(hpricot_ele);
232
- he->name = 0;
233
- he->tag = he->attr = he->raw = he->EC = Qnil;
234
- he->etag = he->parent = he->children = Qnil;
235
- ele = Data_Wrap_Struct(klass, hpricot_ele_mark, hpricot_ele_free, he);
236
- return ele;
237
- }
238
-
239
227
  //
240
228
  // the swift, compact parser logic. most of the complicated stuff is done
241
229
  // in the lexer. this step just pairs up the start and end tags.
@@ -249,22 +237,23 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
249
237
  // in html mode, fix up start tags incorrectly formed as empty tags
250
238
  //
251
239
  if (!S->xml) {
252
- hpricot_ele *last;
253
- Data_Get_Struct(S->focus, hpricot_ele, last);
254
- if (last->EC == sym_CDATA &&
255
- (sym != sym_procins && sym != sym_comment && sym != sym_cdata && sym != sym_text) &&
256
- !(sym == sym_etag && rb_str_hash(tag) == last->name))
257
- {
258
- sym = sym_text;
259
- tag = rb_str_new(raw, rawlen);
260
- }
261
-
262
240
  if (sym == sym_emptytag || sym == sym_stag || sym == sym_etag) {
263
241
  ec = rb_hash_aref(S->EC, tag);
264
242
  if (NIL_P(ec)) {
265
243
  tag = rb_funcall(tag, s_downcase, 0);
266
244
  ec = rb_hash_aref(S->EC, tag);
267
245
  }
246
+ }
247
+
248
+ if (H_ELE_GET(S->focus, H_ELE_EC) == sym_CDATA &&
249
+ (sym != sym_procins && sym != sym_comment && sym != sym_cdata && sym != sym_text) &&
250
+ !(sym == sym_etag && INT2FIX(rb_str_hash(tag)) == H_ELE_GET(S->focus, H_ELE_HASH)))
251
+ {
252
+ sym = sym_text;
253
+ tag = rb_str_new(raw, rawlen);
254
+ }
255
+
256
+ if (!NIL_P(ec)) {
268
257
  if (sym == sym_emptytag) {
269
258
  if (ec != sym_EMPTY)
270
259
  sym = sym_stag;
@@ -276,19 +265,19 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
276
265
  }
277
266
 
278
267
  if (sym == sym_emptytag || sym == sym_stag) {
268
+ VALUE name = INT2FIX(rb_str_hash(tag));
279
269
  H_ELE(cElem);
280
- he->name = rb_str_hash(tag);
270
+ H_ELE_SET(ele, H_ELE_HASH, name);
281
271
 
282
272
  if (!S->xml) {
283
273
  VALUE match = Qnil, e = S->focus;
284
274
  while (e != S->doc)
285
275
  {
286
- hpricot_ele *hee;
287
- Data_Get_Struct(e, hpricot_ele, hee);
276
+ VALUE hEC = H_ELE_GET(e, H_ELE_EC);
288
277
 
289
- if (TYPE(hee->EC) == T_HASH)
278
+ if (TYPE(hEC) == T_HASH)
290
279
  {
291
- VALUE has = rb_hash_lookup(hee->EC, INT2NUM(he->name));
280
+ VALUE has = rb_hash_lookup(hEC, name);
292
281
  if (has != Qnil) {
293
282
  if (has == Qtrue) {
294
283
  if (match == Qnil)
@@ -301,7 +290,7 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
301
290
  }
302
291
  }
303
292
 
304
- e = hee->parent;
293
+ e = H_ELE_GET(e, H_ELE_PARENT);
305
294
  }
306
295
 
307
296
  if (match == Qnil)
@@ -323,8 +312,7 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
323
312
  }
324
313
  }
325
314
  } else if (sym == sym_etag) {
326
- int name;
327
- VALUE match = Qnil, e = S->focus;
315
+ VALUE name, match = Qnil, e = S->focus;
328
316
  if (S->strict) {
329
317
  if (NIL_P(rb_hash_aref(S->EC, tag))) {
330
318
  tag = rb_str_new2("div");
@@ -337,19 +325,16 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
337
325
  //
338
326
  // (see also: the search above for fixups)
339
327
  //
340
- name = rb_str_hash(tag);
328
+ name = INT2FIX(rb_str_hash(tag));
341
329
  while (e != S->doc)
342
330
  {
343
- hpricot_ele *he;
344
- Data_Get_Struct(e, hpricot_ele, he);
345
-
346
- if (he->name == name)
331
+ if (H_ELE_GET(e, H_ELE_HASH) == name)
347
332
  {
348
333
  match = e;
349
334
  break;
350
335
  }
351
336
 
352
- e = he->parent;
337
+ e = H_ELE_GET(e, H_ELE_PARENT);
353
338
  }
354
339
 
355
340
  if (NIL_P(match))
@@ -359,10 +344,11 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
359
344
  }
360
345
  else
361
346
  {
362
- H_ELE(cETag);
363
- Data_Get_Struct(match, hpricot_ele, he);
364
- he->etag = ele;
365
- S->focus = he->parent;
347
+ VALUE ele = Qnil;
348
+ if (raw != NULL)
349
+ ele = rb_str_new(raw, rawlen);
350
+ H_ELE_SET(match, H_ELE_ETAG, ele);
351
+ S->focus = H_ELE_GET(match, H_ELE_PARENT);
366
352
  S->last = Qnil;
367
353
  }
368
354
  } else if (sym == sym_cdata) {
@@ -382,14 +368,14 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
382
368
  VALUE match = rb_funcall(tag, rb_intern("match"), 1, reProcInsParse);
383
369
  tag = rb_reg_nth_match(1, match);
384
370
  attr = rb_reg_nth_match(2, match);
385
- H_ELE(cProcIns);
386
- rb_hpricot_add(S->focus, ele);
371
+ {
372
+ H_ELE(cProcIns);
373
+ rb_hpricot_add(S->focus, ele);
374
+ }
387
375
  } else if (sym == sym_text) {
388
376
  // TODO: add raw_string as well?
389
377
  if (!NIL_P(S->last) && RBASIC(S->last)->klass == cText) {
390
- hpricot_ele *he;
391
- Data_Get_Struct(S->last, hpricot_ele, he);
392
- rb_str_append(he->tag, tag);
378
+ rb_str_append(H_ELE_GET(S->last, H_ELE_TAG), tag);
393
379
  } else {
394
380
  H_ELE(cText);
395
381
  rb_hpricot_add(S->focus, ele);
@@ -402,7 +388,7 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
402
388
 
403
389
  VALUE hpricot_scan(int argc, VALUE *argv, VALUE self)
404
390
  {
405
- int cs, act, have = 0, nread = 0, curline = 1, text = 0;
391
+ int cs, act, have = 0, nread = 0, curline = 1, text = 0, io = 0;
406
392
  char *ts = 0, *te = 0, *buf = NULL, *eof = NULL;
407
393
 
408
394
  hpricot_state *S = NULL;
@@ -412,12 +398,13 @@ VALUE hpricot_scan(int argc, VALUE *argv, VALUE self)
412
398
  int done = 0, ele_open = 0, buffer_size = 0, taint = 0;
413
399
 
414
400
  rb_scan_args(argc, argv, "11", &port, &opts);
415
- taint = OBJ_TAINTED( port );
416
- if ( !rb_respond_to( port, s_read ) )
401
+ taint = OBJ_TAINTED(port);
402
+ io = rb_respond_to(port, s_read);
403
+ if (!io)
417
404
  {
418
- if ( rb_respond_to( port, s_to_str ) )
405
+ if (rb_respond_to(port, s_to_str))
419
406
  {
420
- port = rb_funcall( port, s_to_str, 0 );
407
+ port = rb_funcall(port, s_to_str, 0);
421
408
  StringValue(port);
422
409
  }
423
410
  else
@@ -432,10 +419,7 @@ VALUE hpricot_scan(int argc, VALUE *argv, VALUE self)
432
419
  if (!rb_block_given_p())
433
420
  {
434
421
  S = ALLOC(hpricot_state);
435
- hpricot_ele *he = ALLOC(hpricot_ele);
436
- MEMZERO(he, hpricot_ele, 1);
437
- he->tag = he->attr = he->etag = he->parent = he->children = Qnil;
438
- S->doc = Data_Wrap_Struct(cDoc, hpricot_ele_mark, hpricot_ele_free, he);
422
+ S->doc = rb_obj_alloc(cDoc);
439
423
  rb_gc_register_address(&S->doc);
440
424
  S->focus = S->doc;
441
425
  S->last = Qnil;
@@ -455,70 +439,72 @@ VALUE hpricot_scan(int argc, VALUE *argv, VALUE self)
455
439
  buffer_size = NUM2INT(bufsize);
456
440
  }
457
441
  }
458
- buf = ALLOC_N(char, buffer_size);
442
+
443
+ if (io)
444
+ buf = ALLOC_N(char, buffer_size);
459
445
 
460
446
 
461
- #line 462 "hpricot_scan.c"
447
+ #line 448 "hpricot_scan.c"
462
448
  {
463
449
  cs = hpricot_scan_start;
464
450
  ts = 0;
465
451
  te = 0;
466
452
  act = 0;
467
453
  }
468
- #line 494 "hpricot_scan.rl"
469
-
470
- while ( !done ) {
454
+ #line 482 "hpricot_scan.rl"
455
+
456
+ while (!done) {
471
457
  VALUE str;
472
458
  char *p, *pe;
473
459
  int len, space = buffer_size - have, tokstart_diff, tokend_diff, mark_tag_diff, mark_akey_diff, mark_aval_diff;
474
460
 
475
- if ( space == 0 ) {
476
- /* We've used up the entire buffer storing an already-parsed token
477
- * prefix that must be preserved. Likely caused by super-long attributes.
478
- * Increase buffer size and continue */
479
- tokstart_diff = ts - buf;
480
- tokend_diff = te - buf;
481
- mark_tag_diff = mark_tag - buf;
482
- mark_akey_diff = mark_akey - buf;
483
- mark_aval_diff = mark_aval - buf;
461
+ if (io)
462
+ {
463
+ if (space == 0) {
464
+ /* We've used up the entire buffer storing an already-parsed token
465
+ * prefix that must be preserved. Likely caused by super-long attributes.
466
+ * Increase buffer size and continue */
467
+ tokstart_diff = ts - buf;
468
+ tokend_diff = te - buf;
469
+ mark_tag_diff = mark_tag - buf;
470
+ mark_akey_diff = mark_akey - buf;
471
+ mark_aval_diff = mark_aval - buf;
484
472
 
485
- buffer_size += BUFSIZE;
486
- REALLOC_N(buf, char, buffer_size);
473
+ buffer_size += BUFSIZE;
474
+ REALLOC_N(buf, char, buffer_size);
487
475
 
488
- space = buffer_size - have;
476
+ space = buffer_size - have;
489
477
 
490
- ts= buf + tokstart_diff;
491
- te = buf + tokend_diff;
492
- mark_tag = buf + mark_tag_diff;
493
- mark_akey = buf + mark_akey_diff;
494
- mark_aval = buf + mark_aval_diff;
495
- }
496
- p = buf + have;
478
+ ts = buf + tokstart_diff;
479
+ te = buf + tokend_diff;
480
+ mark_tag = buf + mark_tag_diff;
481
+ mark_akey = buf + mark_akey_diff;
482
+ mark_aval = buf + mark_aval_diff;
483
+ }
484
+ p = buf + have;
497
485
 
498
- if ( rb_respond_to( port, s_read ) )
499
- {
500
486
  str = rb_funcall(port, s_read, 1, INT2FIX(space));
501
487
  len = RSTRING_LEN(str);
502
488
  memcpy(p, StringValuePtr(str), len);
503
489
  }
504
490
  else
505
491
  {
506
- len = RSTRING_LEN(port) - nread;
507
- if (len > space) len = space;
508
- memcpy(p, StringValuePtr(port) + nread, len);
492
+ p = RSTRING_PTR(port);
493
+ len = RSTRING_LEN(port) + 1;
494
+ done = 1;
509
495
  }
510
496
 
511
497
  nread += len;
512
498
 
513
499
  /* If this is the last buffer, tack on an EOF. */
514
- if ( len < space ) {
500
+ if (io && len < space) {
515
501
  p[len++] = 0;
516
502
  done = 1;
517
503
  }
518
504
 
519
505
  pe = p + len;
520
506
 
521
- #line 522 "hpricot_scan.c"
507
+ #line 508 "hpricot_scan.c"
522
508
  {
523
509
  if ( p == pe )
524
510
  goto _test_eof;
@@ -533,7 +519,7 @@ tr4:
533
519
  {te = p+1;{ {goto st214;} }}
534
520
  goto st204;
535
521
  tr15:
536
- #line 107 "hpricot_scan.rl"
522
+ #line 113 "hpricot_scan.rl"
537
523
  { SET(tag, p); }
538
524
  #line 66 "hpricot_scan.rl"
539
525
  {te = p+1;{ ELE(doctype); }}
@@ -565,7 +551,7 @@ tr93:
565
551
  {te = p+1;{ {goto st216;} }}
566
552
  goto st204;
567
553
  tr97:
568
- #line 107 "hpricot_scan.rl"
554
+ #line 113 "hpricot_scan.rl"
569
555
  { SET(tag, p); }
570
556
  #line 69 "hpricot_scan.rl"
571
557
  {te = p+1;{ ELE(etag); }}
@@ -575,7 +561,7 @@ tr99:
575
561
  {te = p+1;{ ELE(etag); }}
576
562
  goto st204;
577
563
  tr103:
578
- #line 107 "hpricot_scan.rl"
564
+ #line 113 "hpricot_scan.rl"
579
565
  { SET(tag, p); }
580
566
  #line 68 "hpricot_scan.rl"
581
567
  {te = p+1;{ ELE(stag); }}
@@ -585,18 +571,22 @@ tr107:
585
571
  {te = p+1;{ ELE(stag); }}
586
572
  goto st204;
587
573
  tr112:
588
- #line 114 "hpricot_scan.rl"
574
+ #line 120 "hpricot_scan.rl"
589
575
  { SET(akey, p); }
590
- #line 128 "hpricot_scan.rl"
591
- {
576
+ #line 134 "hpricot_scan.rl"
577
+ {
578
+ if (!S->xml)
579
+ akey = rb_funcall(akey, s_downcase, 0);
592
580
  ATTR(akey, aval);
593
581
  }
594
582
  #line 68 "hpricot_scan.rl"
595
583
  {te = p+1;{ ELE(stag); }}
596
584
  goto st204;
597
585
  tr117:
598
- #line 128 "hpricot_scan.rl"
599
- {
586
+ #line 134 "hpricot_scan.rl"
587
+ {
588
+ if (!S->xml)
589
+ akey = rb_funcall(akey, s_downcase, 0);
600
590
  ATTR(akey, aval);
601
591
  }
602
592
  #line 68 "hpricot_scan.rl"
@@ -607,25 +597,29 @@ tr118:
607
597
  {te = p+1;{ ELE(emptytag); }}
608
598
  goto st204;
609
599
  tr129:
610
- #line 110 "hpricot_scan.rl"
611
- {
600
+ #line 116 "hpricot_scan.rl"
601
+ {
612
602
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
613
603
  else { SET(aval, p); }
614
604
  }
615
- #line 128 "hpricot_scan.rl"
616
- {
605
+ #line 134 "hpricot_scan.rl"
606
+ {
607
+ if (!S->xml)
608
+ akey = rb_funcall(akey, s_downcase, 0);
617
609
  ATTR(akey, aval);
618
610
  }
619
611
  #line 68 "hpricot_scan.rl"
620
612
  {te = p+1;{ ELE(stag); }}
621
613
  goto st204;
622
614
  tr133:
623
- #line 128 "hpricot_scan.rl"
624
- {
615
+ #line 134 "hpricot_scan.rl"
616
+ {
617
+ if (!S->xml)
618
+ akey = rb_funcall(akey, s_downcase, 0);
625
619
  ATTR(akey, aval);
626
620
  }
627
- #line 110 "hpricot_scan.rl"
628
- {
621
+ #line 116 "hpricot_scan.rl"
622
+ {
629
623
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
630
624
  else { SET(aval, p); }
631
625
  }
@@ -633,15 +627,17 @@ tr133:
633
627
  {te = p+1;{ ELE(stag); }}
634
628
  goto st204;
635
629
  tr139:
636
- #line 110 "hpricot_scan.rl"
637
- {
630
+ #line 116 "hpricot_scan.rl"
631
+ {
638
632
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
639
633
  else { SET(aval, p); }
640
634
  }
641
- #line 114 "hpricot_scan.rl"
635
+ #line 120 "hpricot_scan.rl"
642
636
  { SET(akey, p); }
643
- #line 128 "hpricot_scan.rl"
644
- {
637
+ #line 134 "hpricot_scan.rl"
638
+ {
639
+ if (!S->xml)
640
+ akey = rb_funcall(akey, s_downcase, 0);
645
641
  ATTR(akey, aval);
646
642
  }
647
643
  #line 68 "hpricot_scan.rl"
@@ -685,7 +681,7 @@ st204:
685
681
  case 204:
686
682
  #line 1 "hpricot_scan.rl"
687
683
  {ts = p;}
688
- #line 689 "hpricot_scan.c"
684
+ #line 685 "hpricot_scan.c"
689
685
  switch( (*p) ) {
690
686
  case 10: goto tr412;
691
687
  case 60: goto tr413;
@@ -694,7 +690,7 @@ case 204:
694
690
  tr413:
695
691
  #line 1 "hpricot_scan.rl"
696
692
  {te = p+1;}
697
- #line 92 "hpricot_scan.rl"
693
+ #line 98 "hpricot_scan.rl"
698
694
  {
699
695
  if (text == 1) {
700
696
  CAT(tag, p);
@@ -713,7 +709,7 @@ st205:
713
709
  if ( ++p == pe )
714
710
  goto _test_eof205;
715
711
  case 205:
716
- #line 717 "hpricot_scan.c"
712
+ #line 713 "hpricot_scan.c"
717
713
  switch( (*p) ) {
718
714
  case 33: goto st0;
719
715
  case 47: goto st59;
@@ -814,14 +810,14 @@ case 9:
814
810
  goto tr12;
815
811
  goto tr0;
816
812
  tr12:
817
- #line 104 "hpricot_scan.rl"
813
+ #line 110 "hpricot_scan.rl"
818
814
  { mark_tag = p; }
819
815
  goto st10;
820
816
  st10:
821
817
  if ( ++p == pe )
822
818
  goto _test_eof10;
823
819
  case 10:
824
- #line 825 "hpricot_scan.c"
820
+ #line 821 "hpricot_scan.c"
825
821
  switch( (*p) ) {
826
822
  case 32: goto tr13;
827
823
  case 62: goto tr15;
@@ -845,14 +841,14 @@ case 10:
845
841
  goto st10;
846
842
  goto tr0;
847
843
  tr13:
848
- #line 107 "hpricot_scan.rl"
844
+ #line 113 "hpricot_scan.rl"
849
845
  { SET(tag, p); }
850
846
  goto st11;
851
847
  st11:
852
848
  if ( ++p == pe )
853
849
  goto _test_eof11;
854
850
  case 11:
855
- #line 856 "hpricot_scan.c"
851
+ #line 852 "hpricot_scan.c"
856
852
  switch( (*p) ) {
857
853
  case 32: goto st11;
858
854
  case 62: goto tr18;
@@ -942,14 +938,14 @@ case 19:
942
938
  goto tr30;
943
939
  goto tr0;
944
940
  tr30:
945
- #line 105 "hpricot_scan.rl"
941
+ #line 111 "hpricot_scan.rl"
946
942
  { mark_aval = p; }
947
943
  goto st20;
948
944
  st20:
949
945
  if ( ++p == pe )
950
946
  goto _test_eof20;
951
947
  case 20:
952
- #line 953 "hpricot_scan.c"
948
+ #line 949 "hpricot_scan.c"
953
949
  switch( (*p) ) {
954
950
  case 9: goto st20;
955
951
  case 34: goto tr33;
@@ -969,20 +965,20 @@ case 20:
969
965
  goto st20;
970
966
  goto tr0;
971
967
  tr31:
972
- #line 105 "hpricot_scan.rl"
968
+ #line 111 "hpricot_scan.rl"
973
969
  { mark_aval = p; }
974
- #line 118 "hpricot_scan.rl"
970
+ #line 124 "hpricot_scan.rl"
975
971
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
976
972
  goto st21;
977
973
  tr33:
978
- #line 118 "hpricot_scan.rl"
974
+ #line 124 "hpricot_scan.rl"
979
975
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
980
976
  goto st21;
981
977
  st21:
982
978
  if ( ++p == pe )
983
979
  goto _test_eof21;
984
980
  case 21:
985
- #line 986 "hpricot_scan.c"
981
+ #line 982 "hpricot_scan.c"
986
982
  switch( (*p) ) {
987
983
  case 32: goto st22;
988
984
  case 62: goto tr18;
@@ -1013,32 +1009,32 @@ case 23:
1013
1009
  goto tr38;
1014
1010
  goto tr37;
1015
1011
  tr37:
1016
- #line 105 "hpricot_scan.rl"
1012
+ #line 111 "hpricot_scan.rl"
1017
1013
  { mark_aval = p; }
1018
1014
  goto st24;
1019
1015
  st24:
1020
1016
  if ( ++p == pe )
1021
1017
  goto _test_eof24;
1022
1018
  case 24:
1023
- #line 1024 "hpricot_scan.c"
1019
+ #line 1020 "hpricot_scan.c"
1024
1020
  if ( (*p) == 34 )
1025
1021
  goto tr41;
1026
1022
  goto st24;
1027
1023
  tr38:
1028
- #line 105 "hpricot_scan.rl"
1024
+ #line 111 "hpricot_scan.rl"
1029
1025
  { mark_aval = p; }
1030
- #line 119 "hpricot_scan.rl"
1026
+ #line 125 "hpricot_scan.rl"
1031
1027
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1032
1028
  goto st25;
1033
1029
  tr41:
1034
- #line 119 "hpricot_scan.rl"
1030
+ #line 125 "hpricot_scan.rl"
1035
1031
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1036
1032
  goto st25;
1037
1033
  st25:
1038
1034
  if ( ++p == pe )
1039
1035
  goto _test_eof25;
1040
1036
  case 25:
1041
- #line 1042 "hpricot_scan.c"
1037
+ #line 1038 "hpricot_scan.c"
1042
1038
  switch( (*p) ) {
1043
1039
  case 32: goto st25;
1044
1040
  case 62: goto tr18;
@@ -1048,14 +1044,14 @@ case 25:
1048
1044
  goto st25;
1049
1045
  goto tr39;
1050
1046
  tr16:
1051
- #line 107 "hpricot_scan.rl"
1047
+ #line 113 "hpricot_scan.rl"
1052
1048
  { SET(tag, p); }
1053
1049
  goto st26;
1054
1050
  st26:
1055
1051
  if ( ++p == pe )
1056
1052
  goto _test_eof26;
1057
1053
  case 26:
1058
- #line 1059 "hpricot_scan.c"
1054
+ #line 1055 "hpricot_scan.c"
1059
1055
  if ( (*p) == 93 )
1060
1056
  goto st27;
1061
1057
  goto st26;
@@ -1078,14 +1074,14 @@ case 28:
1078
1074
  goto tr38;
1079
1075
  goto tr44;
1080
1076
  tr44:
1081
- #line 105 "hpricot_scan.rl"
1077
+ #line 111 "hpricot_scan.rl"
1082
1078
  { mark_aval = p; }
1083
1079
  goto st29;
1084
1080
  st29:
1085
1081
  if ( ++p == pe )
1086
1082
  goto _test_eof29;
1087
1083
  case 29:
1088
- #line 1089 "hpricot_scan.c"
1084
+ #line 1085 "hpricot_scan.c"
1089
1085
  if ( (*p) == 39 )
1090
1086
  goto tr41;
1091
1087
  goto st29;
@@ -1115,14 +1111,14 @@ case 30:
1115
1111
  goto tr46;
1116
1112
  goto tr0;
1117
1113
  tr46:
1118
- #line 105 "hpricot_scan.rl"
1114
+ #line 111 "hpricot_scan.rl"
1119
1115
  { mark_aval = p; }
1120
1116
  goto st31;
1121
1117
  st31:
1122
1118
  if ( ++p == pe )
1123
1119
  goto _test_eof31;
1124
1120
  case 31:
1125
- #line 1126 "hpricot_scan.c"
1121
+ #line 1122 "hpricot_scan.c"
1126
1122
  switch( (*p) ) {
1127
1123
  case 9: goto st31;
1128
1124
  case 39: goto tr49;
@@ -1145,34 +1141,34 @@ case 31:
1145
1141
  goto st31;
1146
1142
  goto tr0;
1147
1143
  tr47:
1148
- #line 105 "hpricot_scan.rl"
1144
+ #line 111 "hpricot_scan.rl"
1149
1145
  { mark_aval = p; }
1150
- #line 118 "hpricot_scan.rl"
1146
+ #line 124 "hpricot_scan.rl"
1151
1147
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
1152
1148
  goto st32;
1153
1149
  tr49:
1154
- #line 118 "hpricot_scan.rl"
1150
+ #line 124 "hpricot_scan.rl"
1155
1151
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
1156
1152
  goto st32;
1157
1153
  tr55:
1158
- #line 118 "hpricot_scan.rl"
1154
+ #line 124 "hpricot_scan.rl"
1159
1155
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
1160
- #line 105 "hpricot_scan.rl"
1156
+ #line 111 "hpricot_scan.rl"
1161
1157
  { mark_aval = p; }
1162
- #line 119 "hpricot_scan.rl"
1158
+ #line 125 "hpricot_scan.rl"
1163
1159
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1164
1160
  goto st32;
1165
1161
  tr82:
1166
- #line 118 "hpricot_scan.rl"
1162
+ #line 124 "hpricot_scan.rl"
1167
1163
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
1168
- #line 119 "hpricot_scan.rl"
1164
+ #line 125 "hpricot_scan.rl"
1169
1165
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1170
1166
  goto st32;
1171
1167
  st32:
1172
1168
  if ( ++p == pe )
1173
1169
  goto _test_eof32;
1174
1170
  case 32:
1175
- #line 1176 "hpricot_scan.c"
1171
+ #line 1172 "hpricot_scan.c"
1176
1172
  switch( (*p) ) {
1177
1173
  case 9: goto st33;
1178
1174
  case 32: goto st33;
@@ -1226,20 +1222,20 @@ case 33:
1226
1222
  goto st31;
1227
1223
  goto tr0;
1228
1224
  tr51:
1229
- #line 118 "hpricot_scan.rl"
1225
+ #line 124 "hpricot_scan.rl"
1230
1226
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
1231
1227
  goto st34;
1232
1228
  tr62:
1233
- #line 118 "hpricot_scan.rl"
1229
+ #line 124 "hpricot_scan.rl"
1234
1230
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
1235
- #line 119 "hpricot_scan.rl"
1231
+ #line 125 "hpricot_scan.rl"
1236
1232
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1237
1233
  goto st34;
1238
1234
  st34:
1239
1235
  if ( ++p == pe )
1240
1236
  goto _test_eof34;
1241
1237
  case 34:
1242
- #line 1243 "hpricot_scan.c"
1238
+ #line 1239 "hpricot_scan.c"
1243
1239
  switch( (*p) ) {
1244
1240
  case 9: goto tr52;
1245
1241
  case 32: goto tr52;
@@ -1265,14 +1261,14 @@ case 34:
1265
1261
  goto tr54;
1266
1262
  goto tr44;
1267
1263
  tr52:
1268
- #line 105 "hpricot_scan.rl"
1264
+ #line 111 "hpricot_scan.rl"
1269
1265
  { mark_aval = p; }
1270
1266
  goto st35;
1271
1267
  st35:
1272
1268
  if ( ++p == pe )
1273
1269
  goto _test_eof35;
1274
1270
  case 35:
1275
- #line 1276 "hpricot_scan.c"
1271
+ #line 1272 "hpricot_scan.c"
1276
1272
  switch( (*p) ) {
1277
1273
  case 9: goto st35;
1278
1274
  case 32: goto st35;
@@ -1298,14 +1294,14 @@ case 35:
1298
1294
  goto st47;
1299
1295
  goto st29;
1300
1296
  tr53:
1301
- #line 105 "hpricot_scan.rl"
1297
+ #line 111 "hpricot_scan.rl"
1302
1298
  { mark_aval = p; }
1303
1299
  goto st36;
1304
1300
  st36:
1305
1301
  if ( ++p == pe )
1306
1302
  goto _test_eof36;
1307
1303
  case 36:
1308
- #line 1309 "hpricot_scan.c"
1304
+ #line 1305 "hpricot_scan.c"
1309
1305
  switch( (*p) ) {
1310
1306
  case 32: goto st36;
1311
1307
  case 34: goto st37;
@@ -1326,38 +1322,38 @@ case 37:
1326
1322
  }
1327
1323
  goto tr66;
1328
1324
  tr66:
1329
- #line 105 "hpricot_scan.rl"
1325
+ #line 111 "hpricot_scan.rl"
1330
1326
  { mark_aval = p; }
1331
1327
  goto st38;
1332
1328
  st38:
1333
1329
  if ( ++p == pe )
1334
1330
  goto _test_eof38;
1335
1331
  case 38:
1336
- #line 1337 "hpricot_scan.c"
1332
+ #line 1333 "hpricot_scan.c"
1337
1333
  switch( (*p) ) {
1338
1334
  case 34: goto tr70;
1339
1335
  case 39: goto tr71;
1340
1336
  }
1341
1337
  goto st38;
1342
1338
  tr81:
1343
- #line 105 "hpricot_scan.rl"
1339
+ #line 111 "hpricot_scan.rl"
1344
1340
  { mark_aval = p; }
1345
1341
  goto st39;
1346
1342
  tr67:
1347
- #line 105 "hpricot_scan.rl"
1343
+ #line 111 "hpricot_scan.rl"
1348
1344
  { mark_aval = p; }
1349
- #line 119 "hpricot_scan.rl"
1345
+ #line 125 "hpricot_scan.rl"
1350
1346
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1351
1347
  goto st39;
1352
1348
  tr70:
1353
- #line 119 "hpricot_scan.rl"
1349
+ #line 125 "hpricot_scan.rl"
1354
1350
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1355
1351
  goto st39;
1356
1352
  st39:
1357
1353
  if ( ++p == pe )
1358
1354
  goto _test_eof39;
1359
1355
  case 39:
1360
- #line 1361 "hpricot_scan.c"
1356
+ #line 1357 "hpricot_scan.c"
1361
1357
  switch( (*p) ) {
1362
1358
  case 32: goto st39;
1363
1359
  case 39: goto tr41;
@@ -1370,7 +1366,7 @@ case 39:
1370
1366
  tr56:
1371
1367
  #line 1 "hpricot_scan.rl"
1372
1368
  {te = p+1;}
1373
- #line 105 "hpricot_scan.rl"
1369
+ #line 111 "hpricot_scan.rl"
1374
1370
  { mark_aval = p; }
1375
1371
  #line 66 "hpricot_scan.rl"
1376
1372
  {act = 8;}
@@ -1385,33 +1381,33 @@ st206:
1385
1381
  if ( ++p == pe )
1386
1382
  goto _test_eof206;
1387
1383
  case 206:
1388
- #line 1389 "hpricot_scan.c"
1384
+ #line 1385 "hpricot_scan.c"
1389
1385
  if ( (*p) == 39 )
1390
1386
  goto tr41;
1391
1387
  goto st29;
1392
1388
  tr57:
1393
- #line 105 "hpricot_scan.rl"
1389
+ #line 111 "hpricot_scan.rl"
1394
1390
  { mark_aval = p; }
1395
1391
  goto st40;
1396
1392
  st40:
1397
1393
  if ( ++p == pe )
1398
1394
  goto _test_eof40;
1399
1395
  case 40:
1400
- #line 1401 "hpricot_scan.c"
1396
+ #line 1397 "hpricot_scan.c"
1401
1397
  switch( (*p) ) {
1402
1398
  case 39: goto tr73;
1403
1399
  case 93: goto st42;
1404
1400
  }
1405
1401
  goto st40;
1406
1402
  tr73:
1407
- #line 119 "hpricot_scan.rl"
1403
+ #line 125 "hpricot_scan.rl"
1408
1404
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1409
1405
  goto st41;
1410
1406
  st41:
1411
1407
  if ( ++p == pe )
1412
1408
  goto _test_eof41;
1413
1409
  case 41:
1414
- #line 1415 "hpricot_scan.c"
1410
+ #line 1411 "hpricot_scan.c"
1415
1411
  switch( (*p) ) {
1416
1412
  case 32: goto st41;
1417
1413
  case 62: goto tr76;
@@ -1430,7 +1426,7 @@ st207:
1430
1426
  if ( ++p == pe )
1431
1427
  goto _test_eof207;
1432
1428
  case 207:
1433
- #line 1434 "hpricot_scan.c"
1429
+ #line 1430 "hpricot_scan.c"
1434
1430
  if ( (*p) == 93 )
1435
1431
  goto st27;
1436
1432
  goto st26;
@@ -1447,20 +1443,20 @@ case 42:
1447
1443
  goto st42;
1448
1444
  goto st29;
1449
1445
  tr68:
1450
- #line 105 "hpricot_scan.rl"
1446
+ #line 111 "hpricot_scan.rl"
1451
1447
  { mark_aval = p; }
1452
- #line 119 "hpricot_scan.rl"
1448
+ #line 125 "hpricot_scan.rl"
1453
1449
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1454
1450
  goto st43;
1455
1451
  tr71:
1456
- #line 119 "hpricot_scan.rl"
1452
+ #line 125 "hpricot_scan.rl"
1457
1453
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1458
1454
  goto st43;
1459
1455
  st43:
1460
1456
  if ( ++p == pe )
1461
1457
  goto _test_eof43;
1462
1458
  case 43:
1463
- #line 1464 "hpricot_scan.c"
1459
+ #line 1460 "hpricot_scan.c"
1464
1460
  switch( (*p) ) {
1465
1461
  case 32: goto st43;
1466
1462
  case 34: goto tr41;
@@ -1480,7 +1476,7 @@ st208:
1480
1476
  if ( ++p == pe )
1481
1477
  goto _test_eof208;
1482
1478
  case 208:
1483
- #line 1484 "hpricot_scan.c"
1479
+ #line 1480 "hpricot_scan.c"
1484
1480
  if ( (*p) == 34 )
1485
1481
  goto tr41;
1486
1482
  goto st24;
@@ -1506,14 +1502,14 @@ case 45:
1506
1502
  goto st45;
1507
1503
  goto st24;
1508
1504
  tr65:
1509
- #line 119 "hpricot_scan.rl"
1505
+ #line 125 "hpricot_scan.rl"
1510
1506
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1511
1507
  goto st46;
1512
1508
  st46:
1513
1509
  if ( ++p == pe )
1514
1510
  goto _test_eof46;
1515
1511
  case 46:
1516
- #line 1517 "hpricot_scan.c"
1512
+ #line 1513 "hpricot_scan.c"
1517
1513
  switch( (*p) ) {
1518
1514
  case 32: goto tr81;
1519
1515
  case 39: goto tr38;
@@ -1524,14 +1520,14 @@ case 46:
1524
1520
  goto tr81;
1525
1521
  goto tr44;
1526
1522
  tr54:
1527
- #line 105 "hpricot_scan.rl"
1523
+ #line 111 "hpricot_scan.rl"
1528
1524
  { mark_aval = p; }
1529
1525
  goto st47;
1530
1526
  st47:
1531
1527
  if ( ++p == pe )
1532
1528
  goto _test_eof47;
1533
1529
  case 47:
1534
- #line 1535 "hpricot_scan.c"
1530
+ #line 1531 "hpricot_scan.c"
1535
1531
  switch( (*p) ) {
1536
1532
  case 9: goto st47;
1537
1533
  case 39: goto tr82;
@@ -1645,14 +1641,14 @@ case 59:
1645
1641
  goto tr94;
1646
1642
  goto tr0;
1647
1643
  tr94:
1648
- #line 104 "hpricot_scan.rl"
1644
+ #line 110 "hpricot_scan.rl"
1649
1645
  { mark_tag = p; }
1650
1646
  goto st60;
1651
1647
  st60:
1652
1648
  if ( ++p == pe )
1653
1649
  goto _test_eof60;
1654
1650
  case 60:
1655
- #line 1656 "hpricot_scan.c"
1651
+ #line 1652 "hpricot_scan.c"
1656
1652
  switch( (*p) ) {
1657
1653
  case 32: goto tr95;
1658
1654
  case 62: goto tr97;
@@ -1675,14 +1671,14 @@ case 60:
1675
1671
  goto st60;
1676
1672
  goto tr0;
1677
1673
  tr95:
1678
- #line 107 "hpricot_scan.rl"
1674
+ #line 113 "hpricot_scan.rl"
1679
1675
  { SET(tag, p); }
1680
1676
  goto st61;
1681
1677
  st61:
1682
1678
  if ( ++p == pe )
1683
1679
  goto _test_eof61;
1684
1680
  case 61:
1685
- #line 1686 "hpricot_scan.c"
1681
+ #line 1682 "hpricot_scan.c"
1686
1682
  switch( (*p) ) {
1687
1683
  case 32: goto st61;
1688
1684
  case 62: goto tr99;
@@ -1691,14 +1687,14 @@ case 61:
1691
1687
  goto st61;
1692
1688
  goto tr0;
1693
1689
  tr417:
1694
- #line 104 "hpricot_scan.rl"
1690
+ #line 110 "hpricot_scan.rl"
1695
1691
  { mark_tag = p; }
1696
1692
  goto st62;
1697
1693
  st62:
1698
1694
  if ( ++p == pe )
1699
1695
  goto _test_eof62;
1700
1696
  case 62:
1701
- #line 1702 "hpricot_scan.c"
1697
+ #line 1698 "hpricot_scan.c"
1702
1698
  switch( (*p) ) {
1703
1699
  case 32: goto tr100;
1704
1700
  case 47: goto tr102;
@@ -1719,14 +1715,14 @@ case 62:
1719
1715
  goto st62;
1720
1716
  goto tr0;
1721
1717
  tr100:
1722
- #line 107 "hpricot_scan.rl"
1718
+ #line 113 "hpricot_scan.rl"
1723
1719
  { SET(tag, p); }
1724
1720
  goto st63;
1725
1721
  st63:
1726
1722
  if ( ++p == pe )
1727
1723
  goto _test_eof63;
1728
1724
  case 63:
1729
- #line 1730 "hpricot_scan.c"
1725
+ #line 1726 "hpricot_scan.c"
1730
1726
  switch( (*p) ) {
1731
1727
  case 32: goto st63;
1732
1728
  case 47: goto st66;
@@ -1747,36 +1743,38 @@ case 63:
1747
1743
  goto tr105;
1748
1744
  goto tr0;
1749
1745
  tr105:
1750
- #line 121 "hpricot_scan.rl"
1751
- {
1746
+ #line 127 "hpricot_scan.rl"
1747
+ {
1752
1748
  akey = Qnil;
1753
1749
  aval = Qnil;
1754
1750
  mark_akey = NULL;
1755
1751
  mark_aval = NULL;
1756
1752
  }
1757
- #line 106 "hpricot_scan.rl"
1753
+ #line 112 "hpricot_scan.rl"
1758
1754
  { mark_akey = p; }
1759
1755
  goto st64;
1760
1756
  tr114:
1761
- #line 128 "hpricot_scan.rl"
1762
- {
1757
+ #line 134 "hpricot_scan.rl"
1758
+ {
1759
+ if (!S->xml)
1760
+ akey = rb_funcall(akey, s_downcase, 0);
1763
1761
  ATTR(akey, aval);
1764
1762
  }
1765
- #line 121 "hpricot_scan.rl"
1766
- {
1763
+ #line 127 "hpricot_scan.rl"
1764
+ {
1767
1765
  akey = Qnil;
1768
1766
  aval = Qnil;
1769
1767
  mark_akey = NULL;
1770
1768
  mark_aval = NULL;
1771
1769
  }
1772
- #line 106 "hpricot_scan.rl"
1770
+ #line 112 "hpricot_scan.rl"
1773
1771
  { mark_akey = p; }
1774
1772
  goto st64;
1775
1773
  st64:
1776
1774
  if ( ++p == pe )
1777
1775
  goto _test_eof64;
1778
1776
  case 64:
1779
- #line 1780 "hpricot_scan.c"
1777
+ #line 1778 "hpricot_scan.c"
1780
1778
  switch( (*p) ) {
1781
1779
  case 32: goto tr108;
1782
1780
  case 47: goto tr110;
@@ -1798,21 +1796,21 @@ case 64:
1798
1796
  goto st64;
1799
1797
  goto tr39;
1800
1798
  tr108:
1801
- #line 114 "hpricot_scan.rl"
1799
+ #line 120 "hpricot_scan.rl"
1802
1800
  { SET(akey, p); }
1803
1801
  goto st65;
1804
1802
  tr140:
1805
- #line 110 "hpricot_scan.rl"
1806
- {
1803
+ #line 116 "hpricot_scan.rl"
1804
+ {
1807
1805
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
1808
1806
  else { SET(aval, p); }
1809
1807
  }
1810
1808
  goto st65;
1811
1809
  tr134:
1812
- #line 114 "hpricot_scan.rl"
1810
+ #line 120 "hpricot_scan.rl"
1813
1811
  { SET(akey, p); }
1814
- #line 110 "hpricot_scan.rl"
1815
- {
1812
+ #line 116 "hpricot_scan.rl"
1813
+ {
1816
1814
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
1817
1815
  else { SET(aval, p); }
1818
1816
  }
@@ -1821,7 +1819,7 @@ st65:
1821
1819
  if ( ++p == pe )
1822
1820
  goto _test_eof65;
1823
1821
  case 65:
1824
- #line 1825 "hpricot_scan.c"
1822
+ #line 1823 "hpricot_scan.c"
1825
1823
  switch( (*p) ) {
1826
1824
  case 32: goto st65;
1827
1825
  case 47: goto tr115;
@@ -1843,20 +1841,24 @@ case 65:
1843
1841
  goto tr114;
1844
1842
  goto tr39;
1845
1843
  tr102:
1846
- #line 107 "hpricot_scan.rl"
1844
+ #line 113 "hpricot_scan.rl"
1847
1845
  { SET(tag, p); }
1848
1846
  goto st66;
1849
1847
  tr110:
1850
- #line 114 "hpricot_scan.rl"
1848
+ #line 120 "hpricot_scan.rl"
1851
1849
  { SET(akey, p); }
1852
- #line 128 "hpricot_scan.rl"
1853
- {
1850
+ #line 134 "hpricot_scan.rl"
1851
+ {
1852
+ if (!S->xml)
1853
+ akey = rb_funcall(akey, s_downcase, 0);
1854
1854
  ATTR(akey, aval);
1855
1855
  }
1856
1856
  goto st66;
1857
1857
  tr115:
1858
- #line 128 "hpricot_scan.rl"
1859
- {
1858
+ #line 134 "hpricot_scan.rl"
1859
+ {
1860
+ if (!S->xml)
1861
+ akey = rb_funcall(akey, s_downcase, 0);
1860
1862
  ATTR(akey, aval);
1861
1863
  }
1862
1864
  goto st66;
@@ -1864,19 +1866,19 @@ st66:
1864
1866
  if ( ++p == pe )
1865
1867
  goto _test_eof66;
1866
1868
  case 66:
1867
- #line 1868 "hpricot_scan.c"
1869
+ #line 1870 "hpricot_scan.c"
1868
1870
  if ( (*p) == 62 )
1869
1871
  goto tr118;
1870
1872
  goto tr39;
1871
1873
  tr111:
1872
- #line 114 "hpricot_scan.rl"
1874
+ #line 120 "hpricot_scan.rl"
1873
1875
  { SET(akey, p); }
1874
1876
  goto st67;
1875
1877
  st67:
1876
1878
  if ( ++p == pe )
1877
1879
  goto _test_eof67;
1878
1880
  case 67:
1879
- #line 1880 "hpricot_scan.c"
1881
+ #line 1882 "hpricot_scan.c"
1880
1882
  switch( (*p) ) {
1881
1883
  case 13: goto tr120;
1882
1884
  case 32: goto tr120;
@@ -1893,14 +1895,14 @@ case 67:
1893
1895
  goto tr120;
1894
1896
  goto tr119;
1895
1897
  tr119:
1896
- #line 105 "hpricot_scan.rl"
1898
+ #line 111 "hpricot_scan.rl"
1897
1899
  { mark_aval = p; }
1898
1900
  goto st68;
1899
1901
  st68:
1900
1902
  if ( ++p == pe )
1901
1903
  goto _test_eof68;
1902
1904
  case 68:
1903
- #line 1904 "hpricot_scan.c"
1905
+ #line 1906 "hpricot_scan.c"
1904
1906
  switch( (*p) ) {
1905
1907
  case 13: goto tr126;
1906
1908
  case 32: goto tr126;
@@ -1915,27 +1917,27 @@ case 68:
1915
1917
  goto tr126;
1916
1918
  goto st68;
1917
1919
  tr126:
1918
- #line 110 "hpricot_scan.rl"
1919
- {
1920
+ #line 116 "hpricot_scan.rl"
1921
+ {
1920
1922
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
1921
1923
  else { SET(aval, p); }
1922
1924
  }
1923
1925
  goto st69;
1924
1926
  tr331:
1925
- #line 105 "hpricot_scan.rl"
1927
+ #line 111 "hpricot_scan.rl"
1926
1928
  { mark_aval = p; }
1927
- #line 109 "hpricot_scan.rl"
1929
+ #line 115 "hpricot_scan.rl"
1928
1930
  { SET(aval, p); }
1929
1931
  goto st69;
1930
1932
  tr169:
1931
- #line 109 "hpricot_scan.rl"
1933
+ #line 115 "hpricot_scan.rl"
1932
1934
  { SET(aval, p); }
1933
1935
  goto st69;
1934
1936
  st69:
1935
1937
  if ( ++p == pe )
1936
1938
  goto _test_eof69;
1937
1939
  case 69:
1938
- #line 1939 "hpricot_scan.c"
1940
+ #line 1941 "hpricot_scan.c"
1939
1941
  switch( (*p) ) {
1940
1942
  case 32: goto st69;
1941
1943
  case 47: goto tr115;
@@ -1956,27 +1958,27 @@ case 69:
1956
1958
  goto tr114;
1957
1959
  goto tr39;
1958
1960
  tr127:
1959
- #line 110 "hpricot_scan.rl"
1960
- {
1961
+ #line 116 "hpricot_scan.rl"
1962
+ {
1961
1963
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
1962
1964
  else { SET(aval, p); }
1963
1965
  }
1964
1966
  goto st70;
1965
1967
  tr155:
1966
- #line 105 "hpricot_scan.rl"
1968
+ #line 111 "hpricot_scan.rl"
1967
1969
  { mark_aval = p; }
1968
- #line 109 "hpricot_scan.rl"
1970
+ #line 115 "hpricot_scan.rl"
1969
1971
  { SET(aval, p); }
1970
1972
  goto st70;
1971
1973
  tr163:
1972
- #line 109 "hpricot_scan.rl"
1974
+ #line 115 "hpricot_scan.rl"
1973
1975
  { SET(aval, p); }
1974
1976
  goto st70;
1975
1977
  st70:
1976
1978
  if ( ++p == pe )
1977
1979
  goto _test_eof70;
1978
1980
  case 70:
1979
- #line 1980 "hpricot_scan.c"
1981
+ #line 1982 "hpricot_scan.c"
1980
1982
  switch( (*p) ) {
1981
1983
  case 13: goto tr126;
1982
1984
  case 32: goto tr126;
@@ -2002,42 +2004,46 @@ case 70:
2002
2004
  goto tr131;
2003
2005
  goto st68;
2004
2006
  tr131:
2005
- #line 128 "hpricot_scan.rl"
2006
- {
2007
+ #line 134 "hpricot_scan.rl"
2008
+ {
2009
+ if (!S->xml)
2010
+ akey = rb_funcall(akey, s_downcase, 0);
2007
2011
  ATTR(akey, aval);
2008
2012
  }
2009
- #line 121 "hpricot_scan.rl"
2010
- {
2013
+ #line 127 "hpricot_scan.rl"
2014
+ {
2011
2015
  akey = Qnil;
2012
2016
  aval = Qnil;
2013
2017
  mark_akey = NULL;
2014
2018
  mark_aval = NULL;
2015
2019
  }
2016
- #line 106 "hpricot_scan.rl"
2020
+ #line 112 "hpricot_scan.rl"
2017
2021
  { mark_akey = p; }
2018
2022
  goto st71;
2019
2023
  tr150:
2020
- #line 105 "hpricot_scan.rl"
2024
+ #line 111 "hpricot_scan.rl"
2021
2025
  { mark_aval = p; }
2022
- #line 128 "hpricot_scan.rl"
2023
- {
2026
+ #line 134 "hpricot_scan.rl"
2027
+ {
2028
+ if (!S->xml)
2029
+ akey = rb_funcall(akey, s_downcase, 0);
2024
2030
  ATTR(akey, aval);
2025
2031
  }
2026
- #line 121 "hpricot_scan.rl"
2027
- {
2032
+ #line 127 "hpricot_scan.rl"
2033
+ {
2028
2034
  akey = Qnil;
2029
2035
  aval = Qnil;
2030
2036
  mark_akey = NULL;
2031
2037
  mark_aval = NULL;
2032
2038
  }
2033
- #line 106 "hpricot_scan.rl"
2039
+ #line 112 "hpricot_scan.rl"
2034
2040
  { mark_akey = p; }
2035
2041
  goto st71;
2036
2042
  st71:
2037
2043
  if ( ++p == pe )
2038
2044
  goto _test_eof71;
2039
2045
  case 71:
2040
- #line 2041 "hpricot_scan.c"
2046
+ #line 2047 "hpricot_scan.c"
2041
2047
  switch( (*p) ) {
2042
2048
  case 13: goto tr134;
2043
2049
  case 32: goto tr134;
@@ -2064,17 +2070,17 @@ case 71:
2064
2070
  goto st71;
2065
2071
  goto st68;
2066
2072
  tr141:
2067
- #line 110 "hpricot_scan.rl"
2068
- {
2073
+ #line 116 "hpricot_scan.rl"
2074
+ {
2069
2075
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2070
2076
  else { SET(aval, p); }
2071
2077
  }
2072
2078
  goto st72;
2073
2079
  tr135:
2074
- #line 114 "hpricot_scan.rl"
2080
+ #line 120 "hpricot_scan.rl"
2075
2081
  { SET(akey, p); }
2076
- #line 110 "hpricot_scan.rl"
2077
- {
2082
+ #line 116 "hpricot_scan.rl"
2083
+ {
2078
2084
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2079
2085
  else { SET(aval, p); }
2080
2086
  }
@@ -2083,7 +2089,7 @@ st72:
2083
2089
  if ( ++p == pe )
2084
2090
  goto _test_eof72;
2085
2091
  case 72:
2086
- #line 2087 "hpricot_scan.c"
2092
+ #line 2093 "hpricot_scan.c"
2087
2093
  switch( (*p) ) {
2088
2094
  case 13: goto tr140;
2089
2095
  case 32: goto tr140;
@@ -2110,70 +2116,82 @@ case 72:
2110
2116
  goto tr131;
2111
2117
  goto st68;
2112
2118
  tr124:
2113
- #line 105 "hpricot_scan.rl"
2119
+ #line 111 "hpricot_scan.rl"
2114
2120
  { mark_aval = p; }
2115
- #line 128 "hpricot_scan.rl"
2116
- {
2121
+ #line 134 "hpricot_scan.rl"
2122
+ {
2123
+ if (!S->xml)
2124
+ akey = rb_funcall(akey, s_downcase, 0);
2117
2125
  ATTR(akey, aval);
2118
2126
  }
2119
2127
  goto st73;
2120
2128
  tr128:
2121
- #line 110 "hpricot_scan.rl"
2122
- {
2129
+ #line 116 "hpricot_scan.rl"
2130
+ {
2123
2131
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2124
2132
  else { SET(aval, p); }
2125
2133
  }
2126
- #line 128 "hpricot_scan.rl"
2127
- {
2134
+ #line 134 "hpricot_scan.rl"
2135
+ {
2136
+ if (!S->xml)
2137
+ akey = rb_funcall(akey, s_downcase, 0);
2128
2138
  ATTR(akey, aval);
2129
2139
  }
2130
2140
  goto st73;
2131
2141
  tr132:
2132
- #line 128 "hpricot_scan.rl"
2133
- {
2142
+ #line 134 "hpricot_scan.rl"
2143
+ {
2144
+ if (!S->xml)
2145
+ akey = rb_funcall(akey, s_downcase, 0);
2134
2146
  ATTR(akey, aval);
2135
2147
  }
2136
- #line 110 "hpricot_scan.rl"
2137
- {
2148
+ #line 116 "hpricot_scan.rl"
2149
+ {
2138
2150
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2139
2151
  else { SET(aval, p); }
2140
2152
  }
2141
2153
  goto st73;
2142
2154
  tr137:
2143
- #line 110 "hpricot_scan.rl"
2144
- {
2155
+ #line 116 "hpricot_scan.rl"
2156
+ {
2145
2157
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2146
2158
  else { SET(aval, p); }
2147
2159
  }
2148
- #line 114 "hpricot_scan.rl"
2160
+ #line 120 "hpricot_scan.rl"
2149
2161
  { SET(akey, p); }
2150
- #line 128 "hpricot_scan.rl"
2151
- {
2162
+ #line 134 "hpricot_scan.rl"
2163
+ {
2164
+ if (!S->xml)
2165
+ akey = rb_funcall(akey, s_downcase, 0);
2152
2166
  ATTR(akey, aval);
2153
2167
  }
2154
2168
  goto st73;
2155
2169
  tr147:
2156
- #line 105 "hpricot_scan.rl"
2170
+ #line 111 "hpricot_scan.rl"
2157
2171
  { mark_aval = p; }
2158
- #line 110 "hpricot_scan.rl"
2159
- {
2172
+ #line 116 "hpricot_scan.rl"
2173
+ {
2160
2174
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2161
2175
  else { SET(aval, p); }
2162
2176
  }
2163
- #line 128 "hpricot_scan.rl"
2164
- {
2177
+ #line 134 "hpricot_scan.rl"
2178
+ {
2179
+ if (!S->xml)
2180
+ akey = rb_funcall(akey, s_downcase, 0);
2165
2181
  ATTR(akey, aval);
2166
2182
  }
2167
2183
  goto st73;
2168
2184
  tr151:
2169
- #line 105 "hpricot_scan.rl"
2185
+ #line 111 "hpricot_scan.rl"
2170
2186
  { mark_aval = p; }
2171
- #line 128 "hpricot_scan.rl"
2172
- {
2187
+ #line 134 "hpricot_scan.rl"
2188
+ {
2189
+ if (!S->xml)
2190
+ akey = rb_funcall(akey, s_downcase, 0);
2173
2191
  ATTR(akey, aval);
2174
2192
  }
2175
- #line 110 "hpricot_scan.rl"
2176
- {
2193
+ #line 116 "hpricot_scan.rl"
2194
+ {
2177
2195
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2178
2196
  else { SET(aval, p); }
2179
2197
  }
@@ -2182,7 +2200,7 @@ st73:
2182
2200
  if ( ++p == pe )
2183
2201
  goto _test_eof73;
2184
2202
  case 73:
2185
- #line 2186 "hpricot_scan.c"
2203
+ #line 2204 "hpricot_scan.c"
2186
2204
  switch( (*p) ) {
2187
2205
  case 13: goto tr126;
2188
2206
  case 32: goto tr126;
@@ -2197,18 +2215,18 @@ case 73:
2197
2215
  goto tr126;
2198
2216
  goto st68;
2199
2217
  tr121:
2200
- #line 105 "hpricot_scan.rl"
2218
+ #line 111 "hpricot_scan.rl"
2201
2219
  { mark_aval = p; }
2202
2220
  goto st74;
2203
2221
  tr138:
2204
- #line 114 "hpricot_scan.rl"
2222
+ #line 120 "hpricot_scan.rl"
2205
2223
  { SET(akey, p); }
2206
2224
  goto st74;
2207
2225
  st74:
2208
2226
  if ( ++p == pe )
2209
2227
  goto _test_eof74;
2210
2228
  case 74:
2211
- #line 2212 "hpricot_scan.c"
2229
+ #line 2230 "hpricot_scan.c"
2212
2230
  switch( (*p) ) {
2213
2231
  case 13: goto tr143;
2214
2232
  case 32: goto tr143;
@@ -2225,14 +2243,14 @@ case 74:
2225
2243
  goto tr143;
2226
2244
  goto tr119;
2227
2245
  tr148:
2228
- #line 105 "hpricot_scan.rl"
2246
+ #line 111 "hpricot_scan.rl"
2229
2247
  { mark_aval = p; }
2230
2248
  goto st75;
2231
2249
  tr143:
2232
- #line 105 "hpricot_scan.rl"
2250
+ #line 111 "hpricot_scan.rl"
2233
2251
  { mark_aval = p; }
2234
- #line 110 "hpricot_scan.rl"
2235
- {
2252
+ #line 116 "hpricot_scan.rl"
2253
+ {
2236
2254
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2237
2255
  else { SET(aval, p); }
2238
2256
  }
@@ -2241,7 +2259,7 @@ st75:
2241
2259
  if ( ++p == pe )
2242
2260
  goto _test_eof75;
2243
2261
  case 75:
2244
- #line 2245 "hpricot_scan.c"
2262
+ #line 2263 "hpricot_scan.c"
2245
2263
  switch( (*p) ) {
2246
2264
  case 13: goto tr148;
2247
2265
  case 32: goto tr148;
@@ -2269,14 +2287,14 @@ case 75:
2269
2287
  goto tr150;
2270
2288
  goto tr119;
2271
2289
  tr149:
2272
- #line 105 "hpricot_scan.rl"
2290
+ #line 111 "hpricot_scan.rl"
2273
2291
  { mark_aval = p; }
2274
2292
  goto st76;
2275
2293
  tr144:
2276
- #line 105 "hpricot_scan.rl"
2294
+ #line 111 "hpricot_scan.rl"
2277
2295
  { mark_aval = p; }
2278
- #line 110 "hpricot_scan.rl"
2279
- {
2296
+ #line 116 "hpricot_scan.rl"
2297
+ {
2280
2298
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2281
2299
  else { SET(aval, p); }
2282
2300
  }
@@ -2285,7 +2303,7 @@ st76:
2285
2303
  if ( ++p == pe )
2286
2304
  goto _test_eof76;
2287
2305
  case 76:
2288
- #line 2289 "hpricot_scan.c"
2306
+ #line 2307 "hpricot_scan.c"
2289
2307
  switch( (*p) ) {
2290
2308
  case 13: goto tr143;
2291
2309
  case 32: goto tr143;
@@ -2332,14 +2350,14 @@ case 77:
2332
2350
  goto tr153;
2333
2351
  goto tr152;
2334
2352
  tr152:
2335
- #line 105 "hpricot_scan.rl"
2353
+ #line 111 "hpricot_scan.rl"
2336
2354
  { mark_aval = p; }
2337
2355
  goto st78;
2338
2356
  st78:
2339
2357
  if ( ++p == pe )
2340
2358
  goto _test_eof78;
2341
2359
  case 78:
2342
- #line 2343 "hpricot_scan.c"
2360
+ #line 2361 "hpricot_scan.c"
2343
2361
  switch( (*p) ) {
2344
2362
  case 13: goto tr161;
2345
2363
  case 32: goto tr161;
@@ -2356,40 +2374,40 @@ case 78:
2356
2374
  goto tr161;
2357
2375
  goto st78;
2358
2376
  tr336:
2359
- #line 105 "hpricot_scan.rl"
2377
+ #line 111 "hpricot_scan.rl"
2360
2378
  { mark_aval = p; }
2361
2379
  goto st79;
2362
2380
  tr161:
2363
- #line 110 "hpricot_scan.rl"
2364
- {
2381
+ #line 116 "hpricot_scan.rl"
2382
+ {
2365
2383
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2366
2384
  else { SET(aval, p); }
2367
2385
  }
2368
2386
  goto st79;
2369
2387
  tr153:
2370
- #line 105 "hpricot_scan.rl"
2388
+ #line 111 "hpricot_scan.rl"
2371
2389
  { mark_aval = p; }
2372
- #line 110 "hpricot_scan.rl"
2373
- {
2390
+ #line 116 "hpricot_scan.rl"
2391
+ {
2374
2392
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2375
2393
  else { SET(aval, p); }
2376
2394
  }
2377
2395
  goto st79;
2378
2396
  tr317:
2379
- #line 105 "hpricot_scan.rl"
2397
+ #line 111 "hpricot_scan.rl"
2380
2398
  { mark_aval = p; }
2381
- #line 109 "hpricot_scan.rl"
2399
+ #line 115 "hpricot_scan.rl"
2382
2400
  { SET(aval, p); }
2383
2401
  goto st79;
2384
2402
  tr174:
2385
- #line 109 "hpricot_scan.rl"
2403
+ #line 115 "hpricot_scan.rl"
2386
2404
  { SET(aval, p); }
2387
2405
  goto st79;
2388
2406
  st79:
2389
2407
  if ( ++p == pe )
2390
2408
  goto _test_eof79;
2391
2409
  case 79:
2392
- #line 2393 "hpricot_scan.c"
2410
+ #line 2411 "hpricot_scan.c"
2393
2411
  switch( (*p) ) {
2394
2412
  case 32: goto st79;
2395
2413
  case 34: goto tr169;
@@ -2412,70 +2430,74 @@ case 79:
2412
2430
  goto tr170;
2413
2431
  goto st80;
2414
2432
  tr157:
2415
- #line 105 "hpricot_scan.rl"
2433
+ #line 111 "hpricot_scan.rl"
2416
2434
  { mark_aval = p; }
2417
2435
  goto st80;
2418
2436
  st80:
2419
2437
  if ( ++p == pe )
2420
2438
  goto _test_eof80;
2421
2439
  case 80:
2422
- #line 2423 "hpricot_scan.c"
2440
+ #line 2441 "hpricot_scan.c"
2423
2441
  switch( (*p) ) {
2424
2442
  case 34: goto tr169;
2425
2443
  case 92: goto st81;
2426
2444
  }
2427
2445
  goto st80;
2428
2446
  tr340:
2429
- #line 105 "hpricot_scan.rl"
2447
+ #line 111 "hpricot_scan.rl"
2430
2448
  { mark_aval = p; }
2431
2449
  goto st81;
2432
2450
  st81:
2433
2451
  if ( ++p == pe )
2434
2452
  goto _test_eof81;
2435
2453
  case 81:
2436
- #line 2437 "hpricot_scan.c"
2454
+ #line 2455 "hpricot_scan.c"
2437
2455
  switch( (*p) ) {
2438
2456
  case 34: goto tr174;
2439
2457
  case 92: goto st81;
2440
2458
  }
2441
2459
  goto st80;
2442
2460
  tr170:
2443
- #line 128 "hpricot_scan.rl"
2444
- {
2461
+ #line 134 "hpricot_scan.rl"
2462
+ {
2463
+ if (!S->xml)
2464
+ akey = rb_funcall(akey, s_downcase, 0);
2445
2465
  ATTR(akey, aval);
2446
2466
  }
2447
- #line 121 "hpricot_scan.rl"
2448
- {
2467
+ #line 127 "hpricot_scan.rl"
2468
+ {
2449
2469
  akey = Qnil;
2450
2470
  aval = Qnil;
2451
2471
  mark_akey = NULL;
2452
2472
  mark_aval = NULL;
2453
2473
  }
2454
- #line 106 "hpricot_scan.rl"
2474
+ #line 112 "hpricot_scan.rl"
2455
2475
  { mark_akey = p; }
2456
2476
  goto st82;
2457
2477
  tr337:
2458
- #line 105 "hpricot_scan.rl"
2478
+ #line 111 "hpricot_scan.rl"
2459
2479
  { mark_aval = p; }
2460
- #line 128 "hpricot_scan.rl"
2461
- {
2480
+ #line 134 "hpricot_scan.rl"
2481
+ {
2482
+ if (!S->xml)
2483
+ akey = rb_funcall(akey, s_downcase, 0);
2462
2484
  ATTR(akey, aval);
2463
2485
  }
2464
- #line 121 "hpricot_scan.rl"
2465
- {
2486
+ #line 127 "hpricot_scan.rl"
2487
+ {
2466
2488
  akey = Qnil;
2467
2489
  aval = Qnil;
2468
2490
  mark_akey = NULL;
2469
2491
  mark_aval = NULL;
2470
2492
  }
2471
- #line 106 "hpricot_scan.rl"
2493
+ #line 112 "hpricot_scan.rl"
2472
2494
  { mark_akey = p; }
2473
2495
  goto st82;
2474
2496
  st82:
2475
2497
  if ( ++p == pe )
2476
2498
  goto _test_eof82;
2477
2499
  case 82:
2478
- #line 2479 "hpricot_scan.c"
2500
+ #line 2501 "hpricot_scan.c"
2479
2501
  switch( (*p) ) {
2480
2502
  case 32: goto tr175;
2481
2503
  case 34: goto tr169;
@@ -2499,21 +2521,21 @@ case 82:
2499
2521
  goto st82;
2500
2522
  goto st80;
2501
2523
  tr175:
2502
- #line 114 "hpricot_scan.rl"
2524
+ #line 120 "hpricot_scan.rl"
2503
2525
  { SET(akey, p); }
2504
2526
  goto st83;
2505
2527
  tr206:
2506
- #line 110 "hpricot_scan.rl"
2507
- {
2528
+ #line 116 "hpricot_scan.rl"
2529
+ {
2508
2530
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2509
2531
  else { SET(aval, p); }
2510
2532
  }
2511
2533
  goto st83;
2512
2534
  tr200:
2513
- #line 114 "hpricot_scan.rl"
2535
+ #line 120 "hpricot_scan.rl"
2514
2536
  { SET(akey, p); }
2515
- #line 110 "hpricot_scan.rl"
2516
- {
2537
+ #line 116 "hpricot_scan.rl"
2538
+ {
2517
2539
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2518
2540
  else { SET(aval, p); }
2519
2541
  }
@@ -2522,7 +2544,7 @@ st83:
2522
2544
  if ( ++p == pe )
2523
2545
  goto _test_eof83;
2524
2546
  case 83:
2525
- #line 2526 "hpricot_scan.c"
2547
+ #line 2548 "hpricot_scan.c"
2526
2548
  switch( (*p) ) {
2527
2549
  case 32: goto st83;
2528
2550
  case 34: goto tr169;
@@ -2546,24 +2568,30 @@ case 83:
2546
2568
  goto tr170;
2547
2569
  goto st80;
2548
2570
  tr177:
2549
- #line 114 "hpricot_scan.rl"
2571
+ #line 120 "hpricot_scan.rl"
2550
2572
  { SET(akey, p); }
2551
- #line 128 "hpricot_scan.rl"
2552
- {
2573
+ #line 134 "hpricot_scan.rl"
2574
+ {
2575
+ if (!S->xml)
2576
+ akey = rb_funcall(akey, s_downcase, 0);
2553
2577
  ATTR(akey, aval);
2554
2578
  }
2555
2579
  goto st84;
2556
2580
  tr171:
2557
- #line 128 "hpricot_scan.rl"
2558
- {
2581
+ #line 134 "hpricot_scan.rl"
2582
+ {
2583
+ if (!S->xml)
2584
+ akey = rb_funcall(akey, s_downcase, 0);
2559
2585
  ATTR(akey, aval);
2560
2586
  }
2561
2587
  goto st84;
2562
2588
  tr338:
2563
- #line 105 "hpricot_scan.rl"
2589
+ #line 111 "hpricot_scan.rl"
2564
2590
  { mark_aval = p; }
2565
- #line 128 "hpricot_scan.rl"
2566
- {
2591
+ #line 134 "hpricot_scan.rl"
2592
+ {
2593
+ if (!S->xml)
2594
+ akey = rb_funcall(akey, s_downcase, 0);
2567
2595
  ATTR(akey, aval);
2568
2596
  }
2569
2597
  goto st84;
@@ -2571,7 +2599,7 @@ st84:
2571
2599
  if ( ++p == pe )
2572
2600
  goto _test_eof84;
2573
2601
  case 84:
2574
- #line 2575 "hpricot_scan.c"
2602
+ #line 2603 "hpricot_scan.c"
2575
2603
  switch( (*p) ) {
2576
2604
  case 34: goto tr169;
2577
2605
  case 62: goto tr182;
@@ -2581,15 +2609,17 @@ case 84:
2581
2609
  tr158:
2582
2610
  #line 1 "hpricot_scan.rl"
2583
2611
  {te = p+1;}
2584
- #line 105 "hpricot_scan.rl"
2612
+ #line 111 "hpricot_scan.rl"
2585
2613
  { mark_aval = p; }
2586
- #line 110 "hpricot_scan.rl"
2587
- {
2614
+ #line 116 "hpricot_scan.rl"
2615
+ {
2588
2616
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2589
2617
  else { SET(aval, p); }
2590
2618
  }
2591
- #line 128 "hpricot_scan.rl"
2592
- {
2619
+ #line 134 "hpricot_scan.rl"
2620
+ {
2621
+ if (!S->xml)
2622
+ akey = rb_funcall(akey, s_downcase, 0);
2593
2623
  ATTR(akey, aval);
2594
2624
  }
2595
2625
  #line 68 "hpricot_scan.rl"
@@ -2598,13 +2628,15 @@ tr158:
2598
2628
  tr166:
2599
2629
  #line 1 "hpricot_scan.rl"
2600
2630
  {te = p+1;}
2601
- #line 110 "hpricot_scan.rl"
2602
- {
2631
+ #line 116 "hpricot_scan.rl"
2632
+ {
2603
2633
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2604
2634
  else { SET(aval, p); }
2605
2635
  }
2606
- #line 128 "hpricot_scan.rl"
2607
- {
2636
+ #line 134 "hpricot_scan.rl"
2637
+ {
2638
+ if (!S->xml)
2639
+ akey = rb_funcall(akey, s_downcase, 0);
2608
2640
  ATTR(akey, aval);
2609
2641
  }
2610
2642
  #line 68 "hpricot_scan.rl"
@@ -2613,8 +2645,10 @@ tr166:
2613
2645
  tr172:
2614
2646
  #line 1 "hpricot_scan.rl"
2615
2647
  {te = p+1;}
2616
- #line 128 "hpricot_scan.rl"
2617
- {
2648
+ #line 134 "hpricot_scan.rl"
2649
+ {
2650
+ if (!S->xml)
2651
+ akey = rb_funcall(akey, s_downcase, 0);
2618
2652
  ATTR(akey, aval);
2619
2653
  }
2620
2654
  #line 68 "hpricot_scan.rl"
@@ -2623,10 +2657,12 @@ tr172:
2623
2657
  tr179:
2624
2658
  #line 1 "hpricot_scan.rl"
2625
2659
  {te = p+1;}
2626
- #line 114 "hpricot_scan.rl"
2660
+ #line 120 "hpricot_scan.rl"
2627
2661
  { SET(akey, p); }
2628
- #line 128 "hpricot_scan.rl"
2629
- {
2662
+ #line 134 "hpricot_scan.rl"
2663
+ {
2664
+ if (!S->xml)
2665
+ akey = rb_funcall(akey, s_downcase, 0);
2630
2666
  ATTR(akey, aval);
2631
2667
  }
2632
2668
  #line 68 "hpricot_scan.rl"
@@ -2641,12 +2677,14 @@ tr182:
2641
2677
  tr196:
2642
2678
  #line 1 "hpricot_scan.rl"
2643
2679
  {te = p+1;}
2644
- #line 128 "hpricot_scan.rl"
2645
- {
2680
+ #line 134 "hpricot_scan.rl"
2681
+ {
2682
+ if (!S->xml)
2683
+ akey = rb_funcall(akey, s_downcase, 0);
2646
2684
  ATTR(akey, aval);
2647
2685
  }
2648
- #line 110 "hpricot_scan.rl"
2649
- {
2686
+ #line 116 "hpricot_scan.rl"
2687
+ {
2650
2688
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2651
2689
  else { SET(aval, p); }
2652
2690
  }
@@ -2656,14 +2694,16 @@ tr196:
2656
2694
  tr197:
2657
2695
  #line 1 "hpricot_scan.rl"
2658
2696
  {te = p+1;}
2659
- #line 105 "hpricot_scan.rl"
2697
+ #line 111 "hpricot_scan.rl"
2660
2698
  { mark_aval = p; }
2661
- #line 128 "hpricot_scan.rl"
2662
- {
2699
+ #line 134 "hpricot_scan.rl"
2700
+ {
2701
+ if (!S->xml)
2702
+ akey = rb_funcall(akey, s_downcase, 0);
2663
2703
  ATTR(akey, aval);
2664
2704
  }
2665
- #line 110 "hpricot_scan.rl"
2666
- {
2705
+ #line 116 "hpricot_scan.rl"
2706
+ {
2667
2707
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2668
2708
  else { SET(aval, p); }
2669
2709
  }
@@ -2673,15 +2713,17 @@ tr197:
2673
2713
  tr205:
2674
2714
  #line 1 "hpricot_scan.rl"
2675
2715
  {te = p+1;}
2676
- #line 110 "hpricot_scan.rl"
2677
- {
2716
+ #line 116 "hpricot_scan.rl"
2717
+ {
2678
2718
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2679
2719
  else { SET(aval, p); }
2680
2720
  }
2681
- #line 114 "hpricot_scan.rl"
2721
+ #line 120 "hpricot_scan.rl"
2682
2722
  { SET(akey, p); }
2683
- #line 128 "hpricot_scan.rl"
2684
- {
2723
+ #line 134 "hpricot_scan.rl"
2724
+ {
2725
+ if (!S->xml)
2726
+ akey = rb_funcall(akey, s_downcase, 0);
2685
2727
  ATTR(akey, aval);
2686
2728
  }
2687
2729
  #line 68 "hpricot_scan.rl"
@@ -2690,10 +2732,12 @@ tr205:
2690
2732
  tr339:
2691
2733
  #line 1 "hpricot_scan.rl"
2692
2734
  {te = p+1;}
2693
- #line 105 "hpricot_scan.rl"
2735
+ #line 111 "hpricot_scan.rl"
2694
2736
  { mark_aval = p; }
2695
- #line 128 "hpricot_scan.rl"
2696
- {
2737
+ #line 134 "hpricot_scan.rl"
2738
+ {
2739
+ if (!S->xml)
2740
+ akey = rb_funcall(akey, s_downcase, 0);
2697
2741
  ATTR(akey, aval);
2698
2742
  }
2699
2743
  #line 68 "hpricot_scan.rl"
@@ -2703,21 +2747,21 @@ st209:
2703
2747
  if ( ++p == pe )
2704
2748
  goto _test_eof209;
2705
2749
  case 209:
2706
- #line 2707 "hpricot_scan.c"
2750
+ #line 2751 "hpricot_scan.c"
2707
2751
  switch( (*p) ) {
2708
2752
  case 34: goto tr169;
2709
2753
  case 92: goto st81;
2710
2754
  }
2711
2755
  goto st80;
2712
2756
  tr178:
2713
- #line 114 "hpricot_scan.rl"
2757
+ #line 120 "hpricot_scan.rl"
2714
2758
  { SET(akey, p); }
2715
2759
  goto st85;
2716
2760
  st85:
2717
2761
  if ( ++p == pe )
2718
2762
  goto _test_eof85;
2719
2763
  case 85:
2720
- #line 2721 "hpricot_scan.c"
2764
+ #line 2765 "hpricot_scan.c"
2721
2765
  switch( (*p) ) {
2722
2766
  case 13: goto tr183;
2723
2767
  case 32: goto tr183;
@@ -2735,14 +2779,14 @@ case 85:
2735
2779
  goto tr183;
2736
2780
  goto tr152;
2737
2781
  tr183:
2738
- #line 105 "hpricot_scan.rl"
2782
+ #line 111 "hpricot_scan.rl"
2739
2783
  { mark_aval = p; }
2740
2784
  goto st86;
2741
2785
  st86:
2742
2786
  if ( ++p == pe )
2743
2787
  goto _test_eof86;
2744
2788
  case 86:
2745
- #line 2746 "hpricot_scan.c"
2789
+ #line 2790 "hpricot_scan.c"
2746
2790
  switch( (*p) ) {
2747
2791
  case 13: goto tr188;
2748
2792
  case 32: goto tr188;
@@ -2760,14 +2804,14 @@ case 86:
2760
2804
  goto tr188;
2761
2805
  goto tr152;
2762
2806
  tr188:
2763
- #line 105 "hpricot_scan.rl"
2807
+ #line 111 "hpricot_scan.rl"
2764
2808
  { mark_aval = p; }
2765
2809
  goto st87;
2766
2810
  tr191:
2767
- #line 105 "hpricot_scan.rl"
2811
+ #line 111 "hpricot_scan.rl"
2768
2812
  { mark_aval = p; }
2769
- #line 110 "hpricot_scan.rl"
2770
- {
2813
+ #line 116 "hpricot_scan.rl"
2814
+ {
2771
2815
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2772
2816
  else { SET(aval, p); }
2773
2817
  }
@@ -2776,7 +2820,7 @@ st87:
2776
2820
  if ( ++p == pe )
2777
2821
  goto _test_eof87;
2778
2822
  case 87:
2779
- #line 2780 "hpricot_scan.c"
2823
+ #line 2824 "hpricot_scan.c"
2780
2824
  switch( (*p) ) {
2781
2825
  case 13: goto tr188;
2782
2826
  case 32: goto tr188;
@@ -2805,14 +2849,14 @@ case 87:
2805
2849
  goto tr190;
2806
2850
  goto tr152;
2807
2851
  tr189:
2808
- #line 105 "hpricot_scan.rl"
2852
+ #line 111 "hpricot_scan.rl"
2809
2853
  { mark_aval = p; }
2810
2854
  goto st88;
2811
2855
  tr192:
2812
- #line 105 "hpricot_scan.rl"
2856
+ #line 111 "hpricot_scan.rl"
2813
2857
  { mark_aval = p; }
2814
- #line 110 "hpricot_scan.rl"
2815
- {
2858
+ #line 116 "hpricot_scan.rl"
2859
+ {
2816
2860
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2817
2861
  else { SET(aval, p); }
2818
2862
  }
@@ -2821,7 +2865,7 @@ st88:
2821
2865
  if ( ++p == pe )
2822
2866
  goto _test_eof88;
2823
2867
  case 88:
2824
- #line 2825 "hpricot_scan.c"
2868
+ #line 2869 "hpricot_scan.c"
2825
2869
  switch( (*p) ) {
2826
2870
  case 13: goto tr191;
2827
2871
  case 32: goto tr191;
@@ -2850,14 +2894,14 @@ case 88:
2850
2894
  goto tr190;
2851
2895
  goto tr152;
2852
2896
  tr193:
2853
- #line 109 "hpricot_scan.rl"
2897
+ #line 115 "hpricot_scan.rl"
2854
2898
  { SET(aval, p); }
2855
2899
  goto st89;
2856
2900
  st89:
2857
2901
  if ( ++p == pe )
2858
2902
  goto _test_eof89;
2859
2903
  case 89:
2860
- #line 2861 "hpricot_scan.c"
2904
+ #line 2905 "hpricot_scan.c"
2861
2905
  switch( (*p) ) {
2862
2906
  case 13: goto tr153;
2863
2907
  case 32: goto tr153;
@@ -2885,36 +2929,36 @@ case 89:
2885
2929
  goto tr190;
2886
2930
  goto tr152;
2887
2931
  tr162:
2888
- #line 110 "hpricot_scan.rl"
2889
- {
2932
+ #line 116 "hpricot_scan.rl"
2933
+ {
2890
2934
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2891
2935
  else { SET(aval, p); }
2892
2936
  }
2893
2937
  goto st90;
2894
2938
  tr154:
2895
- #line 105 "hpricot_scan.rl"
2939
+ #line 111 "hpricot_scan.rl"
2896
2940
  { mark_aval = p; }
2897
- #line 110 "hpricot_scan.rl"
2898
- {
2941
+ #line 116 "hpricot_scan.rl"
2942
+ {
2899
2943
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2900
2944
  else { SET(aval, p); }
2901
2945
  }
2902
2946
  goto st90;
2903
2947
  tr214:
2904
- #line 105 "hpricot_scan.rl"
2948
+ #line 111 "hpricot_scan.rl"
2905
2949
  { mark_aval = p; }
2906
- #line 109 "hpricot_scan.rl"
2950
+ #line 115 "hpricot_scan.rl"
2907
2951
  { SET(aval, p); }
2908
2952
  goto st90;
2909
2953
  tr209:
2910
- #line 109 "hpricot_scan.rl"
2954
+ #line 115 "hpricot_scan.rl"
2911
2955
  { SET(aval, p); }
2912
2956
  goto st90;
2913
2957
  st90:
2914
2958
  if ( ++p == pe )
2915
2959
  goto _test_eof90;
2916
2960
  case 90:
2917
- #line 2918 "hpricot_scan.c"
2961
+ #line 2962 "hpricot_scan.c"
2918
2962
  switch( (*p) ) {
2919
2963
  case 13: goto tr161;
2920
2964
  case 32: goto tr161;
@@ -2942,42 +2986,46 @@ case 90:
2942
2986
  goto tr198;
2943
2987
  goto st78;
2944
2988
  tr198:
2945
- #line 128 "hpricot_scan.rl"
2946
- {
2989
+ #line 134 "hpricot_scan.rl"
2990
+ {
2991
+ if (!S->xml)
2992
+ akey = rb_funcall(akey, s_downcase, 0);
2947
2993
  ATTR(akey, aval);
2948
2994
  }
2949
- #line 121 "hpricot_scan.rl"
2950
- {
2995
+ #line 127 "hpricot_scan.rl"
2996
+ {
2951
2997
  akey = Qnil;
2952
2998
  aval = Qnil;
2953
2999
  mark_akey = NULL;
2954
3000
  mark_aval = NULL;
2955
3001
  }
2956
- #line 106 "hpricot_scan.rl"
3002
+ #line 112 "hpricot_scan.rl"
2957
3003
  { mark_akey = p; }
2958
3004
  goto st91;
2959
3005
  tr190:
2960
- #line 105 "hpricot_scan.rl"
3006
+ #line 111 "hpricot_scan.rl"
2961
3007
  { mark_aval = p; }
2962
- #line 128 "hpricot_scan.rl"
2963
- {
3008
+ #line 134 "hpricot_scan.rl"
3009
+ {
3010
+ if (!S->xml)
3011
+ akey = rb_funcall(akey, s_downcase, 0);
2964
3012
  ATTR(akey, aval);
2965
3013
  }
2966
- #line 121 "hpricot_scan.rl"
2967
- {
3014
+ #line 127 "hpricot_scan.rl"
3015
+ {
2968
3016
  akey = Qnil;
2969
3017
  aval = Qnil;
2970
3018
  mark_akey = NULL;
2971
3019
  mark_aval = NULL;
2972
3020
  }
2973
- #line 106 "hpricot_scan.rl"
3021
+ #line 112 "hpricot_scan.rl"
2974
3022
  { mark_akey = p; }
2975
3023
  goto st91;
2976
3024
  st91:
2977
3025
  if ( ++p == pe )
2978
3026
  goto _test_eof91;
2979
3027
  case 91:
2980
- #line 2981 "hpricot_scan.c"
3028
+ #line 3029 "hpricot_scan.c"
2981
3029
  switch( (*p) ) {
2982
3030
  case 13: goto tr200;
2983
3031
  case 32: goto tr200;
@@ -3006,17 +3054,17 @@ case 91:
3006
3054
  goto st91;
3007
3055
  goto st78;
3008
3056
  tr207:
3009
- #line 110 "hpricot_scan.rl"
3010
- {
3057
+ #line 116 "hpricot_scan.rl"
3058
+ {
3011
3059
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3012
3060
  else { SET(aval, p); }
3013
3061
  }
3014
3062
  goto st92;
3015
3063
  tr201:
3016
- #line 114 "hpricot_scan.rl"
3064
+ #line 120 "hpricot_scan.rl"
3017
3065
  { SET(akey, p); }
3018
- #line 110 "hpricot_scan.rl"
3019
- {
3066
+ #line 116 "hpricot_scan.rl"
3067
+ {
3020
3068
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3021
3069
  else { SET(aval, p); }
3022
3070
  }
@@ -3025,7 +3073,7 @@ st92:
3025
3073
  if ( ++p == pe )
3026
3074
  goto _test_eof92;
3027
3075
  case 92:
3028
- #line 3029 "hpricot_scan.c"
3076
+ #line 3077 "hpricot_scan.c"
3029
3077
  switch( (*p) ) {
3030
3078
  case 13: goto tr206;
3031
3079
  case 32: goto tr206;
@@ -3054,70 +3102,82 @@ case 92:
3054
3102
  goto tr198;
3055
3103
  goto st78;
3056
3104
  tr187:
3057
- #line 105 "hpricot_scan.rl"
3105
+ #line 111 "hpricot_scan.rl"
3058
3106
  { mark_aval = p; }
3059
- #line 128 "hpricot_scan.rl"
3060
- {
3107
+ #line 134 "hpricot_scan.rl"
3108
+ {
3109
+ if (!S->xml)
3110
+ akey = rb_funcall(akey, s_downcase, 0);
3061
3111
  ATTR(akey, aval);
3062
3112
  }
3063
3113
  goto st93;
3064
3114
  tr164:
3065
- #line 110 "hpricot_scan.rl"
3066
- {
3115
+ #line 116 "hpricot_scan.rl"
3116
+ {
3067
3117
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3068
3118
  else { SET(aval, p); }
3069
3119
  }
3070
- #line 128 "hpricot_scan.rl"
3071
- {
3120
+ #line 134 "hpricot_scan.rl"
3121
+ {
3122
+ if (!S->xml)
3123
+ akey = rb_funcall(akey, s_downcase, 0);
3072
3124
  ATTR(akey, aval);
3073
3125
  }
3074
3126
  goto st93;
3075
3127
  tr199:
3076
- #line 128 "hpricot_scan.rl"
3077
- {
3128
+ #line 134 "hpricot_scan.rl"
3129
+ {
3130
+ if (!S->xml)
3131
+ akey = rb_funcall(akey, s_downcase, 0);
3078
3132
  ATTR(akey, aval);
3079
3133
  }
3080
- #line 110 "hpricot_scan.rl"
3081
- {
3134
+ #line 116 "hpricot_scan.rl"
3135
+ {
3082
3136
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3083
3137
  else { SET(aval, p); }
3084
3138
  }
3085
3139
  goto st93;
3086
3140
  tr203:
3087
- #line 110 "hpricot_scan.rl"
3088
- {
3141
+ #line 116 "hpricot_scan.rl"
3142
+ {
3089
3143
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3090
3144
  else { SET(aval, p); }
3091
3145
  }
3092
- #line 114 "hpricot_scan.rl"
3146
+ #line 120 "hpricot_scan.rl"
3093
3147
  { SET(akey, p); }
3094
- #line 128 "hpricot_scan.rl"
3095
- {
3148
+ #line 134 "hpricot_scan.rl"
3149
+ {
3150
+ if (!S->xml)
3151
+ akey = rb_funcall(akey, s_downcase, 0);
3096
3152
  ATTR(akey, aval);
3097
3153
  }
3098
3154
  goto st93;
3099
3155
  tr156:
3100
- #line 105 "hpricot_scan.rl"
3156
+ #line 111 "hpricot_scan.rl"
3101
3157
  { mark_aval = p; }
3102
- #line 110 "hpricot_scan.rl"
3103
- {
3158
+ #line 116 "hpricot_scan.rl"
3159
+ {
3104
3160
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3105
3161
  else { SET(aval, p); }
3106
3162
  }
3107
- #line 128 "hpricot_scan.rl"
3108
- {
3163
+ #line 134 "hpricot_scan.rl"
3164
+ {
3165
+ if (!S->xml)
3166
+ akey = rb_funcall(akey, s_downcase, 0);
3109
3167
  ATTR(akey, aval);
3110
3168
  }
3111
3169
  goto st93;
3112
3170
  tr195:
3113
- #line 105 "hpricot_scan.rl"
3171
+ #line 111 "hpricot_scan.rl"
3114
3172
  { mark_aval = p; }
3115
- #line 128 "hpricot_scan.rl"
3116
- {
3173
+ #line 134 "hpricot_scan.rl"
3174
+ {
3175
+ if (!S->xml)
3176
+ akey = rb_funcall(akey, s_downcase, 0);
3117
3177
  ATTR(akey, aval);
3118
3178
  }
3119
- #line 110 "hpricot_scan.rl"
3120
- {
3179
+ #line 116 "hpricot_scan.rl"
3180
+ {
3121
3181
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3122
3182
  else { SET(aval, p); }
3123
3183
  }
@@ -3126,7 +3186,7 @@ st93:
3126
3186
  if ( ++p == pe )
3127
3187
  goto _test_eof93;
3128
3188
  case 93:
3129
- #line 3130 "hpricot_scan.c"
3189
+ #line 3190 "hpricot_scan.c"
3130
3190
  switch( (*p) ) {
3131
3191
  case 13: goto tr161;
3132
3192
  case 32: goto tr161;
@@ -3143,14 +3203,14 @@ case 93:
3143
3203
  goto tr161;
3144
3204
  goto st78;
3145
3205
  tr159:
3146
- #line 105 "hpricot_scan.rl"
3206
+ #line 111 "hpricot_scan.rl"
3147
3207
  { mark_aval = p; }
3148
3208
  goto st94;
3149
3209
  st94:
3150
3210
  if ( ++p == pe )
3151
3211
  goto _test_eof94;
3152
3212
  case 94:
3153
- #line 3154 "hpricot_scan.c"
3213
+ #line 3214 "hpricot_scan.c"
3154
3214
  switch( (*p) ) {
3155
3215
  case 13: goto tr161;
3156
3216
  case 32: goto tr161;
@@ -3167,18 +3227,18 @@ case 94:
3167
3227
  goto tr161;
3168
3228
  goto st78;
3169
3229
  tr184:
3170
- #line 105 "hpricot_scan.rl"
3230
+ #line 111 "hpricot_scan.rl"
3171
3231
  { mark_aval = p; }
3172
3232
  goto st95;
3173
3233
  tr204:
3174
- #line 114 "hpricot_scan.rl"
3234
+ #line 120 "hpricot_scan.rl"
3175
3235
  { SET(akey, p); }
3176
3236
  goto st95;
3177
3237
  st95:
3178
3238
  if ( ++p == pe )
3179
3239
  goto _test_eof95;
3180
3240
  case 95:
3181
- #line 3182 "hpricot_scan.c"
3241
+ #line 3242 "hpricot_scan.c"
3182
3242
  switch( (*p) ) {
3183
3243
  case 13: goto tr191;
3184
3244
  case 32: goto tr191;
@@ -3216,14 +3276,14 @@ case 96:
3216
3276
  goto tr211;
3217
3277
  goto tr210;
3218
3278
  tr210:
3219
- #line 105 "hpricot_scan.rl"
3279
+ #line 111 "hpricot_scan.rl"
3220
3280
  { mark_aval = p; }
3221
3281
  goto st97;
3222
3282
  st97:
3223
3283
  if ( ++p == pe )
3224
3284
  goto _test_eof97;
3225
3285
  case 97:
3226
- #line 3227 "hpricot_scan.c"
3286
+ #line 3287 "hpricot_scan.c"
3227
3287
  switch( (*p) ) {
3228
3288
  case 13: goto tr220;
3229
3289
  case 32: goto tr220;
@@ -3241,34 +3301,34 @@ case 97:
3241
3301
  goto tr220;
3242
3302
  goto st97;
3243
3303
  tr315:
3244
- #line 105 "hpricot_scan.rl"
3304
+ #line 111 "hpricot_scan.rl"
3245
3305
  { mark_aval = p; }
3246
3306
  goto st98;
3247
3307
  tr220:
3248
- #line 110 "hpricot_scan.rl"
3249
- {
3308
+ #line 116 "hpricot_scan.rl"
3309
+ {
3250
3310
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3251
3311
  else { SET(aval, p); }
3252
3312
  }
3253
3313
  goto st98;
3254
3314
  tr211:
3255
- #line 105 "hpricot_scan.rl"
3315
+ #line 111 "hpricot_scan.rl"
3256
3316
  { mark_aval = p; }
3257
- #line 110 "hpricot_scan.rl"
3258
- {
3317
+ #line 116 "hpricot_scan.rl"
3318
+ {
3259
3319
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3260
3320
  else { SET(aval, p); }
3261
3321
  }
3262
3322
  goto st98;
3263
3323
  tr299:
3264
- #line 109 "hpricot_scan.rl"
3324
+ #line 115 "hpricot_scan.rl"
3265
3325
  { SET(aval, p); }
3266
3326
  goto st98;
3267
3327
  st98:
3268
3328
  if ( ++p == pe )
3269
3329
  goto _test_eof98;
3270
3330
  case 98:
3271
- #line 3272 "hpricot_scan.c"
3331
+ #line 3332 "hpricot_scan.c"
3272
3332
  switch( (*p) ) {
3273
3333
  case 32: goto st98;
3274
3334
  case 34: goto tr228;
@@ -3292,14 +3352,14 @@ case 98:
3292
3352
  goto tr229;
3293
3353
  goto st99;
3294
3354
  tr216:
3295
- #line 105 "hpricot_scan.rl"
3355
+ #line 111 "hpricot_scan.rl"
3296
3356
  { mark_aval = p; }
3297
3357
  goto st99;
3298
3358
  st99:
3299
3359
  if ( ++p == pe )
3300
3360
  goto _test_eof99;
3301
3361
  case 99:
3302
- #line 3303 "hpricot_scan.c"
3362
+ #line 3363 "hpricot_scan.c"
3303
3363
  switch( (*p) ) {
3304
3364
  case 34: goto tr228;
3305
3365
  case 39: goto tr174;
@@ -3307,46 +3367,46 @@ case 99:
3307
3367
  }
3308
3368
  goto st99;
3309
3369
  tr330:
3310
- #line 105 "hpricot_scan.rl"
3370
+ #line 111 "hpricot_scan.rl"
3311
3371
  { mark_aval = p; }
3312
3372
  goto st100;
3313
3373
  tr255:
3314
- #line 110 "hpricot_scan.rl"
3315
- {
3374
+ #line 116 "hpricot_scan.rl"
3375
+ {
3316
3376
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3317
3377
  else { SET(aval, p); }
3318
3378
  }
3319
3379
  goto st100;
3320
3380
  tr326:
3321
- #line 105 "hpricot_scan.rl"
3381
+ #line 111 "hpricot_scan.rl"
3322
3382
  { mark_aval = p; }
3323
- #line 110 "hpricot_scan.rl"
3324
- {
3383
+ #line 116 "hpricot_scan.rl"
3384
+ {
3325
3385
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3326
3386
  else { SET(aval, p); }
3327
3387
  }
3328
3388
  goto st100;
3329
3389
  tr316:
3330
- #line 105 "hpricot_scan.rl"
3390
+ #line 111 "hpricot_scan.rl"
3331
3391
  { mark_aval = p; }
3332
- #line 109 "hpricot_scan.rl"
3392
+ #line 115 "hpricot_scan.rl"
3333
3393
  { SET(aval, p); }
3334
3394
  goto st100;
3335
3395
  tr228:
3336
- #line 109 "hpricot_scan.rl"
3396
+ #line 115 "hpricot_scan.rl"
3337
3397
  { SET(aval, p); }
3338
3398
  goto st100;
3339
3399
  tr322:
3340
- #line 109 "hpricot_scan.rl"
3400
+ #line 115 "hpricot_scan.rl"
3341
3401
  { SET(aval, p); }
3342
- #line 105 "hpricot_scan.rl"
3402
+ #line 111 "hpricot_scan.rl"
3343
3403
  { mark_aval = p; }
3344
3404
  goto st100;
3345
3405
  st100:
3346
3406
  if ( ++p == pe )
3347
3407
  goto _test_eof100;
3348
3408
  case 100:
3349
- #line 3350 "hpricot_scan.c"
3409
+ #line 3410 "hpricot_scan.c"
3350
3410
  switch( (*p) ) {
3351
3411
  case 32: goto st100;
3352
3412
  case 39: goto tr169;
@@ -3369,70 +3429,74 @@ case 100:
3369
3429
  goto tr235;
3370
3430
  goto st101;
3371
3431
  tr328:
3372
- #line 105 "hpricot_scan.rl"
3432
+ #line 111 "hpricot_scan.rl"
3373
3433
  { mark_aval = p; }
3374
3434
  goto st101;
3375
3435
  st101:
3376
3436
  if ( ++p == pe )
3377
3437
  goto _test_eof101;
3378
3438
  case 101:
3379
- #line 3380 "hpricot_scan.c"
3439
+ #line 3440 "hpricot_scan.c"
3380
3440
  switch( (*p) ) {
3381
3441
  case 39: goto tr169;
3382
3442
  case 92: goto st102;
3383
3443
  }
3384
3444
  goto st101;
3385
3445
  tr335:
3386
- #line 105 "hpricot_scan.rl"
3446
+ #line 111 "hpricot_scan.rl"
3387
3447
  { mark_aval = p; }
3388
3448
  goto st102;
3389
3449
  st102:
3390
3450
  if ( ++p == pe )
3391
3451
  goto _test_eof102;
3392
3452
  case 102:
3393
- #line 3394 "hpricot_scan.c"
3453
+ #line 3454 "hpricot_scan.c"
3394
3454
  switch( (*p) ) {
3395
3455
  case 39: goto tr228;
3396
3456
  case 92: goto st102;
3397
3457
  }
3398
3458
  goto st101;
3399
3459
  tr235:
3400
- #line 128 "hpricot_scan.rl"
3401
- {
3460
+ #line 134 "hpricot_scan.rl"
3461
+ {
3462
+ if (!S->xml)
3463
+ akey = rb_funcall(akey, s_downcase, 0);
3402
3464
  ATTR(akey, aval);
3403
3465
  }
3404
- #line 121 "hpricot_scan.rl"
3405
- {
3466
+ #line 127 "hpricot_scan.rl"
3467
+ {
3406
3468
  akey = Qnil;
3407
3469
  aval = Qnil;
3408
3470
  mark_akey = NULL;
3409
3471
  mark_aval = NULL;
3410
3472
  }
3411
- #line 106 "hpricot_scan.rl"
3473
+ #line 112 "hpricot_scan.rl"
3412
3474
  { mark_akey = p; }
3413
3475
  goto st103;
3414
3476
  tr332:
3415
- #line 105 "hpricot_scan.rl"
3477
+ #line 111 "hpricot_scan.rl"
3416
3478
  { mark_aval = p; }
3417
- #line 128 "hpricot_scan.rl"
3418
- {
3479
+ #line 134 "hpricot_scan.rl"
3480
+ {
3481
+ if (!S->xml)
3482
+ akey = rb_funcall(akey, s_downcase, 0);
3419
3483
  ATTR(akey, aval);
3420
3484
  }
3421
- #line 121 "hpricot_scan.rl"
3422
- {
3485
+ #line 127 "hpricot_scan.rl"
3486
+ {
3423
3487
  akey = Qnil;
3424
3488
  aval = Qnil;
3425
3489
  mark_akey = NULL;
3426
3490
  mark_aval = NULL;
3427
3491
  }
3428
- #line 106 "hpricot_scan.rl"
3492
+ #line 112 "hpricot_scan.rl"
3429
3493
  { mark_akey = p; }
3430
3494
  goto st103;
3431
3495
  st103:
3432
3496
  if ( ++p == pe )
3433
3497
  goto _test_eof103;
3434
3498
  case 103:
3435
- #line 3436 "hpricot_scan.c"
3499
+ #line 3500 "hpricot_scan.c"
3436
3500
  switch( (*p) ) {
3437
3501
  case 32: goto tr239;
3438
3502
  case 39: goto tr169;
@@ -3456,21 +3520,21 @@ case 103:
3456
3520
  goto st103;
3457
3521
  goto st101;
3458
3522
  tr239:
3459
- #line 114 "hpricot_scan.rl"
3523
+ #line 120 "hpricot_scan.rl"
3460
3524
  { SET(akey, p); }
3461
3525
  goto st104;
3462
3526
  tr269:
3463
- #line 110 "hpricot_scan.rl"
3464
- {
3527
+ #line 116 "hpricot_scan.rl"
3528
+ {
3465
3529
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3466
3530
  else { SET(aval, p); }
3467
3531
  }
3468
3532
  goto st104;
3469
3533
  tr263:
3470
- #line 114 "hpricot_scan.rl"
3534
+ #line 120 "hpricot_scan.rl"
3471
3535
  { SET(akey, p); }
3472
- #line 110 "hpricot_scan.rl"
3473
- {
3536
+ #line 116 "hpricot_scan.rl"
3537
+ {
3474
3538
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3475
3539
  else { SET(aval, p); }
3476
3540
  }
@@ -3479,7 +3543,7 @@ st104:
3479
3543
  if ( ++p == pe )
3480
3544
  goto _test_eof104;
3481
3545
  case 104:
3482
- #line 3483 "hpricot_scan.c"
3546
+ #line 3547 "hpricot_scan.c"
3483
3547
  switch( (*p) ) {
3484
3548
  case 32: goto st104;
3485
3549
  case 39: goto tr169;
@@ -3503,24 +3567,30 @@ case 104:
3503
3567
  goto tr235;
3504
3568
  goto st101;
3505
3569
  tr241:
3506
- #line 114 "hpricot_scan.rl"
3570
+ #line 120 "hpricot_scan.rl"
3507
3571
  { SET(akey, p); }
3508
- #line 128 "hpricot_scan.rl"
3509
- {
3572
+ #line 134 "hpricot_scan.rl"
3573
+ {
3574
+ if (!S->xml)
3575
+ akey = rb_funcall(akey, s_downcase, 0);
3510
3576
  ATTR(akey, aval);
3511
3577
  }
3512
3578
  goto st105;
3513
3579
  tr236:
3514
- #line 128 "hpricot_scan.rl"
3515
- {
3580
+ #line 134 "hpricot_scan.rl"
3581
+ {
3582
+ if (!S->xml)
3583
+ akey = rb_funcall(akey, s_downcase, 0);
3516
3584
  ATTR(akey, aval);
3517
3585
  }
3518
3586
  goto st105;
3519
3587
  tr333:
3520
- #line 105 "hpricot_scan.rl"
3588
+ #line 111 "hpricot_scan.rl"
3521
3589
  { mark_aval = p; }
3522
- #line 128 "hpricot_scan.rl"
3523
- {
3590
+ #line 134 "hpricot_scan.rl"
3591
+ {
3592
+ if (!S->xml)
3593
+ akey = rb_funcall(akey, s_downcase, 0);
3524
3594
  ATTR(akey, aval);
3525
3595
  }
3526
3596
  goto st105;
@@ -3528,7 +3598,7 @@ st105:
3528
3598
  if ( ++p == pe )
3529
3599
  goto _test_eof105;
3530
3600
  case 105:
3531
- #line 3532 "hpricot_scan.c"
3601
+ #line 3602 "hpricot_scan.c"
3532
3602
  switch( (*p) ) {
3533
3603
  case 39: goto tr169;
3534
3604
  case 62: goto tr246;
@@ -3538,15 +3608,17 @@ case 105:
3538
3608
  tr341:
3539
3609
  #line 1 "hpricot_scan.rl"
3540
3610
  {te = p+1;}
3541
- #line 105 "hpricot_scan.rl"
3611
+ #line 111 "hpricot_scan.rl"
3542
3612
  { mark_aval = p; }
3543
- #line 110 "hpricot_scan.rl"
3544
- {
3613
+ #line 116 "hpricot_scan.rl"
3614
+ {
3545
3615
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3546
3616
  else { SET(aval, p); }
3547
3617
  }
3548
- #line 128 "hpricot_scan.rl"
3549
- {
3618
+ #line 134 "hpricot_scan.rl"
3619
+ {
3620
+ if (!S->xml)
3621
+ akey = rb_funcall(akey, s_downcase, 0);
3550
3622
  ATTR(akey, aval);
3551
3623
  }
3552
3624
  #line 68 "hpricot_scan.rl"
@@ -3555,13 +3627,15 @@ tr341:
3555
3627
  tr258:
3556
3628
  #line 1 "hpricot_scan.rl"
3557
3629
  {te = p+1;}
3558
- #line 110 "hpricot_scan.rl"
3559
- {
3630
+ #line 116 "hpricot_scan.rl"
3631
+ {
3560
3632
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3561
3633
  else { SET(aval, p); }
3562
3634
  }
3563
- #line 128 "hpricot_scan.rl"
3564
- {
3635
+ #line 134 "hpricot_scan.rl"
3636
+ {
3637
+ if (!S->xml)
3638
+ akey = rb_funcall(akey, s_downcase, 0);
3565
3639
  ATTR(akey, aval);
3566
3640
  }
3567
3641
  #line 68 "hpricot_scan.rl"
@@ -3570,8 +3644,10 @@ tr258:
3570
3644
  tr237:
3571
3645
  #line 1 "hpricot_scan.rl"
3572
3646
  {te = p+1;}
3573
- #line 128 "hpricot_scan.rl"
3574
- {
3647
+ #line 134 "hpricot_scan.rl"
3648
+ {
3649
+ if (!S->xml)
3650
+ akey = rb_funcall(akey, s_downcase, 0);
3575
3651
  ATTR(akey, aval);
3576
3652
  }
3577
3653
  #line 68 "hpricot_scan.rl"
@@ -3580,10 +3656,12 @@ tr237:
3580
3656
  tr243:
3581
3657
  #line 1 "hpricot_scan.rl"
3582
3658
  {te = p+1;}
3583
- #line 114 "hpricot_scan.rl"
3659
+ #line 120 "hpricot_scan.rl"
3584
3660
  { SET(akey, p); }
3585
- #line 128 "hpricot_scan.rl"
3586
- {
3661
+ #line 134 "hpricot_scan.rl"
3662
+ {
3663
+ if (!S->xml)
3664
+ akey = rb_funcall(akey, s_downcase, 0);
3587
3665
  ATTR(akey, aval);
3588
3666
  }
3589
3667
  #line 68 "hpricot_scan.rl"
@@ -3598,12 +3676,14 @@ tr246:
3598
3676
  tr262:
3599
3677
  #line 1 "hpricot_scan.rl"
3600
3678
  {te = p+1;}
3601
- #line 128 "hpricot_scan.rl"
3602
- {
3679
+ #line 134 "hpricot_scan.rl"
3680
+ {
3681
+ if (!S->xml)
3682
+ akey = rb_funcall(akey, s_downcase, 0);
3603
3683
  ATTR(akey, aval);
3604
3684
  }
3605
- #line 110 "hpricot_scan.rl"
3606
- {
3685
+ #line 116 "hpricot_scan.rl"
3686
+ {
3607
3687
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3608
3688
  else { SET(aval, p); }
3609
3689
  }
@@ -3613,14 +3693,16 @@ tr262:
3613
3693
  tr329:
3614
3694
  #line 1 "hpricot_scan.rl"
3615
3695
  {te = p+1;}
3616
- #line 105 "hpricot_scan.rl"
3696
+ #line 111 "hpricot_scan.rl"
3617
3697
  { mark_aval = p; }
3618
- #line 128 "hpricot_scan.rl"
3619
- {
3698
+ #line 134 "hpricot_scan.rl"
3699
+ {
3700
+ if (!S->xml)
3701
+ akey = rb_funcall(akey, s_downcase, 0);
3620
3702
  ATTR(akey, aval);
3621
3703
  }
3622
- #line 110 "hpricot_scan.rl"
3623
- {
3704
+ #line 116 "hpricot_scan.rl"
3705
+ {
3624
3706
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3625
3707
  else { SET(aval, p); }
3626
3708
  }
@@ -3630,15 +3712,17 @@ tr329:
3630
3712
  tr268:
3631
3713
  #line 1 "hpricot_scan.rl"
3632
3714
  {te = p+1;}
3633
- #line 110 "hpricot_scan.rl"
3634
- {
3715
+ #line 116 "hpricot_scan.rl"
3716
+ {
3635
3717
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3636
3718
  else { SET(aval, p); }
3637
3719
  }
3638
- #line 114 "hpricot_scan.rl"
3720
+ #line 120 "hpricot_scan.rl"
3639
3721
  { SET(akey, p); }
3640
- #line 128 "hpricot_scan.rl"
3641
- {
3722
+ #line 134 "hpricot_scan.rl"
3723
+ {
3724
+ if (!S->xml)
3725
+ akey = rb_funcall(akey, s_downcase, 0);
3642
3726
  ATTR(akey, aval);
3643
3727
  }
3644
3728
  #line 68 "hpricot_scan.rl"
@@ -3647,10 +3731,12 @@ tr268:
3647
3731
  tr334:
3648
3732
  #line 1 "hpricot_scan.rl"
3649
3733
  {te = p+1;}
3650
- #line 105 "hpricot_scan.rl"
3734
+ #line 111 "hpricot_scan.rl"
3651
3735
  { mark_aval = p; }
3652
- #line 128 "hpricot_scan.rl"
3653
- {
3736
+ #line 134 "hpricot_scan.rl"
3737
+ {
3738
+ if (!S->xml)
3739
+ akey = rb_funcall(akey, s_downcase, 0);
3654
3740
  ATTR(akey, aval);
3655
3741
  }
3656
3742
  #line 68 "hpricot_scan.rl"
@@ -3660,21 +3746,21 @@ st210:
3660
3746
  if ( ++p == pe )
3661
3747
  goto _test_eof210;
3662
3748
  case 210:
3663
- #line 3664 "hpricot_scan.c"
3749
+ #line 3750 "hpricot_scan.c"
3664
3750
  switch( (*p) ) {
3665
3751
  case 39: goto tr169;
3666
3752
  case 92: goto st102;
3667
3753
  }
3668
3754
  goto st101;
3669
3755
  tr242:
3670
- #line 114 "hpricot_scan.rl"
3756
+ #line 120 "hpricot_scan.rl"
3671
3757
  { SET(akey, p); }
3672
3758
  goto st106;
3673
3759
  st106:
3674
3760
  if ( ++p == pe )
3675
3761
  goto _test_eof106;
3676
3762
  case 106:
3677
- #line 3678 "hpricot_scan.c"
3763
+ #line 3764 "hpricot_scan.c"
3678
3764
  switch( (*p) ) {
3679
3765
  case 13: goto tr248;
3680
3766
  case 32: goto tr248;
@@ -3692,14 +3778,14 @@ case 106:
3692
3778
  goto tr248;
3693
3779
  goto tr247;
3694
3780
  tr247:
3695
- #line 105 "hpricot_scan.rl"
3781
+ #line 111 "hpricot_scan.rl"
3696
3782
  { mark_aval = p; }
3697
3783
  goto st107;
3698
3784
  st107:
3699
3785
  if ( ++p == pe )
3700
3786
  goto _test_eof107;
3701
3787
  case 107:
3702
- #line 3703 "hpricot_scan.c"
3788
+ #line 3789 "hpricot_scan.c"
3703
3789
  switch( (*p) ) {
3704
3790
  case 13: goto tr255;
3705
3791
  case 32: goto tr255;
@@ -3716,42 +3802,42 @@ case 107:
3716
3802
  goto tr255;
3717
3803
  goto st107;
3718
3804
  tr256:
3719
- #line 110 "hpricot_scan.rl"
3720
- {
3805
+ #line 116 "hpricot_scan.rl"
3806
+ {
3721
3807
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3722
3808
  else { SET(aval, p); }
3723
3809
  }
3724
3810
  goto st108;
3725
3811
  tr327:
3726
- #line 105 "hpricot_scan.rl"
3812
+ #line 111 "hpricot_scan.rl"
3727
3813
  { mark_aval = p; }
3728
- #line 110 "hpricot_scan.rl"
3729
- {
3814
+ #line 116 "hpricot_scan.rl"
3815
+ {
3730
3816
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3731
3817
  else { SET(aval, p); }
3732
3818
  }
3733
3819
  goto st108;
3734
3820
  tr281:
3735
- #line 105 "hpricot_scan.rl"
3821
+ #line 111 "hpricot_scan.rl"
3736
3822
  { mark_aval = p; }
3737
- #line 109 "hpricot_scan.rl"
3823
+ #line 115 "hpricot_scan.rl"
3738
3824
  { SET(aval, p); }
3739
3825
  goto st108;
3740
3826
  tr222:
3741
- #line 109 "hpricot_scan.rl"
3827
+ #line 115 "hpricot_scan.rl"
3742
3828
  { SET(aval, p); }
3743
3829
  goto st108;
3744
3830
  tr213:
3745
- #line 109 "hpricot_scan.rl"
3831
+ #line 115 "hpricot_scan.rl"
3746
3832
  { SET(aval, p); }
3747
- #line 105 "hpricot_scan.rl"
3833
+ #line 111 "hpricot_scan.rl"
3748
3834
  { mark_aval = p; }
3749
3835
  goto st108;
3750
3836
  st108:
3751
3837
  if ( ++p == pe )
3752
3838
  goto _test_eof108;
3753
3839
  case 108:
3754
- #line 3755 "hpricot_scan.c"
3840
+ #line 3841 "hpricot_scan.c"
3755
3841
  switch( (*p) ) {
3756
3842
  case 13: goto tr255;
3757
3843
  case 32: goto tr255;
@@ -3779,42 +3865,46 @@ case 108:
3779
3865
  goto tr260;
3780
3866
  goto st107;
3781
3867
  tr260:
3782
- #line 128 "hpricot_scan.rl"
3783
- {
3868
+ #line 134 "hpricot_scan.rl"
3869
+ {
3870
+ if (!S->xml)
3871
+ akey = rb_funcall(akey, s_downcase, 0);
3784
3872
  ATTR(akey, aval);
3785
3873
  }
3786
- #line 121 "hpricot_scan.rl"
3787
- {
3874
+ #line 127 "hpricot_scan.rl"
3875
+ {
3788
3876
  akey = Qnil;
3789
3877
  aval = Qnil;
3790
3878
  mark_akey = NULL;
3791
3879
  mark_aval = NULL;
3792
3880
  }
3793
- #line 106 "hpricot_scan.rl"
3881
+ #line 112 "hpricot_scan.rl"
3794
3882
  { mark_akey = p; }
3795
3883
  goto st109;
3796
3884
  tr279:
3797
- #line 105 "hpricot_scan.rl"
3885
+ #line 111 "hpricot_scan.rl"
3798
3886
  { mark_aval = p; }
3799
- #line 128 "hpricot_scan.rl"
3800
- {
3887
+ #line 134 "hpricot_scan.rl"
3888
+ {
3889
+ if (!S->xml)
3890
+ akey = rb_funcall(akey, s_downcase, 0);
3801
3891
  ATTR(akey, aval);
3802
3892
  }
3803
- #line 121 "hpricot_scan.rl"
3804
- {
3893
+ #line 127 "hpricot_scan.rl"
3894
+ {
3805
3895
  akey = Qnil;
3806
3896
  aval = Qnil;
3807
3897
  mark_akey = NULL;
3808
3898
  mark_aval = NULL;
3809
3899
  }
3810
- #line 106 "hpricot_scan.rl"
3900
+ #line 112 "hpricot_scan.rl"
3811
3901
  { mark_akey = p; }
3812
3902
  goto st109;
3813
3903
  st109:
3814
3904
  if ( ++p == pe )
3815
3905
  goto _test_eof109;
3816
3906
  case 109:
3817
- #line 3818 "hpricot_scan.c"
3907
+ #line 3908 "hpricot_scan.c"
3818
3908
  switch( (*p) ) {
3819
3909
  case 13: goto tr263;
3820
3910
  case 32: goto tr263;
@@ -3843,17 +3933,17 @@ case 109:
3843
3933
  goto st109;
3844
3934
  goto st107;
3845
3935
  tr270:
3846
- #line 110 "hpricot_scan.rl"
3847
- {
3936
+ #line 116 "hpricot_scan.rl"
3937
+ {
3848
3938
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3849
3939
  else { SET(aval, p); }
3850
3940
  }
3851
3941
  goto st110;
3852
3942
  tr264:
3853
- #line 114 "hpricot_scan.rl"
3943
+ #line 120 "hpricot_scan.rl"
3854
3944
  { SET(akey, p); }
3855
- #line 110 "hpricot_scan.rl"
3856
- {
3945
+ #line 116 "hpricot_scan.rl"
3946
+ {
3857
3947
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3858
3948
  else { SET(aval, p); }
3859
3949
  }
@@ -3862,7 +3952,7 @@ st110:
3862
3952
  if ( ++p == pe )
3863
3953
  goto _test_eof110;
3864
3954
  case 110:
3865
- #line 3866 "hpricot_scan.c"
3955
+ #line 3956 "hpricot_scan.c"
3866
3956
  switch( (*p) ) {
3867
3957
  case 13: goto tr269;
3868
3958
  case 32: goto tr269;
@@ -3891,70 +3981,82 @@ case 110:
3891
3981
  goto tr260;
3892
3982
  goto st107;
3893
3983
  tr252:
3894
- #line 105 "hpricot_scan.rl"
3984
+ #line 111 "hpricot_scan.rl"
3895
3985
  { mark_aval = p; }
3896
- #line 128 "hpricot_scan.rl"
3897
- {
3986
+ #line 134 "hpricot_scan.rl"
3987
+ {
3988
+ if (!S->xml)
3989
+ akey = rb_funcall(akey, s_downcase, 0);
3898
3990
  ATTR(akey, aval);
3899
3991
  }
3900
3992
  goto st111;
3901
3993
  tr257:
3902
- #line 110 "hpricot_scan.rl"
3903
- {
3994
+ #line 116 "hpricot_scan.rl"
3995
+ {
3904
3996
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3905
3997
  else { SET(aval, p); }
3906
3998
  }
3907
- #line 128 "hpricot_scan.rl"
3908
- {
3999
+ #line 134 "hpricot_scan.rl"
4000
+ {
4001
+ if (!S->xml)
4002
+ akey = rb_funcall(akey, s_downcase, 0);
3909
4003
  ATTR(akey, aval);
3910
4004
  }
3911
4005
  goto st111;
3912
4006
  tr261:
3913
- #line 128 "hpricot_scan.rl"
3914
- {
4007
+ #line 134 "hpricot_scan.rl"
4008
+ {
4009
+ if (!S->xml)
4010
+ akey = rb_funcall(akey, s_downcase, 0);
3915
4011
  ATTR(akey, aval);
3916
4012
  }
3917
- #line 110 "hpricot_scan.rl"
3918
- {
4013
+ #line 116 "hpricot_scan.rl"
4014
+ {
3919
4015
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3920
4016
  else { SET(aval, p); }
3921
4017
  }
3922
4018
  goto st111;
3923
4019
  tr266:
3924
- #line 110 "hpricot_scan.rl"
3925
- {
4020
+ #line 116 "hpricot_scan.rl"
4021
+ {
3926
4022
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3927
4023
  else { SET(aval, p); }
3928
4024
  }
3929
- #line 114 "hpricot_scan.rl"
4025
+ #line 120 "hpricot_scan.rl"
3930
4026
  { SET(akey, p); }
3931
- #line 128 "hpricot_scan.rl"
3932
- {
4027
+ #line 134 "hpricot_scan.rl"
4028
+ {
4029
+ if (!S->xml)
4030
+ akey = rb_funcall(akey, s_downcase, 0);
3933
4031
  ATTR(akey, aval);
3934
4032
  }
3935
4033
  goto st111;
3936
4034
  tr276:
3937
- #line 105 "hpricot_scan.rl"
4035
+ #line 111 "hpricot_scan.rl"
3938
4036
  { mark_aval = p; }
3939
- #line 110 "hpricot_scan.rl"
3940
- {
4037
+ #line 116 "hpricot_scan.rl"
4038
+ {
3941
4039
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3942
4040
  else { SET(aval, p); }
3943
4041
  }
3944
- #line 128 "hpricot_scan.rl"
3945
- {
4042
+ #line 134 "hpricot_scan.rl"
4043
+ {
4044
+ if (!S->xml)
4045
+ akey = rb_funcall(akey, s_downcase, 0);
3946
4046
  ATTR(akey, aval);
3947
4047
  }
3948
4048
  goto st111;
3949
4049
  tr280:
3950
- #line 105 "hpricot_scan.rl"
4050
+ #line 111 "hpricot_scan.rl"
3951
4051
  { mark_aval = p; }
3952
- #line 128 "hpricot_scan.rl"
3953
- {
4052
+ #line 134 "hpricot_scan.rl"
4053
+ {
4054
+ if (!S->xml)
4055
+ akey = rb_funcall(akey, s_downcase, 0);
3954
4056
  ATTR(akey, aval);
3955
4057
  }
3956
- #line 110 "hpricot_scan.rl"
3957
- {
4058
+ #line 116 "hpricot_scan.rl"
4059
+ {
3958
4060
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3959
4061
  else { SET(aval, p); }
3960
4062
  }
@@ -3963,7 +4065,7 @@ st111:
3963
4065
  if ( ++p == pe )
3964
4066
  goto _test_eof111;
3965
4067
  case 111:
3966
- #line 3967 "hpricot_scan.c"
4068
+ #line 4069 "hpricot_scan.c"
3967
4069
  switch( (*p) ) {
3968
4070
  case 13: goto tr255;
3969
4071
  case 32: goto tr255;
@@ -3980,14 +4082,14 @@ case 111:
3980
4082
  goto tr255;
3981
4083
  goto st107;
3982
4084
  tr253:
3983
- #line 105 "hpricot_scan.rl"
4085
+ #line 111 "hpricot_scan.rl"
3984
4086
  { mark_aval = p; }
3985
4087
  goto st112;
3986
4088
  st112:
3987
4089
  if ( ++p == pe )
3988
4090
  goto _test_eof112;
3989
4091
  case 112:
3990
- #line 3991 "hpricot_scan.c"
4092
+ #line 4093 "hpricot_scan.c"
3991
4093
  switch( (*p) ) {
3992
4094
  case 13: goto tr255;
3993
4095
  case 32: goto tr255;
@@ -4004,18 +4106,18 @@ case 112:
4004
4106
  goto tr255;
4005
4107
  goto st107;
4006
4108
  tr249:
4007
- #line 105 "hpricot_scan.rl"
4109
+ #line 111 "hpricot_scan.rl"
4008
4110
  { mark_aval = p; }
4009
4111
  goto st113;
4010
4112
  tr267:
4011
- #line 114 "hpricot_scan.rl"
4113
+ #line 120 "hpricot_scan.rl"
4012
4114
  { SET(akey, p); }
4013
4115
  goto st113;
4014
4116
  st113:
4015
4117
  if ( ++p == pe )
4016
4118
  goto _test_eof113;
4017
4119
  case 113:
4018
- #line 4019 "hpricot_scan.c"
4120
+ #line 4121 "hpricot_scan.c"
4019
4121
  switch( (*p) ) {
4020
4122
  case 13: goto tr272;
4021
4123
  case 32: goto tr272;
@@ -4033,14 +4135,14 @@ case 113:
4033
4135
  goto tr272;
4034
4136
  goto tr247;
4035
4137
  tr277:
4036
- #line 105 "hpricot_scan.rl"
4138
+ #line 111 "hpricot_scan.rl"
4037
4139
  { mark_aval = p; }
4038
4140
  goto st114;
4039
4141
  tr272:
4040
- #line 105 "hpricot_scan.rl"
4142
+ #line 111 "hpricot_scan.rl"
4041
4143
  { mark_aval = p; }
4042
- #line 110 "hpricot_scan.rl"
4043
- {
4144
+ #line 116 "hpricot_scan.rl"
4145
+ {
4044
4146
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4045
4147
  else { SET(aval, p); }
4046
4148
  }
@@ -4049,7 +4151,7 @@ st114:
4049
4151
  if ( ++p == pe )
4050
4152
  goto _test_eof114;
4051
4153
  case 114:
4052
- #line 4053 "hpricot_scan.c"
4154
+ #line 4155 "hpricot_scan.c"
4053
4155
  switch( (*p) ) {
4054
4156
  case 13: goto tr277;
4055
4157
  case 32: goto tr277;
@@ -4078,14 +4180,14 @@ case 114:
4078
4180
  goto tr279;
4079
4181
  goto tr247;
4080
4182
  tr278:
4081
- #line 105 "hpricot_scan.rl"
4183
+ #line 111 "hpricot_scan.rl"
4082
4184
  { mark_aval = p; }
4083
4185
  goto st115;
4084
4186
  tr273:
4085
- #line 105 "hpricot_scan.rl"
4187
+ #line 111 "hpricot_scan.rl"
4086
4188
  { mark_aval = p; }
4087
- #line 110 "hpricot_scan.rl"
4088
- {
4189
+ #line 116 "hpricot_scan.rl"
4190
+ {
4089
4191
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4090
4192
  else { SET(aval, p); }
4091
4193
  }
@@ -4094,7 +4196,7 @@ st115:
4094
4196
  if ( ++p == pe )
4095
4197
  goto _test_eof115;
4096
4198
  case 115:
4097
- #line 4098 "hpricot_scan.c"
4199
+ #line 4200 "hpricot_scan.c"
4098
4200
  switch( (*p) ) {
4099
4201
  case 13: goto tr272;
4100
4202
  case 32: goto tr272;
@@ -4143,30 +4245,30 @@ case 116:
4143
4245
  goto tr211;
4144
4246
  goto tr210;
4145
4247
  tr221:
4146
- #line 110 "hpricot_scan.rl"
4147
- {
4248
+ #line 116 "hpricot_scan.rl"
4249
+ {
4148
4250
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4149
4251
  else { SET(aval, p); }
4150
4252
  }
4151
4253
  goto st117;
4152
4254
  tr212:
4153
- #line 105 "hpricot_scan.rl"
4255
+ #line 111 "hpricot_scan.rl"
4154
4256
  { mark_aval = p; }
4155
- #line 110 "hpricot_scan.rl"
4156
- {
4257
+ #line 116 "hpricot_scan.rl"
4258
+ {
4157
4259
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4158
4260
  else { SET(aval, p); }
4159
4261
  }
4160
4262
  goto st117;
4161
4263
  tr314:
4162
- #line 109 "hpricot_scan.rl"
4264
+ #line 115 "hpricot_scan.rl"
4163
4265
  { SET(aval, p); }
4164
4266
  goto st117;
4165
4267
  st117:
4166
4268
  if ( ++p == pe )
4167
4269
  goto _test_eof117;
4168
4270
  case 117:
4169
- #line 4170 "hpricot_scan.c"
4271
+ #line 4272 "hpricot_scan.c"
4170
4272
  switch( (*p) ) {
4171
4273
  case 13: goto tr220;
4172
4274
  case 32: goto tr220;
@@ -4195,42 +4297,46 @@ case 117:
4195
4297
  goto tr282;
4196
4298
  goto st97;
4197
4299
  tr282:
4198
- #line 128 "hpricot_scan.rl"
4199
- {
4300
+ #line 134 "hpricot_scan.rl"
4301
+ {
4302
+ if (!S->xml)
4303
+ akey = rb_funcall(akey, s_downcase, 0);
4200
4304
  ATTR(akey, aval);
4201
4305
  }
4202
- #line 121 "hpricot_scan.rl"
4203
- {
4306
+ #line 127 "hpricot_scan.rl"
4307
+ {
4204
4308
  akey = Qnil;
4205
4309
  aval = Qnil;
4206
4310
  mark_akey = NULL;
4207
4311
  mark_aval = NULL;
4208
4312
  }
4209
- #line 106 "hpricot_scan.rl"
4313
+ #line 112 "hpricot_scan.rl"
4210
4314
  { mark_akey = p; }
4211
4315
  goto st118;
4212
4316
  tr307:
4213
- #line 105 "hpricot_scan.rl"
4317
+ #line 111 "hpricot_scan.rl"
4214
4318
  { mark_aval = p; }
4215
- #line 128 "hpricot_scan.rl"
4216
- {
4319
+ #line 134 "hpricot_scan.rl"
4320
+ {
4321
+ if (!S->xml)
4322
+ akey = rb_funcall(akey, s_downcase, 0);
4217
4323
  ATTR(akey, aval);
4218
4324
  }
4219
- #line 121 "hpricot_scan.rl"
4220
- {
4325
+ #line 127 "hpricot_scan.rl"
4326
+ {
4221
4327
  akey = Qnil;
4222
4328
  aval = Qnil;
4223
4329
  mark_akey = NULL;
4224
4330
  mark_aval = NULL;
4225
4331
  }
4226
- #line 106 "hpricot_scan.rl"
4332
+ #line 112 "hpricot_scan.rl"
4227
4333
  { mark_akey = p; }
4228
4334
  goto st118;
4229
4335
  st118:
4230
4336
  if ( ++p == pe )
4231
4337
  goto _test_eof118;
4232
4338
  case 118:
4233
- #line 4234 "hpricot_scan.c"
4339
+ #line 4340 "hpricot_scan.c"
4234
4340
  switch( (*p) ) {
4235
4341
  case 13: goto tr285;
4236
4342
  case 32: goto tr285;
@@ -4260,21 +4366,21 @@ case 118:
4260
4366
  goto st118;
4261
4367
  goto st97;
4262
4368
  tr293:
4263
- #line 114 "hpricot_scan.rl"
4369
+ #line 120 "hpricot_scan.rl"
4264
4370
  { SET(akey, p); }
4265
4371
  goto st119;
4266
4372
  tr323:
4267
- #line 110 "hpricot_scan.rl"
4268
- {
4373
+ #line 116 "hpricot_scan.rl"
4374
+ {
4269
4375
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4270
4376
  else { SET(aval, p); }
4271
4377
  }
4272
4378
  goto st119;
4273
4379
  tr285:
4274
- #line 114 "hpricot_scan.rl"
4380
+ #line 120 "hpricot_scan.rl"
4275
4381
  { SET(akey, p); }
4276
- #line 110 "hpricot_scan.rl"
4277
- {
4382
+ #line 116 "hpricot_scan.rl"
4383
+ {
4278
4384
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4279
4385
  else { SET(aval, p); }
4280
4386
  }
@@ -4283,7 +4389,7 @@ st119:
4283
4389
  if ( ++p == pe )
4284
4390
  goto _test_eof119;
4285
4391
  case 119:
4286
- #line 4287 "hpricot_scan.c"
4392
+ #line 4393 "hpricot_scan.c"
4287
4393
  switch( (*p) ) {
4288
4394
  case 32: goto st119;
4289
4395
  case 34: goto tr228;
@@ -4308,42 +4414,46 @@ case 119:
4308
4414
  goto tr229;
4309
4415
  goto st99;
4310
4416
  tr229:
4311
- #line 128 "hpricot_scan.rl"
4312
- {
4417
+ #line 134 "hpricot_scan.rl"
4418
+ {
4419
+ if (!S->xml)
4420
+ akey = rb_funcall(akey, s_downcase, 0);
4313
4421
  ATTR(akey, aval);
4314
4422
  }
4315
- #line 121 "hpricot_scan.rl"
4316
- {
4423
+ #line 127 "hpricot_scan.rl"
4424
+ {
4317
4425
  akey = Qnil;
4318
4426
  aval = Qnil;
4319
4427
  mark_akey = NULL;
4320
4428
  mark_aval = NULL;
4321
4429
  }
4322
- #line 106 "hpricot_scan.rl"
4430
+ #line 112 "hpricot_scan.rl"
4323
4431
  { mark_akey = p; }
4324
4432
  goto st120;
4325
4433
  tr318:
4326
- #line 105 "hpricot_scan.rl"
4434
+ #line 111 "hpricot_scan.rl"
4327
4435
  { mark_aval = p; }
4328
- #line 128 "hpricot_scan.rl"
4329
- {
4436
+ #line 134 "hpricot_scan.rl"
4437
+ {
4438
+ if (!S->xml)
4439
+ akey = rb_funcall(akey, s_downcase, 0);
4330
4440
  ATTR(akey, aval);
4331
4441
  }
4332
- #line 121 "hpricot_scan.rl"
4333
- {
4442
+ #line 127 "hpricot_scan.rl"
4443
+ {
4334
4444
  akey = Qnil;
4335
4445
  aval = Qnil;
4336
4446
  mark_akey = NULL;
4337
4447
  mark_aval = NULL;
4338
4448
  }
4339
- #line 106 "hpricot_scan.rl"
4449
+ #line 112 "hpricot_scan.rl"
4340
4450
  { mark_akey = p; }
4341
4451
  goto st120;
4342
4452
  st120:
4343
4453
  if ( ++p == pe )
4344
4454
  goto _test_eof120;
4345
4455
  case 120:
4346
- #line 4347 "hpricot_scan.c"
4456
+ #line 4457 "hpricot_scan.c"
4347
4457
  switch( (*p) ) {
4348
4458
  case 32: goto tr293;
4349
4459
  case 34: goto tr228;
@@ -4368,24 +4478,30 @@ case 120:
4368
4478
  goto st120;
4369
4479
  goto st99;
4370
4480
  tr295:
4371
- #line 114 "hpricot_scan.rl"
4481
+ #line 120 "hpricot_scan.rl"
4372
4482
  { SET(akey, p); }
4373
- #line 128 "hpricot_scan.rl"
4374
- {
4483
+ #line 134 "hpricot_scan.rl"
4484
+ {
4485
+ if (!S->xml)
4486
+ akey = rb_funcall(akey, s_downcase, 0);
4375
4487
  ATTR(akey, aval);
4376
4488
  }
4377
4489
  goto st121;
4378
4490
  tr230:
4379
- #line 128 "hpricot_scan.rl"
4380
- {
4491
+ #line 134 "hpricot_scan.rl"
4492
+ {
4493
+ if (!S->xml)
4494
+ akey = rb_funcall(akey, s_downcase, 0);
4381
4495
  ATTR(akey, aval);
4382
4496
  }
4383
4497
  goto st121;
4384
4498
  tr319:
4385
- #line 105 "hpricot_scan.rl"
4499
+ #line 111 "hpricot_scan.rl"
4386
4500
  { mark_aval = p; }
4387
- #line 128 "hpricot_scan.rl"
4388
- {
4501
+ #line 134 "hpricot_scan.rl"
4502
+ {
4503
+ if (!S->xml)
4504
+ akey = rb_funcall(akey, s_downcase, 0);
4389
4505
  ATTR(akey, aval);
4390
4506
  }
4391
4507
  goto st121;
@@ -4393,7 +4509,7 @@ st121:
4393
4509
  if ( ++p == pe )
4394
4510
  goto _test_eof121;
4395
4511
  case 121:
4396
- #line 4397 "hpricot_scan.c"
4512
+ #line 4513 "hpricot_scan.c"
4397
4513
  switch( (*p) ) {
4398
4514
  case 34: goto tr228;
4399
4515
  case 39: goto tr174;
@@ -4404,15 +4520,17 @@ case 121:
4404
4520
  tr217:
4405
4521
  #line 1 "hpricot_scan.rl"
4406
4522
  {te = p+1;}
4407
- #line 105 "hpricot_scan.rl"
4523
+ #line 111 "hpricot_scan.rl"
4408
4524
  { mark_aval = p; }
4409
- #line 110 "hpricot_scan.rl"
4410
- {
4525
+ #line 116 "hpricot_scan.rl"
4526
+ {
4411
4527
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4412
4528
  else { SET(aval, p); }
4413
4529
  }
4414
- #line 128 "hpricot_scan.rl"
4415
- {
4530
+ #line 134 "hpricot_scan.rl"
4531
+ {
4532
+ if (!S->xml)
4533
+ akey = rb_funcall(akey, s_downcase, 0);
4416
4534
  ATTR(akey, aval);
4417
4535
  }
4418
4536
  #line 68 "hpricot_scan.rl"
@@ -4421,13 +4539,15 @@ tr217:
4421
4539
  tr225:
4422
4540
  #line 1 "hpricot_scan.rl"
4423
4541
  {te = p+1;}
4424
- #line 110 "hpricot_scan.rl"
4425
- {
4542
+ #line 116 "hpricot_scan.rl"
4543
+ {
4426
4544
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4427
4545
  else { SET(aval, p); }
4428
4546
  }
4429
- #line 128 "hpricot_scan.rl"
4430
- {
4547
+ #line 134 "hpricot_scan.rl"
4548
+ {
4549
+ if (!S->xml)
4550
+ akey = rb_funcall(akey, s_downcase, 0);
4431
4551
  ATTR(akey, aval);
4432
4552
  }
4433
4553
  #line 68 "hpricot_scan.rl"
@@ -4436,8 +4556,10 @@ tr225:
4436
4556
  tr231:
4437
4557
  #line 1 "hpricot_scan.rl"
4438
4558
  {te = p+1;}
4439
- #line 128 "hpricot_scan.rl"
4440
- {
4559
+ #line 134 "hpricot_scan.rl"
4560
+ {
4561
+ if (!S->xml)
4562
+ akey = rb_funcall(akey, s_downcase, 0);
4441
4563
  ATTR(akey, aval);
4442
4564
  }
4443
4565
  #line 68 "hpricot_scan.rl"
@@ -4446,10 +4568,12 @@ tr231:
4446
4568
  tr297:
4447
4569
  #line 1 "hpricot_scan.rl"
4448
4570
  {te = p+1;}
4449
- #line 114 "hpricot_scan.rl"
4571
+ #line 120 "hpricot_scan.rl"
4450
4572
  { SET(akey, p); }
4451
- #line 128 "hpricot_scan.rl"
4452
- {
4573
+ #line 134 "hpricot_scan.rl"
4574
+ {
4575
+ if (!S->xml)
4576
+ akey = rb_funcall(akey, s_downcase, 0);
4453
4577
  ATTR(akey, aval);
4454
4578
  }
4455
4579
  #line 68 "hpricot_scan.rl"
@@ -4464,12 +4588,14 @@ tr298:
4464
4588
  tr284:
4465
4589
  #line 1 "hpricot_scan.rl"
4466
4590
  {te = p+1;}
4467
- #line 128 "hpricot_scan.rl"
4468
- {
4591
+ #line 134 "hpricot_scan.rl"
4592
+ {
4593
+ if (!S->xml)
4594
+ akey = rb_funcall(akey, s_downcase, 0);
4469
4595
  ATTR(akey, aval);
4470
4596
  }
4471
- #line 110 "hpricot_scan.rl"
4472
- {
4597
+ #line 116 "hpricot_scan.rl"
4598
+ {
4473
4599
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4474
4600
  else { SET(aval, p); }
4475
4601
  }
@@ -4479,14 +4605,16 @@ tr284:
4479
4605
  tr313:
4480
4606
  #line 1 "hpricot_scan.rl"
4481
4607
  {te = p+1;}
4482
- #line 105 "hpricot_scan.rl"
4608
+ #line 111 "hpricot_scan.rl"
4483
4609
  { mark_aval = p; }
4484
- #line 128 "hpricot_scan.rl"
4485
- {
4610
+ #line 134 "hpricot_scan.rl"
4611
+ {
4612
+ if (!S->xml)
4613
+ akey = rb_funcall(akey, s_downcase, 0);
4486
4614
  ATTR(akey, aval);
4487
4615
  }
4488
- #line 110 "hpricot_scan.rl"
4489
- {
4616
+ #line 116 "hpricot_scan.rl"
4617
+ {
4490
4618
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4491
4619
  else { SET(aval, p); }
4492
4620
  }
@@ -4496,15 +4624,17 @@ tr313:
4496
4624
  tr290:
4497
4625
  #line 1 "hpricot_scan.rl"
4498
4626
  {te = p+1;}
4499
- #line 110 "hpricot_scan.rl"
4500
- {
4627
+ #line 116 "hpricot_scan.rl"
4628
+ {
4501
4629
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4502
4630
  else { SET(aval, p); }
4503
4631
  }
4504
- #line 114 "hpricot_scan.rl"
4632
+ #line 120 "hpricot_scan.rl"
4505
4633
  { SET(akey, p); }
4506
- #line 128 "hpricot_scan.rl"
4507
- {
4634
+ #line 134 "hpricot_scan.rl"
4635
+ {
4636
+ if (!S->xml)
4637
+ akey = rb_funcall(akey, s_downcase, 0);
4508
4638
  ATTR(akey, aval);
4509
4639
  }
4510
4640
  #line 68 "hpricot_scan.rl"
@@ -4513,10 +4643,12 @@ tr290:
4513
4643
  tr320:
4514
4644
  #line 1 "hpricot_scan.rl"
4515
4645
  {te = p+1;}
4516
- #line 105 "hpricot_scan.rl"
4646
+ #line 111 "hpricot_scan.rl"
4517
4647
  { mark_aval = p; }
4518
- #line 128 "hpricot_scan.rl"
4519
- {
4648
+ #line 134 "hpricot_scan.rl"
4649
+ {
4650
+ if (!S->xml)
4651
+ akey = rb_funcall(akey, s_downcase, 0);
4520
4652
  ATTR(akey, aval);
4521
4653
  }
4522
4654
  #line 68 "hpricot_scan.rl"
@@ -4526,7 +4658,7 @@ st211:
4526
4658
  if ( ++p == pe )
4527
4659
  goto _test_eof211;
4528
4660
  case 211:
4529
- #line 4530 "hpricot_scan.c"
4661
+ #line 4662 "hpricot_scan.c"
4530
4662
  switch( (*p) ) {
4531
4663
  case 34: goto tr228;
4532
4664
  case 39: goto tr174;
@@ -4534,14 +4666,14 @@ case 211:
4534
4666
  }
4535
4667
  goto st99;
4536
4668
  tr321:
4537
- #line 105 "hpricot_scan.rl"
4669
+ #line 111 "hpricot_scan.rl"
4538
4670
  { mark_aval = p; }
4539
4671
  goto st122;
4540
4672
  st122:
4541
4673
  if ( ++p == pe )
4542
4674
  goto _test_eof122;
4543
4675
  case 122:
4544
- #line 4545 "hpricot_scan.c"
4676
+ #line 4677 "hpricot_scan.c"
4545
4677
  switch( (*p) ) {
4546
4678
  case 34: goto tr299;
4547
4679
  case 39: goto tr299;
@@ -4549,14 +4681,14 @@ case 122:
4549
4681
  }
4550
4682
  goto st99;
4551
4683
  tr296:
4552
- #line 114 "hpricot_scan.rl"
4684
+ #line 120 "hpricot_scan.rl"
4553
4685
  { SET(akey, p); }
4554
4686
  goto st123;
4555
4687
  st123:
4556
4688
  if ( ++p == pe )
4557
4689
  goto _test_eof123;
4558
4690
  case 123:
4559
- #line 4560 "hpricot_scan.c"
4691
+ #line 4692 "hpricot_scan.c"
4560
4692
  switch( (*p) ) {
4561
4693
  case 13: goto tr300;
4562
4694
  case 32: goto tr300;
@@ -4574,14 +4706,14 @@ case 123:
4574
4706
  goto tr300;
4575
4707
  goto tr210;
4576
4708
  tr300:
4577
- #line 105 "hpricot_scan.rl"
4709
+ #line 111 "hpricot_scan.rl"
4578
4710
  { mark_aval = p; }
4579
4711
  goto st124;
4580
4712
  st124:
4581
4713
  if ( ++p == pe )
4582
4714
  goto _test_eof124;
4583
4715
  case 124:
4584
- #line 4585 "hpricot_scan.c"
4716
+ #line 4717 "hpricot_scan.c"
4585
4717
  switch( (*p) ) {
4586
4718
  case 13: goto tr305;
4587
4719
  case 32: goto tr305;
@@ -4599,14 +4731,14 @@ case 124:
4599
4731
  goto tr305;
4600
4732
  goto tr210;
4601
4733
  tr305:
4602
- #line 105 "hpricot_scan.rl"
4734
+ #line 111 "hpricot_scan.rl"
4603
4735
  { mark_aval = p; }
4604
4736
  goto st125;
4605
4737
  tr308:
4606
- #line 105 "hpricot_scan.rl"
4738
+ #line 111 "hpricot_scan.rl"
4607
4739
  { mark_aval = p; }
4608
- #line 110 "hpricot_scan.rl"
4609
- {
4740
+ #line 116 "hpricot_scan.rl"
4741
+ {
4610
4742
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4611
4743
  else { SET(aval, p); }
4612
4744
  }
@@ -4615,7 +4747,7 @@ st125:
4615
4747
  if ( ++p == pe )
4616
4748
  goto _test_eof125;
4617
4749
  case 125:
4618
- #line 4619 "hpricot_scan.c"
4750
+ #line 4751 "hpricot_scan.c"
4619
4751
  switch( (*p) ) {
4620
4752
  case 13: goto tr305;
4621
4753
  case 32: goto tr305;
@@ -4644,14 +4776,14 @@ case 125:
4644
4776
  goto tr307;
4645
4777
  goto tr210;
4646
4778
  tr306:
4647
- #line 105 "hpricot_scan.rl"
4779
+ #line 111 "hpricot_scan.rl"
4648
4780
  { mark_aval = p; }
4649
4781
  goto st126;
4650
4782
  tr309:
4651
- #line 105 "hpricot_scan.rl"
4783
+ #line 111 "hpricot_scan.rl"
4652
4784
  { mark_aval = p; }
4653
- #line 110 "hpricot_scan.rl"
4654
- {
4785
+ #line 116 "hpricot_scan.rl"
4786
+ {
4655
4787
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4656
4788
  else { SET(aval, p); }
4657
4789
  }
@@ -4660,7 +4792,7 @@ st126:
4660
4792
  if ( ++p == pe )
4661
4793
  goto _test_eof126;
4662
4794
  case 126:
4663
- #line 4664 "hpricot_scan.c"
4795
+ #line 4796 "hpricot_scan.c"
4664
4796
  switch( (*p) ) {
4665
4797
  case 13: goto tr308;
4666
4798
  case 32: goto tr308;
@@ -4689,14 +4821,14 @@ case 126:
4689
4821
  goto tr307;
4690
4822
  goto tr210;
4691
4823
  tr310:
4692
- #line 109 "hpricot_scan.rl"
4824
+ #line 115 "hpricot_scan.rl"
4693
4825
  { SET(aval, p); }
4694
4826
  goto st127;
4695
4827
  st127:
4696
4828
  if ( ++p == pe )
4697
4829
  goto _test_eof127;
4698
4830
  case 127:
4699
- #line 4700 "hpricot_scan.c"
4831
+ #line 4832 "hpricot_scan.c"
4700
4832
  switch( (*p) ) {
4701
4833
  case 13: goto tr211;
4702
4834
  case 32: goto tr211;
@@ -4725,70 +4857,82 @@ case 127:
4725
4857
  goto tr307;
4726
4858
  goto tr210;
4727
4859
  tr304:
4728
- #line 105 "hpricot_scan.rl"
4860
+ #line 111 "hpricot_scan.rl"
4729
4861
  { mark_aval = p; }
4730
- #line 128 "hpricot_scan.rl"
4731
- {
4862
+ #line 134 "hpricot_scan.rl"
4863
+ {
4864
+ if (!S->xml)
4865
+ akey = rb_funcall(akey, s_downcase, 0);
4732
4866
  ATTR(akey, aval);
4733
4867
  }
4734
4868
  goto st128;
4735
4869
  tr223:
4736
- #line 110 "hpricot_scan.rl"
4737
- {
4870
+ #line 116 "hpricot_scan.rl"
4871
+ {
4738
4872
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4739
4873
  else { SET(aval, p); }
4740
4874
  }
4741
- #line 128 "hpricot_scan.rl"
4742
- {
4875
+ #line 134 "hpricot_scan.rl"
4876
+ {
4877
+ if (!S->xml)
4878
+ akey = rb_funcall(akey, s_downcase, 0);
4743
4879
  ATTR(akey, aval);
4744
4880
  }
4745
4881
  goto st128;
4746
4882
  tr283:
4747
- #line 128 "hpricot_scan.rl"
4748
- {
4883
+ #line 134 "hpricot_scan.rl"
4884
+ {
4885
+ if (!S->xml)
4886
+ akey = rb_funcall(akey, s_downcase, 0);
4749
4887
  ATTR(akey, aval);
4750
4888
  }
4751
- #line 110 "hpricot_scan.rl"
4752
- {
4889
+ #line 116 "hpricot_scan.rl"
4890
+ {
4753
4891
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4754
4892
  else { SET(aval, p); }
4755
4893
  }
4756
4894
  goto st128;
4757
4895
  tr288:
4758
- #line 110 "hpricot_scan.rl"
4759
- {
4896
+ #line 116 "hpricot_scan.rl"
4897
+ {
4760
4898
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4761
4899
  else { SET(aval, p); }
4762
4900
  }
4763
- #line 114 "hpricot_scan.rl"
4901
+ #line 120 "hpricot_scan.rl"
4764
4902
  { SET(akey, p); }
4765
- #line 128 "hpricot_scan.rl"
4766
- {
4903
+ #line 134 "hpricot_scan.rl"
4904
+ {
4905
+ if (!S->xml)
4906
+ akey = rb_funcall(akey, s_downcase, 0);
4767
4907
  ATTR(akey, aval);
4768
4908
  }
4769
4909
  goto st128;
4770
4910
  tr215:
4771
- #line 105 "hpricot_scan.rl"
4911
+ #line 111 "hpricot_scan.rl"
4772
4912
  { mark_aval = p; }
4773
- #line 110 "hpricot_scan.rl"
4774
- {
4913
+ #line 116 "hpricot_scan.rl"
4914
+ {
4775
4915
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4776
4916
  else { SET(aval, p); }
4777
4917
  }
4778
- #line 128 "hpricot_scan.rl"
4779
- {
4918
+ #line 134 "hpricot_scan.rl"
4919
+ {
4920
+ if (!S->xml)
4921
+ akey = rb_funcall(akey, s_downcase, 0);
4780
4922
  ATTR(akey, aval);
4781
4923
  }
4782
4924
  goto st128;
4783
4925
  tr312:
4784
- #line 105 "hpricot_scan.rl"
4926
+ #line 111 "hpricot_scan.rl"
4785
4927
  { mark_aval = p; }
4786
- #line 128 "hpricot_scan.rl"
4787
- {
4928
+ #line 134 "hpricot_scan.rl"
4929
+ {
4930
+ if (!S->xml)
4931
+ akey = rb_funcall(akey, s_downcase, 0);
4788
4932
  ATTR(akey, aval);
4789
4933
  }
4790
- #line 110 "hpricot_scan.rl"
4791
- {
4934
+ #line 116 "hpricot_scan.rl"
4935
+ {
4792
4936
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4793
4937
  else { SET(aval, p); }
4794
4938
  }
@@ -4797,7 +4941,7 @@ st128:
4797
4941
  if ( ++p == pe )
4798
4942
  goto _test_eof128;
4799
4943
  case 128:
4800
- #line 4801 "hpricot_scan.c"
4944
+ #line 4945 "hpricot_scan.c"
4801
4945
  switch( (*p) ) {
4802
4946
  case 13: goto tr220;
4803
4947
  case 32: goto tr220;
@@ -4815,14 +4959,14 @@ case 128:
4815
4959
  goto tr220;
4816
4960
  goto st97;
4817
4961
  tr218:
4818
- #line 105 "hpricot_scan.rl"
4962
+ #line 111 "hpricot_scan.rl"
4819
4963
  { mark_aval = p; }
4820
4964
  goto st129;
4821
4965
  st129:
4822
4966
  if ( ++p == pe )
4823
4967
  goto _test_eof129;
4824
4968
  case 129:
4825
- #line 4826 "hpricot_scan.c"
4969
+ #line 4970 "hpricot_scan.c"
4826
4970
  switch( (*p) ) {
4827
4971
  case 13: goto tr220;
4828
4972
  case 32: goto tr220;
@@ -4840,14 +4984,14 @@ case 129:
4840
4984
  goto tr220;
4841
4985
  goto st97;
4842
4986
  tr311:
4843
- #line 109 "hpricot_scan.rl"
4987
+ #line 115 "hpricot_scan.rl"
4844
4988
  { SET(aval, p); }
4845
4989
  goto st130;
4846
4990
  st130:
4847
4991
  if ( ++p == pe )
4848
4992
  goto _test_eof130;
4849
4993
  case 130:
4850
- #line 4851 "hpricot_scan.c"
4994
+ #line 4995 "hpricot_scan.c"
4851
4995
  switch( (*p) ) {
4852
4996
  case 13: goto tr211;
4853
4997
  case 32: goto tr211;
@@ -4876,14 +5020,14 @@ case 130:
4876
5020
  goto tr307;
4877
5021
  goto tr210;
4878
5022
  tr302:
4879
- #line 109 "hpricot_scan.rl"
5023
+ #line 115 "hpricot_scan.rl"
4880
5024
  { SET(aval, p); }
4881
5025
  goto st131;
4882
5026
  st131:
4883
5027
  if ( ++p == pe )
4884
5028
  goto _test_eof131;
4885
5029
  case 131:
4886
- #line 4887 "hpricot_scan.c"
5030
+ #line 5031 "hpricot_scan.c"
4887
5031
  switch( (*p) ) {
4888
5032
  case 32: goto tr315;
4889
5033
  case 34: goto tr316;
@@ -4907,14 +5051,14 @@ case 131:
4907
5051
  goto tr318;
4908
5052
  goto tr216;
4909
5053
  tr303:
4910
- #line 109 "hpricot_scan.rl"
5054
+ #line 115 "hpricot_scan.rl"
4911
5055
  { SET(aval, p); }
4912
5056
  goto st132;
4913
5057
  st132:
4914
5058
  if ( ++p == pe )
4915
5059
  goto _test_eof132;
4916
5060
  case 132:
4917
- #line 4918 "hpricot_scan.c"
5061
+ #line 5062 "hpricot_scan.c"
4918
5062
  switch( (*p) ) {
4919
5063
  case 32: goto tr315;
4920
5064
  case 34: goto tr322;
@@ -4938,18 +5082,18 @@ case 132:
4938
5082
  goto tr318;
4939
5083
  goto tr216;
4940
5084
  tr301:
4941
- #line 105 "hpricot_scan.rl"
5085
+ #line 111 "hpricot_scan.rl"
4942
5086
  { mark_aval = p; }
4943
5087
  goto st133;
4944
5088
  tr289:
4945
- #line 114 "hpricot_scan.rl"
5089
+ #line 120 "hpricot_scan.rl"
4946
5090
  { SET(akey, p); }
4947
5091
  goto st133;
4948
5092
  st133:
4949
5093
  if ( ++p == pe )
4950
5094
  goto _test_eof133;
4951
5095
  case 133:
4952
- #line 4953 "hpricot_scan.c"
5096
+ #line 5097 "hpricot_scan.c"
4953
5097
  switch( (*p) ) {
4954
5098
  case 13: goto tr308;
4955
5099
  case 32: goto tr308;
@@ -4967,17 +5111,17 @@ case 133:
4967
5111
  goto tr308;
4968
5112
  goto tr210;
4969
5113
  tr324:
4970
- #line 110 "hpricot_scan.rl"
4971
- {
5114
+ #line 116 "hpricot_scan.rl"
5115
+ {
4972
5116
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4973
5117
  else { SET(aval, p); }
4974
5118
  }
4975
5119
  goto st134;
4976
5120
  tr286:
4977
- #line 114 "hpricot_scan.rl"
5121
+ #line 120 "hpricot_scan.rl"
4978
5122
  { SET(akey, p); }
4979
- #line 110 "hpricot_scan.rl"
4980
- {
5123
+ #line 116 "hpricot_scan.rl"
5124
+ {
4981
5125
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4982
5126
  else { SET(aval, p); }
4983
5127
  }
@@ -4986,7 +5130,7 @@ st134:
4986
5130
  if ( ++p == pe )
4987
5131
  goto _test_eof134;
4988
5132
  case 134:
4989
- #line 4990 "hpricot_scan.c"
5133
+ #line 5134 "hpricot_scan.c"
4990
5134
  switch( (*p) ) {
4991
5135
  case 13: goto tr323;
4992
5136
  case 32: goto tr323;
@@ -5016,14 +5160,14 @@ case 134:
5016
5160
  goto tr282;
5017
5161
  goto st97;
5018
5162
  tr275:
5019
- #line 109 "hpricot_scan.rl"
5163
+ #line 115 "hpricot_scan.rl"
5020
5164
  { SET(aval, p); }
5021
5165
  goto st135;
5022
5166
  st135:
5023
5167
  if ( ++p == pe )
5024
5168
  goto _test_eof135;
5025
5169
  case 135:
5026
- #line 5027 "hpricot_scan.c"
5170
+ #line 5171 "hpricot_scan.c"
5027
5171
  switch( (*p) ) {
5028
5172
  case 13: goto tr326;
5029
5173
  case 32: goto tr326;
@@ -5061,14 +5205,14 @@ case 136:
5061
5205
  }
5062
5206
  goto tr216;
5063
5207
  tr251:
5064
- #line 109 "hpricot_scan.rl"
5208
+ #line 115 "hpricot_scan.rl"
5065
5209
  { SET(aval, p); }
5066
5210
  goto st137;
5067
5211
  st137:
5068
5212
  if ( ++p == pe )
5069
5213
  goto _test_eof137;
5070
5214
  case 137:
5071
- #line 5072 "hpricot_scan.c"
5215
+ #line 5216 "hpricot_scan.c"
5072
5216
  switch( (*p) ) {
5073
5217
  case 32: goto tr330;
5074
5218
  case 39: goto tr331;
@@ -5091,14 +5235,14 @@ case 137:
5091
5235
  goto tr332;
5092
5236
  goto tr328;
5093
5237
  tr248:
5094
- #line 105 "hpricot_scan.rl"
5238
+ #line 111 "hpricot_scan.rl"
5095
5239
  { mark_aval = p; }
5096
5240
  goto st138;
5097
5241
  st138:
5098
5242
  if ( ++p == pe )
5099
5243
  goto _test_eof138;
5100
5244
  case 138:
5101
- #line 5102 "hpricot_scan.c"
5245
+ #line 5246 "hpricot_scan.c"
5102
5246
  switch( (*p) ) {
5103
5247
  case 13: goto tr277;
5104
5248
  case 32: goto tr277;
@@ -5116,14 +5260,14 @@ case 138:
5116
5260
  goto tr277;
5117
5261
  goto tr247;
5118
5262
  tr185:
5119
- #line 109 "hpricot_scan.rl"
5263
+ #line 115 "hpricot_scan.rl"
5120
5264
  { SET(aval, p); }
5121
5265
  goto st139;
5122
5266
  st139:
5123
5267
  if ( ++p == pe )
5124
5268
  goto _test_eof139;
5125
5269
  case 139:
5126
- #line 5127 "hpricot_scan.c"
5270
+ #line 5271 "hpricot_scan.c"
5127
5271
  switch( (*p) ) {
5128
5272
  case 32: goto tr336;
5129
5273
  case 34: goto tr331;
@@ -5193,14 +5337,14 @@ case 143:
5193
5337
  }
5194
5338
  goto tr328;
5195
5339
  tr120:
5196
- #line 105 "hpricot_scan.rl"
5340
+ #line 111 "hpricot_scan.rl"
5197
5341
  { mark_aval = p; }
5198
5342
  goto st144;
5199
5343
  st144:
5200
5344
  if ( ++p == pe )
5201
5345
  goto _test_eof144;
5202
5346
  case 144:
5203
- #line 5204 "hpricot_scan.c"
5347
+ #line 5348 "hpricot_scan.c"
5204
5348
  switch( (*p) ) {
5205
5349
  case 13: goto tr148;
5206
5350
  case 32: goto tr148;
@@ -5239,7 +5383,7 @@ st146:
5239
5383
  if ( ++p == pe )
5240
5384
  goto _test_eof146;
5241
5385
  case 146:
5242
- #line 5243 "hpricot_scan.c"
5386
+ #line 5387 "hpricot_scan.c"
5243
5387
  switch( (*p) ) {
5244
5388
  case 32: goto st212;
5245
5389
  case 63: goto st146;
@@ -5277,7 +5421,7 @@ st147:
5277
5421
  if ( ++p == pe )
5278
5422
  goto _test_eof147;
5279
5423
  case 147:
5280
- #line 5281 "hpricot_scan.c"
5424
+ #line 5425 "hpricot_scan.c"
5281
5425
  switch( (*p) ) {
5282
5426
  case 32: goto st212;
5283
5427
  case 63: goto st146;
@@ -5356,7 +5500,7 @@ st213:
5356
5500
  if ( ++p == pe )
5357
5501
  goto _test_eof213;
5358
5502
  case 213:
5359
- #line 5360 "hpricot_scan.c"
5503
+ #line 5504 "hpricot_scan.c"
5360
5504
  switch( (*p) ) {
5361
5505
  case 32: goto tr348;
5362
5506
  case 118: goto st150;
@@ -5448,14 +5592,14 @@ case 158:
5448
5592
  goto tr359;
5449
5593
  goto tr349;
5450
5594
  tr359:
5451
- #line 105 "hpricot_scan.rl"
5595
+ #line 111 "hpricot_scan.rl"
5452
5596
  { mark_aval = p; }
5453
5597
  goto st159;
5454
5598
  st159:
5455
5599
  if ( ++p == pe )
5456
5600
  goto _test_eof159;
5457
5601
  case 159:
5458
- #line 5459 "hpricot_scan.c"
5602
+ #line 5603 "hpricot_scan.c"
5459
5603
  switch( (*p) ) {
5460
5604
  case 34: goto tr360;
5461
5605
  case 95: goto st159;
@@ -5473,14 +5617,14 @@ case 159:
5473
5617
  goto st159;
5474
5618
  goto tr349;
5475
5619
  tr360:
5476
- #line 115 "hpricot_scan.rl"
5620
+ #line 121 "hpricot_scan.rl"
5477
5621
  { SET(aval, p); ATTR(ID2SYM(rb_intern("version")), aval); }
5478
5622
  goto st160;
5479
5623
  st160:
5480
5624
  if ( ++p == pe )
5481
5625
  goto _test_eof160;
5482
5626
  case 160:
5483
- #line 5484 "hpricot_scan.c"
5627
+ #line 5628 "hpricot_scan.c"
5484
5628
  switch( (*p) ) {
5485
5629
  case 32: goto st161;
5486
5630
  case 62: goto tr363;
@@ -5593,14 +5737,14 @@ case 172:
5593
5737
  goto tr377;
5594
5738
  goto tr349;
5595
5739
  tr377:
5596
- #line 105 "hpricot_scan.rl"
5740
+ #line 111 "hpricot_scan.rl"
5597
5741
  { mark_aval = p; }
5598
5742
  goto st173;
5599
5743
  st173:
5600
5744
  if ( ++p == pe )
5601
5745
  goto _test_eof173;
5602
5746
  case 173:
5603
- #line 5604 "hpricot_scan.c"
5747
+ #line 5748 "hpricot_scan.c"
5604
5748
  switch( (*p) ) {
5605
5749
  case 34: goto tr378;
5606
5750
  case 95: goto st173;
@@ -5618,14 +5762,14 @@ case 173:
5618
5762
  goto st173;
5619
5763
  goto tr349;
5620
5764
  tr378:
5621
- #line 116 "hpricot_scan.rl"
5765
+ #line 122 "hpricot_scan.rl"
5622
5766
  { SET(aval, p); ATTR(ID2SYM(rb_intern("encoding")), aval); }
5623
5767
  goto st174;
5624
5768
  st174:
5625
5769
  if ( ++p == pe )
5626
5770
  goto _test_eof174;
5627
5771
  case 174:
5628
- #line 5629 "hpricot_scan.c"
5772
+ #line 5773 "hpricot_scan.c"
5629
5773
  switch( (*p) ) {
5630
5774
  case 32: goto st175;
5631
5775
  case 62: goto tr363;
@@ -5743,14 +5887,14 @@ case 187:
5743
5887
  }
5744
5888
  goto tr349;
5745
5889
  tr393:
5746
- #line 105 "hpricot_scan.rl"
5890
+ #line 111 "hpricot_scan.rl"
5747
5891
  { mark_aval = p; }
5748
5892
  goto st188;
5749
5893
  st188:
5750
5894
  if ( ++p == pe )
5751
5895
  goto _test_eof188;
5752
5896
  case 188:
5753
- #line 5754 "hpricot_scan.c"
5897
+ #line 5898 "hpricot_scan.c"
5754
5898
  if ( (*p) == 111 )
5755
5899
  goto st189;
5756
5900
  goto tr349;
@@ -5762,14 +5906,14 @@ case 189:
5762
5906
  goto tr396;
5763
5907
  goto tr349;
5764
5908
  tr396:
5765
- #line 117 "hpricot_scan.rl"
5909
+ #line 123 "hpricot_scan.rl"
5766
5910
  { SET(aval, p); ATTR(ID2SYM(rb_intern("standalone")), aval); }
5767
5911
  goto st190;
5768
5912
  st190:
5769
5913
  if ( ++p == pe )
5770
5914
  goto _test_eof190;
5771
5915
  case 190:
5772
- #line 5773 "hpricot_scan.c"
5916
+ #line 5917 "hpricot_scan.c"
5773
5917
  switch( (*p) ) {
5774
5918
  case 32: goto st190;
5775
5919
  case 62: goto tr363;
@@ -5779,14 +5923,14 @@ case 190:
5779
5923
  goto st190;
5780
5924
  goto tr349;
5781
5925
  tr394:
5782
- #line 105 "hpricot_scan.rl"
5926
+ #line 111 "hpricot_scan.rl"
5783
5927
  { mark_aval = p; }
5784
5928
  goto st191;
5785
5929
  st191:
5786
5930
  if ( ++p == pe )
5787
5931
  goto _test_eof191;
5788
5932
  case 191:
5789
- #line 5790 "hpricot_scan.c"
5933
+ #line 5934 "hpricot_scan.c"
5790
5934
  if ( (*p) == 101 )
5791
5935
  goto st192;
5792
5936
  goto tr349;
@@ -5807,14 +5951,14 @@ case 193:
5807
5951
  }
5808
5952
  goto tr349;
5809
5953
  tr399:
5810
- #line 105 "hpricot_scan.rl"
5954
+ #line 111 "hpricot_scan.rl"
5811
5955
  { mark_aval = p; }
5812
5956
  goto st194;
5813
5957
  st194:
5814
5958
  if ( ++p == pe )
5815
5959
  goto _test_eof194;
5816
5960
  case 194:
5817
- #line 5818 "hpricot_scan.c"
5961
+ #line 5962 "hpricot_scan.c"
5818
5962
  if ( (*p) == 111 )
5819
5963
  goto st195;
5820
5964
  goto tr349;
@@ -5826,14 +5970,14 @@ case 195:
5826
5970
  goto tr396;
5827
5971
  goto tr349;
5828
5972
  tr400:
5829
- #line 105 "hpricot_scan.rl"
5973
+ #line 111 "hpricot_scan.rl"
5830
5974
  { mark_aval = p; }
5831
5975
  goto st196;
5832
5976
  st196:
5833
5977
  if ( ++p == pe )
5834
5978
  goto _test_eof196;
5835
5979
  case 196:
5836
- #line 5837 "hpricot_scan.c"
5980
+ #line 5981 "hpricot_scan.c"
5837
5981
  if ( (*p) == 101 )
5838
5982
  goto st197;
5839
5983
  goto tr349;
@@ -5855,14 +5999,14 @@ case 198:
5855
5999
  goto tr403;
5856
6000
  goto tr349;
5857
6001
  tr403:
5858
- #line 105 "hpricot_scan.rl"
6002
+ #line 111 "hpricot_scan.rl"
5859
6003
  { mark_aval = p; }
5860
6004
  goto st199;
5861
6005
  st199:
5862
6006
  if ( ++p == pe )
5863
6007
  goto _test_eof199;
5864
6008
  case 199:
5865
- #line 5866 "hpricot_scan.c"
6009
+ #line 6010 "hpricot_scan.c"
5866
6010
  switch( (*p) ) {
5867
6011
  case 39: goto tr378;
5868
6012
  case 95: goto st199;
@@ -5898,14 +6042,14 @@ case 200:
5898
6042
  goto tr405;
5899
6043
  goto tr349;
5900
6044
  tr405:
5901
- #line 105 "hpricot_scan.rl"
6045
+ #line 111 "hpricot_scan.rl"
5902
6046
  { mark_aval = p; }
5903
6047
  goto st201;
5904
6048
  st201:
5905
6049
  if ( ++p == pe )
5906
6050
  goto _test_eof201;
5907
6051
  case 201:
5908
- #line 5909 "hpricot_scan.c"
6052
+ #line 6053 "hpricot_scan.c"
5909
6053
  switch( (*p) ) {
5910
6054
  case 39: goto tr360;
5911
6055
  case 95: goto st201;
@@ -5954,7 +6098,7 @@ st214:
5954
6098
  case 214:
5955
6099
  #line 1 "hpricot_scan.rl"
5956
6100
  {ts = p;}
5957
- #line 5958 "hpricot_scan.c"
6101
+ #line 6102 "hpricot_scan.c"
5958
6102
  switch( (*p) ) {
5959
6103
  case 10: goto tr423;
5960
6104
  case 45: goto tr424;
@@ -5968,7 +6112,7 @@ st215:
5968
6112
  if ( ++p == pe )
5969
6113
  goto _test_eof215;
5970
6114
  case 215:
5971
- #line 5972 "hpricot_scan.c"
6115
+ #line 6116 "hpricot_scan.c"
5972
6116
  if ( (*p) == 45 )
5973
6117
  goto st202;
5974
6118
  goto tr425;
@@ -6011,7 +6155,7 @@ st216:
6011
6155
  case 216:
6012
6156
  #line 1 "hpricot_scan.rl"
6013
6157
  {ts = p;}
6014
- #line 6015 "hpricot_scan.c"
6158
+ #line 6159 "hpricot_scan.c"
6015
6159
  switch( (*p) ) {
6016
6160
  case 10: goto tr428;
6017
6161
  case 93: goto tr429;
@@ -6025,7 +6169,7 @@ st217:
6025
6169
  if ( ++p == pe )
6026
6170
  goto _test_eof217;
6027
6171
  case 217:
6028
- #line 6029 "hpricot_scan.c"
6172
+ #line 6173 "hpricot_scan.c"
6029
6173
  if ( (*p) == 93 )
6030
6174
  goto st203;
6031
6175
  goto tr430;
@@ -6064,7 +6208,7 @@ st218:
6064
6208
  case 218:
6065
6209
  #line 1 "hpricot_scan.rl"
6066
6210
  {ts = p;}
6067
- #line 6068 "hpricot_scan.c"
6211
+ #line 6212 "hpricot_scan.c"
6068
6212
  switch( (*p) ) {
6069
6213
  case 10: goto tr433;
6070
6214
  case 62: goto tr434;
@@ -6524,11 +6668,12 @@ case 219:
6524
6668
  }
6525
6669
 
6526
6670
  }
6527
- #line 546 "hpricot_scan.rl"
6528
-
6529
- if ( cs == hpricot_scan_error ) {
6530
- free(buf);
6531
- if ( !NIL_P(tag) )
6671
+ #line 534 "hpricot_scan.rl"
6672
+
6673
+ if (cs == hpricot_scan_error) {
6674
+ if (buf != NULL)
6675
+ free(buf);
6676
+ if (!NIL_P(tag))
6532
6677
  {
6533
6678
  rb_raise(rb_eHpricotParseError, "parse error on element <%s>, starting on line %d.\n" NO_WAY_SERIOUSLY, RSTRING_PTR(tag), curline);
6534
6679
  }
@@ -6537,8 +6682,8 @@ case 219:
6537
6682
  rb_raise(rb_eHpricotParseError, "parse error on line %d.\n" NO_WAY_SERIOUSLY, curline);
6538
6683
  }
6539
6684
  }
6540
-
6541
- if ( done && ele_open )
6685
+
6686
+ if (done && ele_open)
6542
6687
  {
6543
6688
  ele_open = 0;
6544
6689
  if (ts > 0) {
@@ -6548,11 +6693,11 @@ case 219:
6548
6693
  }
6549
6694
  }
6550
6695
 
6551
- if ( ts == 0 )
6696
+ if (ts == 0)
6552
6697
  {
6553
6698
  have = 0;
6554
6699
  /* text nodes have no ts because each byte is parsed alone */
6555
- if ( mark_tag != NULL && text == 1 )
6700
+ if (mark_tag != NULL && text == 1)
6556
6701
  {
6557
6702
  if (done)
6558
6703
  {
@@ -6567,12 +6712,15 @@ case 219:
6567
6712
  CAT(tag, p);
6568
6713
  }
6569
6714
  }
6570
- mark_tag = buf;
6715
+ if (io)
6716
+ mark_tag = buf;
6717
+ else
6718
+ mark_tag = RSTRING_PTR(port);
6571
6719
  }
6572
- else
6720
+ else if (io)
6573
6721
  {
6574
6722
  have = pe - ts;
6575
- memmove( buf, ts, have );
6723
+ memmove(buf, ts, have);
6576
6724
  SLIDE(tag);
6577
6725
  SLIDE(akey);
6578
6726
  SLIDE(aval);
@@ -6580,7 +6728,9 @@ case 219:
6580
6728
  ts = buf;
6581
6729
  }
6582
6730
  }
6583
- free(buf);
6731
+
6732
+ if (buf != NULL)
6733
+ free(buf);
6584
6734
 
6585
6735
  if (S != NULL)
6586
6736
  {
@@ -6593,66 +6743,103 @@ case 219:
6593
6743
  return Qnil;
6594
6744
  }
6595
6745
 
6596
- void Init_hpricot_scan()
6746
+ static VALUE
6747
+ alloc_hpricot_struct(VALUE klass)
6597
6748
  {
6598
- mHpricot = rb_define_module("Hpricot");
6599
- rb_define_attr(rb_singleton_class(mHpricot), "buffer_size", 1, 1);
6600
- rb_define_singleton_method(mHpricot, "scan", hpricot_scan, -1);
6601
- rb_define_singleton_method(mHpricot, "css", hpricot_css, 3);
6602
- rb_eHpricotParseError = rb_define_class_under(mHpricot, "ParseError", rb_eStandardError);
6749
+ VALUE size;
6750
+ long n;
6751
+ NEWOBJ(st, struct RStruct);
6752
+ OBJSETUP(st, klass, T_STRUCT);
6603
6753
 
6604
- cDoc = rb_define_class_under(mHpricot, "Doc", rb_cObject);
6605
- rb_define_alloc_func(cDoc, hpricot_ele_alloc);
6606
- rb_define_method(cDoc, "children", hpricot_ele_get_children, 0);
6607
- rb_define_method(cDoc, "children=", hpricot_ele_set_children, 1);
6754
+ size = rb_struct_iv_get(klass, "__size__");
6755
+ n = FIX2LONG(size);
6608
6756
 
6609
- cBaseEle = rb_define_class_under(mHpricot, "BaseEle", rb_cObject);
6610
- rb_define_alloc_func(cBaseEle, hpricot_ele_alloc);
6611
- rb_define_method(cBaseEle, "raw_string", hpricot_ele_get_raw, 0);
6612
- rb_define_method(cBaseEle, "clear_raw", hpricot_ele_clear_raw, 0);
6613
- rb_define_method(cBaseEle, "parent", hpricot_ele_get_parent, 0);
6614
- rb_define_method(cBaseEle, "parent=", hpricot_ele_set_parent, 1);
6615
- cCData = rb_define_class_under(mHpricot, "CData", cBaseEle);
6616
- rb_define_method(cCData, "content", hpricot_ele_get_tag, 0);
6617
- rb_define_method(cCData, "content=", hpricot_ele_set_tag, 1);
6618
- cComment = rb_define_class_under(mHpricot, "Comment", cBaseEle);
6619
- rb_define_method(cComment, "content", hpricot_ele_get_tag, 0);
6620
- rb_define_method(cComment, "content=", hpricot_ele_set_tag, 1);
6621
- cDocType = rb_define_class_under(mHpricot, "DocType", cBaseEle);
6622
- rb_define_method(cDocType, "target", hpricot_ele_get_tag, 0);
6623
- rb_define_method(cDocType, "target=", hpricot_ele_set_tag, 1);
6624
- rb_define_method(cDocType, "public_id", hpricot_ele_get_public_id, 0);
6625
- rb_define_method(cDocType, "public_id=", hpricot_ele_set_public_id, 1);
6626
- rb_define_method(cDocType, "system_id", hpricot_ele_get_system_id, 0);
6627
- rb_define_method(cDocType, "system_id=", hpricot_ele_set_system_id, 1);
6628
- cElem = rb_define_class_under(mHpricot, "Elem", cBaseEle);
6629
- rb_define_method(cElem, "raw_attributes", hpricot_ele_get_attr, 0);
6630
- rb_define_method(cElem, "raw_attributes=", hpricot_ele_set_attr, 1);
6631
- rb_define_method(cElem, "children", hpricot_ele_get_children, 0);
6632
- rb_define_method(cElem, "children=", hpricot_ele_set_children, 1);
6633
- rb_define_method(cElem, "etag", hpricot_ele_get_etag, 0);
6634
- rb_define_method(cElem, "etag=", hpricot_ele_set_etag, 1);
6635
- rb_define_method(cElem, "name", hpricot_ele_get_tag, 0);
6636
- rb_define_method(cElem, "name=", hpricot_ele_set_tag, 1);
6637
- cETag = rb_define_class_under(mHpricot, "ETag", cBaseEle);
6638
- rb_define_method(cETag, "name", hpricot_ele_get_tag, 0);
6639
- rb_define_method(cETag, "name=", hpricot_ele_set_tag, 1);
6640
- cBogusETag = rb_define_class_under(mHpricot, "BogusETag", cETag);
6641
- cText = rb_define_class_under(mHpricot, "Text", cBaseEle);
6642
- rb_define_method(cText, "content", hpricot_ele_get_tag, 0);
6643
- rb_define_method(cText, "content=", hpricot_ele_set_tag, 1);
6644
- cXMLDecl = rb_define_class_under(mHpricot, "XMLDecl", cBaseEle);
6645
- rb_define_method(cXMLDecl, "encoding", hpricot_ele_get_encoding, 0);
6646
- rb_define_method(cXMLDecl, "encoding=", hpricot_ele_set_encoding, 1);
6647
- rb_define_method(cXMLDecl, "standalone", hpricot_ele_get_standalone, 0);
6648
- rb_define_method(cXMLDecl, "standalone=", hpricot_ele_set_standalone, 1);
6649
- rb_define_method(cXMLDecl, "version", hpricot_ele_get_version, 0);
6650
- rb_define_method(cXMLDecl, "version=", hpricot_ele_set_version, 1);
6651
- cProcIns = rb_define_class_under(mHpricot, "ProcIns", cBaseEle);
6652
- rb_define_method(cProcIns, "target", hpricot_ele_get_tag, 0);
6653
- rb_define_method(cProcIns, "target=", hpricot_ele_set_tag, 1);
6654
- rb_define_method(cProcIns, "content", hpricot_ele_get_attr, 0);
6655
- rb_define_method(cProcIns, "content=", hpricot_ele_set_attr, 1);
6757
+ #ifndef RSTRUCT_EMBED_LEN_MAX
6758
+ st->ptr = ALLOC_N(VALUE, n);
6759
+ rb_mem_clear(st->ptr, n);
6760
+ st->len = n;
6761
+ #else
6762
+ if (0 < n && n <= RSTRUCT_EMBED_LEN_MAX) {
6763
+ RBASIC(st)->flags &= ~RSTRUCT_EMBED_LEN_MASK;
6764
+ RBASIC(st)->flags |= n << RSTRUCT_EMBED_LEN_SHIFT;
6765
+ rb_mem_clear(st->as.ary, n);
6766
+ } else {
6767
+ st->as.heap.ptr = ALLOC_N(VALUE, n);
6768
+ rb_mem_clear(st->as.heap.ptr, n);
6769
+ st->as.heap.len = n;
6770
+ }
6771
+ #endif
6772
+
6773
+ return (VALUE)st;
6774
+ }
6775
+
6776
+ static VALUE hpricot_struct_ref0(VALUE obj) {return H_ELE_GET(obj, 0);}
6777
+ static VALUE hpricot_struct_ref1(VALUE obj) {return H_ELE_GET(obj, 1);}
6778
+ static VALUE hpricot_struct_ref2(VALUE obj) {return H_ELE_GET(obj, 2);}
6779
+ static VALUE hpricot_struct_ref3(VALUE obj) {return H_ELE_GET(obj, 3);}
6780
+ static VALUE hpricot_struct_ref4(VALUE obj) {return H_ELE_GET(obj, 4);}
6781
+ static VALUE hpricot_struct_ref5(VALUE obj) {return H_ELE_GET(obj, 5);}
6782
+ static VALUE hpricot_struct_ref6(VALUE obj) {return H_ELE_GET(obj, 6);}
6783
+ static VALUE hpricot_struct_ref7(VALUE obj) {return H_ELE_GET(obj, 7);}
6784
+ static VALUE hpricot_struct_ref8(VALUE obj) {return H_ELE_GET(obj, 8);}
6785
+ static VALUE hpricot_struct_ref9(VALUE obj) {return H_ELE_GET(obj, 9);}
6786
+
6787
+ static VALUE (*ref_func[10])() = {
6788
+ hpricot_struct_ref0,
6789
+ hpricot_struct_ref1,
6790
+ hpricot_struct_ref2,
6791
+ hpricot_struct_ref3,
6792
+ hpricot_struct_ref4,
6793
+ hpricot_struct_ref5,
6794
+ hpricot_struct_ref6,
6795
+ hpricot_struct_ref7,
6796
+ hpricot_struct_ref8,
6797
+ hpricot_struct_ref9,
6798
+ };
6799
+
6800
+ static VALUE hpricot_struct_set0(VALUE obj, VALUE val) {return H_ELE_SET(obj, 0, val);}
6801
+ static VALUE hpricot_struct_set1(VALUE obj, VALUE val) {return H_ELE_SET(obj, 1, val);}
6802
+ static VALUE hpricot_struct_set2(VALUE obj, VALUE val) {return H_ELE_SET(obj, 2, val);}
6803
+ static VALUE hpricot_struct_set3(VALUE obj, VALUE val) {return H_ELE_SET(obj, 3, val);}
6804
+ static VALUE hpricot_struct_set4(VALUE obj, VALUE val) {return H_ELE_SET(obj, 4, val);}
6805
+ static VALUE hpricot_struct_set5(VALUE obj, VALUE val) {return H_ELE_SET(obj, 5, val);}
6806
+ static VALUE hpricot_struct_set6(VALUE obj, VALUE val) {return H_ELE_SET(obj, 6, val);}
6807
+ static VALUE hpricot_struct_set7(VALUE obj, VALUE val) {return H_ELE_SET(obj, 7, val);}
6808
+ static VALUE hpricot_struct_set8(VALUE obj, VALUE val) {return H_ELE_SET(obj, 8, val);}
6809
+ static VALUE hpricot_struct_set9(VALUE obj, VALUE val) {return H_ELE_SET(obj, 9, val);}
6810
+
6811
+ static VALUE (*set_func[10])() = {
6812
+ hpricot_struct_set0,
6813
+ hpricot_struct_set1,
6814
+ hpricot_struct_set2,
6815
+ hpricot_struct_set3,
6816
+ hpricot_struct_set4,
6817
+ hpricot_struct_set5,
6818
+ hpricot_struct_set6,
6819
+ hpricot_struct_set7,
6820
+ hpricot_struct_set8,
6821
+ hpricot_struct_set9,
6822
+ };
6823
+
6824
+ static VALUE
6825
+ make_hpricot_struct(VALUE members)
6826
+ {
6827
+ int i = 0;
6828
+ VALUE klass = rb_class_new(rb_cObject);
6829
+ rb_iv_set(klass, "__size__", INT2NUM(RARRAY_LEN(members)));
6830
+ rb_define_alloc_func(klass, alloc_hpricot_struct);
6831
+ rb_define_singleton_method(klass, "new", rb_class_new_instance, -1);
6832
+ for (i = 0; i < RARRAY_LEN(members); i++) {
6833
+ ID id = SYM2ID(RARRAY_PTR(members)[i]);
6834
+ rb_define_method_id(klass, id, ref_func[i], 0);
6835
+ rb_define_method_id(klass, rb_id_attrset(id), set_func[i], 1);
6836
+ }
6837
+ return klass;
6838
+ }
6839
+
6840
+ void Init_hpricot_scan()
6841
+ {
6842
+ VALUE structElem, structAttr, structBasic;
6656
6843
 
6657
6844
  s_ElementContent = rb_intern("ElementContent");
6658
6845
  symAllow = ID2SYM(rb_intern("allow"));
@@ -6662,19 +6849,78 @@ void Init_hpricot_scan()
6662
6849
  s_parent = rb_intern("parent");
6663
6850
  s_read = rb_intern("read");
6664
6851
  s_to_str = rb_intern("to_str");
6665
- iv_parent = rb_intern("parent");
6666
6852
  sym_xmldecl = ID2SYM(rb_intern("xmldecl"));
6667
6853
  sym_doctype = ID2SYM(rb_intern("doctype"));
6668
6854
  sym_procins = ID2SYM(rb_intern("procins"));
6669
6855
  sym_stag = ID2SYM(rb_intern("stag"));
6670
6856
  sym_etag = ID2SYM(rb_intern("etag"));
6671
6857
  sym_emptytag = ID2SYM(rb_intern("emptytag"));
6858
+ sym_allowed = ID2SYM(rb_intern("allowed"));
6859
+ sym_children = ID2SYM(rb_intern("children"));
6672
6860
  sym_comment = ID2SYM(rb_intern("comment"));
6673
6861
  sym_cdata = ID2SYM(rb_intern("cdata"));
6862
+ sym_name = ID2SYM(rb_intern("name"));
6863
+ sym_parent = ID2SYM(rb_intern("parent"));
6864
+ sym_raw_attributes = ID2SYM(rb_intern("raw_attributes"));
6865
+ sym_raw_string = ID2SYM(rb_intern("raw_string"));
6866
+ sym_tagno = ID2SYM(rb_intern("tagno"));
6674
6867
  sym_text = ID2SYM(rb_intern("text"));
6675
6868
  sym_EMPTY = ID2SYM(rb_intern("EMPTY"));
6676
6869
  sym_CDATA = ID2SYM(rb_intern("CDATA"));
6677
6870
 
6871
+ mHpricot = rb_define_module("Hpricot");
6872
+ rb_define_attr(rb_singleton_class(mHpricot), "buffer_size", 1, 1);
6873
+ rb_define_singleton_method(mHpricot, "scan", hpricot_scan, -1);
6874
+ rb_define_singleton_method(mHpricot, "css", hpricot_css, 3);
6875
+ rb_eHpricotParseError = rb_define_class_under(mHpricot, "ParseError", rb_eStandardError);
6876
+
6877
+ structElem = make_hpricot_struct(rb_ary_new3(8, sym_name, sym_parent,
6878
+ sym_raw_attributes, sym_etag, sym_raw_string, sym_allowed,
6879
+ sym_tagno, sym_children));
6880
+ structAttr = make_hpricot_struct(rb_ary_new3(3, sym_name, sym_parent, sym_raw_attributes));
6881
+ structBasic = make_hpricot_struct(rb_ary_new3(2, sym_name, sym_parent));
6882
+
6883
+ cDoc = rb_define_class_under(mHpricot, "Doc", structElem);
6884
+ cCData = rb_define_class_under(mHpricot, "CData", structBasic);
6885
+ rb_define_method(cCData, "content", hpricot_ele_get_name, 0);
6886
+ rb_define_method(cCData, "content=", hpricot_ele_set_name, 1);
6887
+ cComment = rb_define_class_under(mHpricot, "Comment", structBasic);
6888
+ rb_define_method(cComment, "content", hpricot_ele_get_name, 0);
6889
+ rb_define_method(cComment, "content=", hpricot_ele_set_name, 1);
6890
+ cDocType = rb_define_class_under(mHpricot, "DocType", structAttr);
6891
+ rb_define_method(cDocType, "raw_string", hpricot_ele_get_name, 0);
6892
+ rb_define_method(cDocType, "clear_raw", hpricot_ele_clear_name, 0);
6893
+ rb_define_method(cDocType, "target", hpricot_ele_get_target, 0);
6894
+ rb_define_method(cDocType, "target=", hpricot_ele_set_target, 1);
6895
+ rb_define_method(cDocType, "public_id", hpricot_ele_get_public_id, 0);
6896
+ rb_define_method(cDocType, "public_id=", hpricot_ele_set_public_id, 1);
6897
+ rb_define_method(cDocType, "system_id", hpricot_ele_get_system_id, 0);
6898
+ rb_define_method(cDocType, "system_id=", hpricot_ele_set_system_id, 1);
6899
+ cElem = rb_define_class_under(mHpricot, "Elem", structElem);
6900
+ rb_define_method(cElem, "clear_raw", hpricot_ele_clear_raw, 0);
6901
+ cBogusETag = rb_define_class_under(mHpricot, "BogusETag", structAttr);
6902
+ rb_define_method(cBogusETag, "raw_string", hpricot_ele_get_attr, 0);
6903
+ rb_define_method(cBogusETag, "clear_raw", hpricot_ele_clear_attr, 0);
6904
+ cText = rb_define_class_under(mHpricot, "Text", structBasic);
6905
+ rb_define_method(cText, "raw_string", hpricot_ele_get_name, 0);
6906
+ rb_define_method(cText, "clear_raw", hpricot_ele_clear_name, 0);
6907
+ rb_define_method(cText, "content", hpricot_ele_get_name, 0);
6908
+ rb_define_method(cText, "content=", hpricot_ele_set_name, 1);
6909
+ cXMLDecl = rb_define_class_under(mHpricot, "XMLDecl", structAttr);
6910
+ rb_define_method(cXMLDecl, "raw_string", hpricot_ele_get_name, 0);
6911
+ rb_define_method(cXMLDecl, "clear_raw", hpricot_ele_clear_name, 0);
6912
+ rb_define_method(cXMLDecl, "encoding", hpricot_ele_get_encoding, 0);
6913
+ rb_define_method(cXMLDecl, "encoding=", hpricot_ele_set_encoding, 1);
6914
+ rb_define_method(cXMLDecl, "standalone", hpricot_ele_get_standalone, 0);
6915
+ rb_define_method(cXMLDecl, "standalone=", hpricot_ele_set_standalone, 1);
6916
+ rb_define_method(cXMLDecl, "version", hpricot_ele_get_version, 0);
6917
+ rb_define_method(cXMLDecl, "version=", hpricot_ele_set_version, 1);
6918
+ cProcIns = rb_define_class_under(mHpricot, "ProcIns", structAttr);
6919
+ rb_define_method(cProcIns, "target", hpricot_ele_get_name, 0);
6920
+ rb_define_method(cProcIns, "target=", hpricot_ele_set_name, 1);
6921
+ rb_define_method(cProcIns, "content", hpricot_ele_get_attr, 0);
6922
+ rb_define_method(cProcIns, "content=", hpricot_ele_set_attr, 1);
6923
+
6678
6924
  rb_const_set(mHpricot, rb_intern("ProcInsParse"),
6679
6925
  reProcInsParse = rb_eval_string("/\\A<\\?(\\S+)\\s+(.+)/m"));
6680
6926
  }