hpricot 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,12 @@
16
16
  rb_funcall2(mod, rb_intern(filt), fargs, fvals); \
17
17
  rb_ary_clear(tmpt); \
18
18
  fargs = 1
19
- #define PUSH(aps, ape) rb_ary_push(tmpt, fvals[fargs++] = rb_str_new(aps, ape - aps))
19
+ #ifdef HAVE_RUBY_ENCODING_H
20
+ #define STRNEW(a, len) rb_external_str_new((a), (len))
21
+ #else
22
+ #define STRNEW(a, len) rb_str_new((a), (len))
23
+ #endif
24
+ #define PUSH(aps, ape) rb_ary_push(tmpt, fvals[fargs++] = STRNEW(aps, ape - aps))
20
25
  #define P(id) printf(id ": %.*s\n", te - ts, ts);
21
26
 
22
27
  %%{
@@ -1,3 +1,4 @@
1
+
1
2
  #line 1 "hpricot_scan.rl"
2
3
  /*
3
4
  * hpricot_scan.rl
@@ -5,9 +6,15 @@
5
6
  * $Author: why $
6
7
  * $Date: 2006-05-08 22:03:50 -0600 (Mon, 08 May 2006) $
7
8
  *
8
- * Copyright (C) 2006 why the lucky stiff
9
+ * Copyright (C) 2006, 2010 why the lucky stiff
9
10
  */
10
11
  #include <ruby.h>
12
+ #include <assert.h>
13
+
14
+ struct hpricot_struct {
15
+ int len;
16
+ VALUE* ptr;
17
+ };
11
18
 
12
19
  #ifndef RARRAY_LEN
13
20
  #define RARRAY_LEN(arr) RARRAY(arr)->len
@@ -17,7 +24,7 @@
17
24
 
18
25
  VALUE hpricot_css(VALUE, VALUE, VALUE, VALUE, VALUE);
19
26
 
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!"
27
+ #define NO_WAY_SERIOUSLY "*** This should not happen, please file a bug report with the HTML you're parsing at http://github.com/hpricot/hpricot/issues. So sorry!"
21
28
 
22
29
  static VALUE sym_xmldecl, sym_doctype, sym_procins, sym_stag, sym_etag, sym_emptytag, sym_comment,
23
30
  sym_cdata, sym_name, sym_parent, sym_raw_attributes, sym_raw_string, sym_tagno,
@@ -38,32 +45,49 @@ static VALUE reProcInsParse;
38
45
  #define H_ELE_HASH 6
39
46
  #define H_ELE_CHILDREN 7
40
47
 
41
- #define H_ELE_GET(ele, idx) RSTRUCT_PTR(ele)[idx]
42
- #define H_ELE_SET(ele, idx, val) RSTRUCT_PTR(ele)[idx] = val
48
+ #define HSTRUCT_PTR(ele) ((struct hpricot_struct*)DATA_PTR(ele))->ptr
49
+
50
+ #define H_ELE_GET(ele, idx) HSTRUCT_PTR(ele)[idx]
51
+ #define H_ELE_SET(ele, idx, val) HSTRUCT_PTR(ele)[idx] = val
43
52
 
44
53
  #define OPT(opts, key) (!NIL_P(opts) && RTEST(rb_hash_aref(opts, ID2SYM(rb_intern("" # key)))))
45
54
 
46
- #define ELE(N) \
47
- if (te > ts || text == 1) { \
48
- char *raw = NULL; \
49
- int rawlen = 0; \
50
- ele_open = 0; text = 0; \
55
+ #ifdef HAVE_RUBY_ENCODING_H
56
+ #include <ruby/encoding.h>
57
+ # define ASSOCIATE_INDEX(s) rb_enc_associate_index((s), encoding_index)
58
+ # define ENCODING_INDEX , encoding_index
59
+ #else
60
+ # define ASSOCIATE_INDEX(s)
61
+ # define ENCODING_INDEX
62
+ #endif
63
+
64
+ #define ELE(N) \
65
+ if (te > ts || text == 1) { \
66
+ char *raw = NULL; \
67
+ int rawlen = 0; \
68
+ ele_open = 0; text = 0; \
51
69
  if (ts != 0 && sym_##N != sym_cdata && sym_##N != sym_text && sym_##N != sym_procins && sym_##N != sym_comment) { \
52
- raw = ts; rawlen = te - ts; \
53
- } \
54
- if (rb_block_given_p()) { \
55
- VALUE raw_string = Qnil; \
56
- if (raw != NULL) raw_string = rb_str_new(raw, rawlen); \
57
- rb_yield_tokens(sym_##N, tag, attr, Qnil, taint); \
58
- } else \
59
- rb_hpricot_token(S, sym_##N, tag, attr, raw, rawlen, taint); \
70
+ raw = ts; rawlen = te - ts; \
71
+ } \
72
+ if (rb_block_given_p()) { \
73
+ VALUE raw_string = Qnil; \
74
+ if (raw != NULL) { \
75
+ raw_string = rb_str_new(raw, rawlen); \
76
+ ASSOCIATE_INDEX(raw_string); \
77
+ } \
78
+ rb_yield_tokens(sym_##N, tag, attr, Qnil, taint); \
79
+ } else \
80
+ rb_hpricot_token(S, sym_##N, tag, attr, raw, rawlen, taint ENCODING_INDEX); \
60
81
  }
61
82
 
62
- #define SET(N, E) \
63
- if (mark_##N == NULL || E == mark_##N) \
64
- N = rb_str_new2(""); \
65
- else if (E > mark_##N) \
66
- N = rb_str_new(mark_##N, E - mark_##N);
83
+ #define SET(N, E) \
84
+ if (mark_##N == NULL || E == mark_##N) { \
85
+ N = rb_str_new2(""); \
86
+ ASSOCIATE_INDEX(N); \
87
+ } else if (E > mark_##N) { \
88
+ N = rb_str_new(mark_##N, E - mark_##N); \
89
+ ASSOCIATE_INDEX(N); \
90
+ }
67
91
 
68
92
  #define CAT(N, E) if (NIL_P(N)) { SET(N, E); } else { rb_str_cat(N, mark_##N, E - mark_##N); }
69
93
 
@@ -93,11 +117,12 @@ static VALUE reProcInsParse;
93
117
 
94
118
  #define EBLK(N, T) CAT(tag, p - T + 1); ELE(N);
95
119
 
96
- #line 142 "hpricot_scan.rl"
97
120
 
121
+ #line 176 "hpricot_scan.rl"
98
122
 
99
123
 
100
- #line 101 "hpricot_scan.c"
124
+
125
+ #line 126 "hpricot_scan.c"
101
126
  static const int hpricot_scan_start = 204;
102
127
  static const int hpricot_scan_error = -1;
103
128
 
@@ -106,7 +131,8 @@ static const int hpricot_scan_en_html_cdata = 216;
106
131
  static const int hpricot_scan_en_html_procins = 218;
107
132
  static const int hpricot_scan_en_main = 204;
108
133
 
109
- #line 145 "hpricot_scan.rl"
134
+
135
+ #line 179 "hpricot_scan.rl"
110
136
 
111
137
  #define BUFSIZE 16384
112
138
 
@@ -195,33 +221,41 @@ H_ATTR(standalone);
195
221
  H_ATTR(system_id);
196
222
  H_ATTR(public_id);
197
223
 
198
- #define H_ELE(klass) \
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); \
224
+ #define H_ELE(klass) \
225
+ ele = rb_obj_alloc(klass); \
226
+ if (klass == cElem) { \
227
+ H_ELE_SET(ele, H_ELE_TAG, tag); \
228
+ H_ELE_SET(ele, H_ELE_ATTR, attr); \
229
+ H_ELE_SET(ele, H_ELE_EC, ec); \
204
230
  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
- } \
231
+ VALUE raw_str = rb_str_new(raw, rawlen); \
232
+ ASSOCIATE_INDEX(raw_str); \
233
+ H_ELE_SET(ele, H_ELE_RAW, raw_str); \
234
+ } \
207
235
  } 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); \
224
- } \
236
+ if (klass == cBogusETag) { \
237
+ H_ELE_SET(ele, H_ELE_TAG, tag); \
238
+ if (raw != NULL) { \
239
+ VALUE raw_str = rb_str_new(raw, rawlen); \
240
+ ASSOCIATE_INDEX(raw_str); \
241
+ H_ELE_SET(ele, H_ELE_ATTR, raw_str); \
242
+ } \
243
+ } else { \
244
+ if (klass == cDocType) \
245
+ ATTR(ID2SYM(rb_intern("target")), tag); \
246
+ H_ELE_SET(ele, H_ELE_ATTR, attr); \
247
+ if (klass != cProcIns) { \
248
+ tag = Qnil; \
249
+ if (raw != NULL) { \
250
+ tag = rb_str_new(raw, rawlen); \
251
+ ASSOCIATE_INDEX(tag); \
252
+ } \
253
+ } \
254
+ H_ELE_SET(ele, H_ELE_TAG, tag); \
255
+ } \
256
+ } else { \
257
+ H_ELE_SET(ele, H_ELE_TAG, tag); \
258
+ } \
225
259
  S->last = ele
226
260
 
227
261
  //
@@ -229,7 +263,12 @@ H_ATTR(public_id);
229
263
  // in the lexer. this step just pairs up the start and end tags.
230
264
  //
231
265
  void
232
- rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw, int rawlen, int taint)
266
+ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr,
267
+ char *raw, int rawlen, int taint
268
+ #ifdef HAVE_RUBY_ENCODING_H
269
+ , int encoding_index
270
+ #endif
271
+ )
233
272
  {
234
273
  VALUE ele, ec = Qnil;
235
274
 
@@ -251,6 +290,7 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
251
290
  {
252
291
  sym = sym_text;
253
292
  tag = rb_str_new(raw, rawlen);
293
+ ASSOCIATE_INDEX(tag);
254
294
  }
255
295
 
256
296
  if (!NIL_P(ec)) {
@@ -316,6 +356,7 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
316
356
  if (S->strict) {
317
357
  if (NIL_P(rb_hash_aref(S->EC, tag))) {
318
358
  tag = rb_str_new2("div");
359
+ ASSOCIATE_INDEX(tag);
319
360
  }
320
361
  }
321
362
 
@@ -345,8 +386,10 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
345
386
  else
346
387
  {
347
388
  VALUE ele = Qnil;
348
- if (raw != NULL)
389
+ if (raw != NULL) {
349
390
  ele = rb_str_new(raw, rawlen);
391
+ ASSOCIATE_INDEX(ele);
392
+ }
350
393
  H_ELE_SET(match, H_ELE_ETAG, ele);
351
394
  S->focus = H_ELE_GET(match, H_ELE_PARENT);
352
395
  S->last = Qnil;
@@ -360,8 +403,13 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
360
403
  } else if (sym == sym_doctype) {
361
404
  H_ELE(cDocType);
362
405
  if (S->strict) {
363
- rb_hash_aset(attr, ID2SYM(rb_intern("system_id")), rb_str_new2("http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"));
364
- rb_hash_aset(attr, ID2SYM(rb_intern("public_id")), rb_str_new2("-//W3C//DTD XHTML 1.0 Strict//EN"));
406
+ VALUE id;
407
+ id = rb_str_new2("http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
408
+ ASSOCIATE_INDEX(id);
409
+ rb_hash_aset(attr, ID2SYM(rb_intern("system_id")), id);
410
+ id = rb_str_new2("-//W3C//DTD XHTML 1.0 Strict//EN");
411
+ ASSOCIATE_INDEX(id);
412
+ rb_hash_aset(attr, ID2SYM(rb_intern("public_id")), id);
365
413
  }
366
414
  rb_hpricot_add(S->focus, ele);
367
415
  } else if (sym == sym_procins) {
@@ -374,7 +422,7 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
374
422
  }
375
423
  } else if (sym == sym_text) {
376
424
  // TODO: add raw_string as well?
377
- if (!NIL_P(S->last) && RBASIC(S->last)->klass == cText) {
425
+ if (!NIL_P(S->last) && RTEST(rb_obj_is_instance_of(S->last, cText))) {
378
426
  rb_str_append(H_ELE_GET(S->last, H_ELE_TAG), tag);
379
427
  } else {
380
428
  H_ELE(cText);
@@ -396,6 +444,9 @@ VALUE hpricot_scan(int argc, VALUE *argv, VALUE self)
396
444
  VALUE attr = Qnil, tag = Qnil, akey = Qnil, aval = Qnil, bufsize = Qnil;
397
445
  char *mark_tag = 0, *mark_akey = 0, *mark_aval = 0;
398
446
  int done = 0, ele_open = 0, buffer_size = 0, taint = 0;
447
+ #ifdef HAVE_RUBY_ENCODING_H
448
+ int encoding_index = rb_enc_to_index(rb_default_external_encoding());
449
+ #endif
399
450
 
400
451
  rb_scan_args(argc, argv, "11", &port, &opts);
401
452
  taint = OBJ_TAINTED(port);
@@ -444,14 +495,15 @@ VALUE hpricot_scan(int argc, VALUE *argv, VALUE self)
444
495
  buf = ALLOC_N(char, buffer_size);
445
496
 
446
497
 
447
- #line 448 "hpricot_scan.c"
498
+ #line 499 "hpricot_scan.c"
448
499
  {
449
500
  cs = hpricot_scan_start;
450
501
  ts = 0;
451
502
  te = 0;
452
503
  act = 0;
453
504
  }
454
- #line 482 "hpricot_scan.rl"
505
+
506
+ #line 541 "hpricot_scan.rl"
455
507
 
456
508
  while (!done) {
457
509
  VALUE str;
@@ -504,32 +556,32 @@ VALUE hpricot_scan(int argc, VALUE *argv, VALUE self)
504
556
 
505
557
  pe = p + len;
506
558
 
507
- #line 508 "hpricot_scan.c"
559
+ #line 560 "hpricot_scan.c"
508
560
  {
509
561
  if ( p == pe )
510
562
  goto _test_eof;
511
563
  switch ( cs )
512
564
  {
513
565
  tr0:
514
- #line 73 "hpricot_scan.rl"
566
+ #line 73 "hpricot_common.rl"
515
567
  {{p = ((te))-1;}{ TEXT_PASS(); }}
516
568
  goto st204;
517
569
  tr4:
518
- #line 71 "hpricot_scan.rl"
570
+ #line 71 "hpricot_common.rl"
519
571
  {te = p+1;{ {goto st214;} }}
520
572
  goto st204;
521
573
  tr15:
522
- #line 113 "hpricot_scan.rl"
574
+ #line 136 "hpricot_scan.rl"
523
575
  { SET(tag, p); }
524
- #line 66 "hpricot_scan.rl"
576
+ #line 66 "hpricot_common.rl"
525
577
  {te = p+1;{ ELE(doctype); }}
526
578
  goto st204;
527
579
  tr18:
528
- #line 66 "hpricot_scan.rl"
580
+ #line 66 "hpricot_common.rl"
529
581
  {te = p+1;{ ELE(doctype); }}
530
582
  goto st204;
531
583
  tr39:
532
- #line 1 "hpricot_scan.rl"
584
+ #line 1 "NONE"
533
585
  { switch( act ) {
534
586
  case 8:
535
587
  {{p = ((te))-1;} ELE(doctype); }
@@ -543,155 +595,154 @@ tr39:
543
595
  case 15:
544
596
  {{p = ((te))-1;} TEXT_PASS(); }
545
597
  break;
546
- default: break;
547
598
  }
548
599
  }
549
600
  goto st204;
550
601
  tr93:
551
- #line 72 "hpricot_scan.rl"
602
+ #line 72 "hpricot_common.rl"
552
603
  {te = p+1;{ {goto st216;} }}
553
604
  goto st204;
554
605
  tr97:
555
- #line 113 "hpricot_scan.rl"
606
+ #line 136 "hpricot_scan.rl"
556
607
  { SET(tag, p); }
557
- #line 69 "hpricot_scan.rl"
608
+ #line 69 "hpricot_common.rl"
558
609
  {te = p+1;{ ELE(etag); }}
559
610
  goto st204;
560
611
  tr99:
561
- #line 69 "hpricot_scan.rl"
612
+ #line 69 "hpricot_common.rl"
562
613
  {te = p+1;{ ELE(etag); }}
563
614
  goto st204;
564
615
  tr103:
565
- #line 113 "hpricot_scan.rl"
616
+ #line 136 "hpricot_scan.rl"
566
617
  { SET(tag, p); }
567
- #line 68 "hpricot_scan.rl"
618
+ #line 68 "hpricot_common.rl"
568
619
  {te = p+1;{ ELE(stag); }}
569
620
  goto st204;
570
621
  tr107:
571
- #line 68 "hpricot_scan.rl"
622
+ #line 68 "hpricot_common.rl"
572
623
  {te = p+1;{ ELE(stag); }}
573
624
  goto st204;
574
625
  tr112:
575
- #line 120 "hpricot_scan.rl"
626
+ #line 143 "hpricot_scan.rl"
576
627
  { SET(akey, p); }
577
- #line 134 "hpricot_scan.rl"
628
+ #line 168 "hpricot_scan.rl"
578
629
  {
579
- if (!S->xml)
630
+ if (!S->xml && !NIL_P(akey))
580
631
  akey = rb_funcall(akey, s_downcase, 0);
581
632
  ATTR(akey, aval);
582
633
  }
583
- #line 68 "hpricot_scan.rl"
634
+ #line 68 "hpricot_common.rl"
584
635
  {te = p+1;{ ELE(stag); }}
585
636
  goto st204;
586
637
  tr117:
587
- #line 134 "hpricot_scan.rl"
638
+ #line 168 "hpricot_scan.rl"
588
639
  {
589
- if (!S->xml)
640
+ if (!S->xml && !NIL_P(akey))
590
641
  akey = rb_funcall(akey, s_downcase, 0);
591
642
  ATTR(akey, aval);
592
643
  }
593
- #line 68 "hpricot_scan.rl"
644
+ #line 68 "hpricot_common.rl"
594
645
  {te = p+1;{ ELE(stag); }}
595
646
  goto st204;
596
647
  tr118:
597
- #line 70 "hpricot_scan.rl"
648
+ #line 70 "hpricot_common.rl"
598
649
  {te = p+1;{ ELE(emptytag); }}
599
650
  goto st204;
600
651
  tr129:
601
- #line 116 "hpricot_scan.rl"
652
+ #line 139 "hpricot_scan.rl"
602
653
  {
603
654
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
604
655
  else { SET(aval, p); }
605
656
  }
606
- #line 134 "hpricot_scan.rl"
657
+ #line 168 "hpricot_scan.rl"
607
658
  {
608
- if (!S->xml)
659
+ if (!S->xml && !NIL_P(akey))
609
660
  akey = rb_funcall(akey, s_downcase, 0);
610
661
  ATTR(akey, aval);
611
662
  }
612
- #line 68 "hpricot_scan.rl"
663
+ #line 68 "hpricot_common.rl"
613
664
  {te = p+1;{ ELE(stag); }}
614
665
  goto st204;
615
666
  tr133:
616
- #line 134 "hpricot_scan.rl"
667
+ #line 168 "hpricot_scan.rl"
617
668
  {
618
- if (!S->xml)
669
+ if (!S->xml && !NIL_P(akey))
619
670
  akey = rb_funcall(akey, s_downcase, 0);
620
671
  ATTR(akey, aval);
621
672
  }
622
- #line 116 "hpricot_scan.rl"
673
+ #line 139 "hpricot_scan.rl"
623
674
  {
624
675
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
625
676
  else { SET(aval, p); }
626
677
  }
627
- #line 68 "hpricot_scan.rl"
678
+ #line 68 "hpricot_common.rl"
628
679
  {te = p+1;{ ELE(stag); }}
629
680
  goto st204;
630
681
  tr139:
631
- #line 116 "hpricot_scan.rl"
682
+ #line 139 "hpricot_scan.rl"
632
683
  {
633
684
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
634
685
  else { SET(aval, p); }
635
686
  }
636
- #line 120 "hpricot_scan.rl"
687
+ #line 143 "hpricot_scan.rl"
637
688
  { SET(akey, p); }
638
- #line 134 "hpricot_scan.rl"
689
+ #line 168 "hpricot_scan.rl"
639
690
  {
640
- if (!S->xml)
691
+ if (!S->xml && !NIL_P(akey))
641
692
  akey = rb_funcall(akey, s_downcase, 0);
642
693
  ATTR(akey, aval);
643
694
  }
644
- #line 68 "hpricot_scan.rl"
695
+ #line 68 "hpricot_common.rl"
645
696
  {te = p+1;{ ELE(stag); }}
646
697
  goto st204;
647
698
  tr349:
648
- #line 67 "hpricot_scan.rl"
699
+ #line 67 "hpricot_common.rl"
649
700
  {{p = ((te))-1;}{ {goto st218;} }}
650
701
  goto st204;
651
702
  tr363:
652
- #line 65 "hpricot_scan.rl"
703
+ #line 65 "hpricot_common.rl"
653
704
  {te = p+1;{ ELE(xmldecl); }}
654
705
  goto st204;
655
706
  tr411:
656
- #line 73 "hpricot_scan.rl"
707
+ #line 73 "hpricot_common.rl"
657
708
  {te = p+1;{ TEXT_PASS(); }}
658
709
  goto st204;
659
710
  tr412:
660
- #line 9 "hpricot_scan.rl"
711
+ #line 9 "hpricot_common.rl"
661
712
  {curline += 1;}
662
- #line 73 "hpricot_scan.rl"
713
+ #line 73 "hpricot_common.rl"
663
714
  {te = p+1;{ TEXT_PASS(); }}
664
715
  goto st204;
665
716
  tr414:
666
- #line 73 "hpricot_scan.rl"
717
+ #line 73 "hpricot_common.rl"
667
718
  {te = p;p--;{ TEXT_PASS(); }}
668
719
  goto st204;
669
720
  tr419:
670
- #line 66 "hpricot_scan.rl"
721
+ #line 66 "hpricot_common.rl"
671
722
  {te = p;p--;{ ELE(doctype); }}
672
723
  goto st204;
673
724
  tr420:
674
- #line 67 "hpricot_scan.rl"
725
+ #line 67 "hpricot_common.rl"
675
726
  {te = p;p--;{ {goto st218;} }}
676
727
  goto st204;
677
728
  st204:
678
- #line 1 "hpricot_scan.rl"
729
+ #line 1 "NONE"
679
730
  {ts = 0;}
680
731
  if ( ++p == pe )
681
732
  goto _test_eof204;
682
733
  case 204:
683
- #line 1 "hpricot_scan.rl"
734
+ #line 1 "NONE"
684
735
  {ts = p;}
685
- #line 686 "hpricot_scan.c"
736
+ #line 737 "hpricot_scan.c"
686
737
  switch( (*p) ) {
687
738
  case 10: goto tr412;
688
739
  case 60: goto tr413;
689
740
  }
690
741
  goto tr411;
691
742
  tr413:
692
- #line 1 "hpricot_scan.rl"
743
+ #line 1 "NONE"
693
744
  {te = p+1;}
694
- #line 98 "hpricot_scan.rl"
745
+ #line 121 "hpricot_scan.rl"
695
746
  {
696
747
  if (text == 1) {
697
748
  CAT(tag, p);
@@ -703,14 +754,14 @@ tr413:
703
754
  mark_tag = NULL;
704
755
  ele_open = 1;
705
756
  }
706
- #line 73 "hpricot_scan.rl"
757
+ #line 73 "hpricot_common.rl"
707
758
  {act = 15;}
708
759
  goto st205;
709
760
  st205:
710
761
  if ( ++p == pe )
711
762
  goto _test_eof205;
712
763
  case 205:
713
- #line 714 "hpricot_scan.c"
764
+ #line 765 "hpricot_scan.c"
714
765
  switch( (*p) ) {
715
766
  case 33: goto st0;
716
767
  case 47: goto st59;
@@ -811,14 +862,14 @@ case 9:
811
862
  goto tr12;
812
863
  goto tr0;
813
864
  tr12:
814
- #line 110 "hpricot_scan.rl"
865
+ #line 133 "hpricot_scan.rl"
815
866
  { mark_tag = p; }
816
867
  goto st10;
817
868
  st10:
818
869
  if ( ++p == pe )
819
870
  goto _test_eof10;
820
871
  case 10:
821
- #line 822 "hpricot_scan.c"
872
+ #line 873 "hpricot_scan.c"
822
873
  switch( (*p) ) {
823
874
  case 32: goto tr13;
824
875
  case 62: goto tr15;
@@ -842,14 +893,14 @@ case 10:
842
893
  goto st10;
843
894
  goto tr0;
844
895
  tr13:
845
- #line 113 "hpricot_scan.rl"
896
+ #line 136 "hpricot_scan.rl"
846
897
  { SET(tag, p); }
847
898
  goto st11;
848
899
  st11:
849
900
  if ( ++p == pe )
850
901
  goto _test_eof11;
851
902
  case 11:
852
- #line 853 "hpricot_scan.c"
903
+ #line 904 "hpricot_scan.c"
853
904
  switch( (*p) ) {
854
905
  case 32: goto st11;
855
906
  case 62: goto tr18;
@@ -939,14 +990,14 @@ case 19:
939
990
  goto tr30;
940
991
  goto tr0;
941
992
  tr30:
942
- #line 111 "hpricot_scan.rl"
993
+ #line 134 "hpricot_scan.rl"
943
994
  { mark_aval = p; }
944
995
  goto st20;
945
996
  st20:
946
997
  if ( ++p == pe )
947
998
  goto _test_eof20;
948
999
  case 20:
949
- #line 950 "hpricot_scan.c"
1000
+ #line 1001 "hpricot_scan.c"
950
1001
  switch( (*p) ) {
951
1002
  case 9: goto st20;
952
1003
  case 34: goto tr33;
@@ -966,20 +1017,20 @@ case 20:
966
1017
  goto st20;
967
1018
  goto tr0;
968
1019
  tr31:
969
- #line 111 "hpricot_scan.rl"
1020
+ #line 134 "hpricot_scan.rl"
970
1021
  { mark_aval = p; }
971
- #line 124 "hpricot_scan.rl"
1022
+ #line 158 "hpricot_scan.rl"
972
1023
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
973
1024
  goto st21;
974
1025
  tr33:
975
- #line 124 "hpricot_scan.rl"
1026
+ #line 158 "hpricot_scan.rl"
976
1027
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
977
1028
  goto st21;
978
1029
  st21:
979
1030
  if ( ++p == pe )
980
1031
  goto _test_eof21;
981
1032
  case 21:
982
- #line 983 "hpricot_scan.c"
1033
+ #line 1034 "hpricot_scan.c"
983
1034
  switch( (*p) ) {
984
1035
  case 32: goto st22;
985
1036
  case 62: goto tr18;
@@ -1010,32 +1061,32 @@ case 23:
1010
1061
  goto tr38;
1011
1062
  goto tr37;
1012
1063
  tr37:
1013
- #line 111 "hpricot_scan.rl"
1064
+ #line 134 "hpricot_scan.rl"
1014
1065
  { mark_aval = p; }
1015
1066
  goto st24;
1016
1067
  st24:
1017
1068
  if ( ++p == pe )
1018
1069
  goto _test_eof24;
1019
1070
  case 24:
1020
- #line 1021 "hpricot_scan.c"
1071
+ #line 1072 "hpricot_scan.c"
1021
1072
  if ( (*p) == 34 )
1022
1073
  goto tr41;
1023
1074
  goto st24;
1024
1075
  tr38:
1025
- #line 111 "hpricot_scan.rl"
1076
+ #line 134 "hpricot_scan.rl"
1026
1077
  { mark_aval = p; }
1027
- #line 125 "hpricot_scan.rl"
1078
+ #line 159 "hpricot_scan.rl"
1028
1079
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1029
1080
  goto st25;
1030
1081
  tr41:
1031
- #line 125 "hpricot_scan.rl"
1082
+ #line 159 "hpricot_scan.rl"
1032
1083
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1033
1084
  goto st25;
1034
1085
  st25:
1035
1086
  if ( ++p == pe )
1036
1087
  goto _test_eof25;
1037
1088
  case 25:
1038
- #line 1039 "hpricot_scan.c"
1089
+ #line 1090 "hpricot_scan.c"
1039
1090
  switch( (*p) ) {
1040
1091
  case 32: goto st25;
1041
1092
  case 62: goto tr18;
@@ -1045,14 +1096,14 @@ case 25:
1045
1096
  goto st25;
1046
1097
  goto tr39;
1047
1098
  tr16:
1048
- #line 113 "hpricot_scan.rl"
1099
+ #line 136 "hpricot_scan.rl"
1049
1100
  { SET(tag, p); }
1050
1101
  goto st26;
1051
1102
  st26:
1052
1103
  if ( ++p == pe )
1053
1104
  goto _test_eof26;
1054
1105
  case 26:
1055
- #line 1056 "hpricot_scan.c"
1106
+ #line 1107 "hpricot_scan.c"
1056
1107
  if ( (*p) == 93 )
1057
1108
  goto st27;
1058
1109
  goto st26;
@@ -1075,14 +1126,14 @@ case 28:
1075
1126
  goto tr38;
1076
1127
  goto tr44;
1077
1128
  tr44:
1078
- #line 111 "hpricot_scan.rl"
1129
+ #line 134 "hpricot_scan.rl"
1079
1130
  { mark_aval = p; }
1080
1131
  goto st29;
1081
1132
  st29:
1082
1133
  if ( ++p == pe )
1083
1134
  goto _test_eof29;
1084
1135
  case 29:
1085
- #line 1086 "hpricot_scan.c"
1136
+ #line 1137 "hpricot_scan.c"
1086
1137
  if ( (*p) == 39 )
1087
1138
  goto tr41;
1088
1139
  goto st29;
@@ -1112,14 +1163,14 @@ case 30:
1112
1163
  goto tr46;
1113
1164
  goto tr0;
1114
1165
  tr46:
1115
- #line 111 "hpricot_scan.rl"
1166
+ #line 134 "hpricot_scan.rl"
1116
1167
  { mark_aval = p; }
1117
1168
  goto st31;
1118
1169
  st31:
1119
1170
  if ( ++p == pe )
1120
1171
  goto _test_eof31;
1121
1172
  case 31:
1122
- #line 1123 "hpricot_scan.c"
1173
+ #line 1174 "hpricot_scan.c"
1123
1174
  switch( (*p) ) {
1124
1175
  case 9: goto st31;
1125
1176
  case 39: goto tr49;
@@ -1142,34 +1193,34 @@ case 31:
1142
1193
  goto st31;
1143
1194
  goto tr0;
1144
1195
  tr47:
1145
- #line 111 "hpricot_scan.rl"
1196
+ #line 134 "hpricot_scan.rl"
1146
1197
  { mark_aval = p; }
1147
- #line 124 "hpricot_scan.rl"
1198
+ #line 158 "hpricot_scan.rl"
1148
1199
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
1149
1200
  goto st32;
1150
1201
  tr49:
1151
- #line 124 "hpricot_scan.rl"
1202
+ #line 158 "hpricot_scan.rl"
1152
1203
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
1153
1204
  goto st32;
1154
1205
  tr55:
1155
- #line 124 "hpricot_scan.rl"
1206
+ #line 158 "hpricot_scan.rl"
1156
1207
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
1157
- #line 111 "hpricot_scan.rl"
1208
+ #line 134 "hpricot_scan.rl"
1158
1209
  { mark_aval = p; }
1159
- #line 125 "hpricot_scan.rl"
1210
+ #line 159 "hpricot_scan.rl"
1160
1211
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1161
1212
  goto st32;
1162
1213
  tr82:
1163
- #line 124 "hpricot_scan.rl"
1214
+ #line 158 "hpricot_scan.rl"
1164
1215
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
1165
- #line 125 "hpricot_scan.rl"
1216
+ #line 159 "hpricot_scan.rl"
1166
1217
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1167
1218
  goto st32;
1168
1219
  st32:
1169
1220
  if ( ++p == pe )
1170
1221
  goto _test_eof32;
1171
1222
  case 32:
1172
- #line 1173 "hpricot_scan.c"
1223
+ #line 1224 "hpricot_scan.c"
1173
1224
  switch( (*p) ) {
1174
1225
  case 9: goto st33;
1175
1226
  case 32: goto st33;
@@ -1223,20 +1274,20 @@ case 33:
1223
1274
  goto st31;
1224
1275
  goto tr0;
1225
1276
  tr51:
1226
- #line 124 "hpricot_scan.rl"
1277
+ #line 158 "hpricot_scan.rl"
1227
1278
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
1228
1279
  goto st34;
1229
1280
  tr62:
1230
- #line 124 "hpricot_scan.rl"
1281
+ #line 158 "hpricot_scan.rl"
1231
1282
  { SET(aval, p); ATTR(ID2SYM(rb_intern("public_id")), aval); }
1232
- #line 125 "hpricot_scan.rl"
1283
+ #line 159 "hpricot_scan.rl"
1233
1284
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1234
1285
  goto st34;
1235
1286
  st34:
1236
1287
  if ( ++p == pe )
1237
1288
  goto _test_eof34;
1238
1289
  case 34:
1239
- #line 1240 "hpricot_scan.c"
1290
+ #line 1291 "hpricot_scan.c"
1240
1291
  switch( (*p) ) {
1241
1292
  case 9: goto tr52;
1242
1293
  case 32: goto tr52;
@@ -1262,14 +1313,14 @@ case 34:
1262
1313
  goto tr54;
1263
1314
  goto tr44;
1264
1315
  tr52:
1265
- #line 111 "hpricot_scan.rl"
1316
+ #line 134 "hpricot_scan.rl"
1266
1317
  { mark_aval = p; }
1267
1318
  goto st35;
1268
1319
  st35:
1269
1320
  if ( ++p == pe )
1270
1321
  goto _test_eof35;
1271
1322
  case 35:
1272
- #line 1273 "hpricot_scan.c"
1323
+ #line 1324 "hpricot_scan.c"
1273
1324
  switch( (*p) ) {
1274
1325
  case 9: goto st35;
1275
1326
  case 32: goto st35;
@@ -1295,14 +1346,14 @@ case 35:
1295
1346
  goto st47;
1296
1347
  goto st29;
1297
1348
  tr53:
1298
- #line 111 "hpricot_scan.rl"
1349
+ #line 134 "hpricot_scan.rl"
1299
1350
  { mark_aval = p; }
1300
1351
  goto st36;
1301
1352
  st36:
1302
1353
  if ( ++p == pe )
1303
1354
  goto _test_eof36;
1304
1355
  case 36:
1305
- #line 1306 "hpricot_scan.c"
1356
+ #line 1357 "hpricot_scan.c"
1306
1357
  switch( (*p) ) {
1307
1358
  case 32: goto st36;
1308
1359
  case 34: goto st37;
@@ -1323,38 +1374,38 @@ case 37:
1323
1374
  }
1324
1375
  goto tr66;
1325
1376
  tr66:
1326
- #line 111 "hpricot_scan.rl"
1377
+ #line 134 "hpricot_scan.rl"
1327
1378
  { mark_aval = p; }
1328
1379
  goto st38;
1329
1380
  st38:
1330
1381
  if ( ++p == pe )
1331
1382
  goto _test_eof38;
1332
1383
  case 38:
1333
- #line 1334 "hpricot_scan.c"
1384
+ #line 1385 "hpricot_scan.c"
1334
1385
  switch( (*p) ) {
1335
1386
  case 34: goto tr70;
1336
1387
  case 39: goto tr71;
1337
1388
  }
1338
1389
  goto st38;
1339
1390
  tr81:
1340
- #line 111 "hpricot_scan.rl"
1391
+ #line 134 "hpricot_scan.rl"
1341
1392
  { mark_aval = p; }
1342
1393
  goto st39;
1343
1394
  tr67:
1344
- #line 111 "hpricot_scan.rl"
1395
+ #line 134 "hpricot_scan.rl"
1345
1396
  { mark_aval = p; }
1346
- #line 125 "hpricot_scan.rl"
1397
+ #line 159 "hpricot_scan.rl"
1347
1398
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1348
1399
  goto st39;
1349
1400
  tr70:
1350
- #line 125 "hpricot_scan.rl"
1401
+ #line 159 "hpricot_scan.rl"
1351
1402
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1352
1403
  goto st39;
1353
1404
  st39:
1354
1405
  if ( ++p == pe )
1355
1406
  goto _test_eof39;
1356
1407
  case 39:
1357
- #line 1358 "hpricot_scan.c"
1408
+ #line 1409 "hpricot_scan.c"
1358
1409
  switch( (*p) ) {
1359
1410
  case 32: goto st39;
1360
1411
  case 39: goto tr41;
@@ -1365,50 +1416,50 @@ case 39:
1365
1416
  goto st39;
1366
1417
  goto st29;
1367
1418
  tr56:
1368
- #line 1 "hpricot_scan.rl"
1419
+ #line 1 "NONE"
1369
1420
  {te = p+1;}
1370
- #line 111 "hpricot_scan.rl"
1421
+ #line 134 "hpricot_scan.rl"
1371
1422
  { mark_aval = p; }
1372
- #line 66 "hpricot_scan.rl"
1423
+ #line 66 "hpricot_common.rl"
1373
1424
  {act = 8;}
1374
1425
  goto st206;
1375
1426
  tr63:
1376
- #line 1 "hpricot_scan.rl"
1427
+ #line 1 "NONE"
1377
1428
  {te = p+1;}
1378
- #line 66 "hpricot_scan.rl"
1429
+ #line 66 "hpricot_common.rl"
1379
1430
  {act = 8;}
1380
1431
  goto st206;
1381
1432
  st206:
1382
1433
  if ( ++p == pe )
1383
1434
  goto _test_eof206;
1384
1435
  case 206:
1385
- #line 1386 "hpricot_scan.c"
1436
+ #line 1437 "hpricot_scan.c"
1386
1437
  if ( (*p) == 39 )
1387
1438
  goto tr41;
1388
1439
  goto st29;
1389
1440
  tr57:
1390
- #line 111 "hpricot_scan.rl"
1441
+ #line 134 "hpricot_scan.rl"
1391
1442
  { mark_aval = p; }
1392
1443
  goto st40;
1393
1444
  st40:
1394
1445
  if ( ++p == pe )
1395
1446
  goto _test_eof40;
1396
1447
  case 40:
1397
- #line 1398 "hpricot_scan.c"
1448
+ #line 1449 "hpricot_scan.c"
1398
1449
  switch( (*p) ) {
1399
1450
  case 39: goto tr73;
1400
1451
  case 93: goto st42;
1401
1452
  }
1402
1453
  goto st40;
1403
1454
  tr73:
1404
- #line 125 "hpricot_scan.rl"
1455
+ #line 159 "hpricot_scan.rl"
1405
1456
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1406
1457
  goto st41;
1407
1458
  st41:
1408
1459
  if ( ++p == pe )
1409
1460
  goto _test_eof41;
1410
1461
  case 41:
1411
- #line 1412 "hpricot_scan.c"
1462
+ #line 1463 "hpricot_scan.c"
1412
1463
  switch( (*p) ) {
1413
1464
  case 32: goto st41;
1414
1465
  case 62: goto tr76;
@@ -1418,16 +1469,16 @@ case 41:
1418
1469
  goto st41;
1419
1470
  goto st26;
1420
1471
  tr76:
1421
- #line 1 "hpricot_scan.rl"
1472
+ #line 1 "NONE"
1422
1473
  {te = p+1;}
1423
- #line 66 "hpricot_scan.rl"
1474
+ #line 66 "hpricot_common.rl"
1424
1475
  {act = 8;}
1425
1476
  goto st207;
1426
1477
  st207:
1427
1478
  if ( ++p == pe )
1428
1479
  goto _test_eof207;
1429
1480
  case 207:
1430
- #line 1431 "hpricot_scan.c"
1481
+ #line 1482 "hpricot_scan.c"
1431
1482
  if ( (*p) == 93 )
1432
1483
  goto st27;
1433
1484
  goto st26;
@@ -1444,20 +1495,20 @@ case 42:
1444
1495
  goto st42;
1445
1496
  goto st29;
1446
1497
  tr68:
1447
- #line 111 "hpricot_scan.rl"
1498
+ #line 134 "hpricot_scan.rl"
1448
1499
  { mark_aval = p; }
1449
- #line 125 "hpricot_scan.rl"
1500
+ #line 159 "hpricot_scan.rl"
1450
1501
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1451
1502
  goto st43;
1452
1503
  tr71:
1453
- #line 125 "hpricot_scan.rl"
1504
+ #line 159 "hpricot_scan.rl"
1454
1505
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1455
1506
  goto st43;
1456
1507
  st43:
1457
1508
  if ( ++p == pe )
1458
1509
  goto _test_eof43;
1459
1510
  case 43:
1460
- #line 1461 "hpricot_scan.c"
1511
+ #line 1512 "hpricot_scan.c"
1461
1512
  switch( (*p) ) {
1462
1513
  case 32: goto st43;
1463
1514
  case 34: goto tr41;
@@ -1468,16 +1519,16 @@ case 43:
1468
1519
  goto st43;
1469
1520
  goto st24;
1470
1521
  tr78:
1471
- #line 1 "hpricot_scan.rl"
1522
+ #line 1 "NONE"
1472
1523
  {te = p+1;}
1473
- #line 66 "hpricot_scan.rl"
1524
+ #line 66 "hpricot_common.rl"
1474
1525
  {act = 8;}
1475
1526
  goto st208;
1476
1527
  st208:
1477
1528
  if ( ++p == pe )
1478
1529
  goto _test_eof208;
1479
1530
  case 208:
1480
- #line 1481 "hpricot_scan.c"
1531
+ #line 1532 "hpricot_scan.c"
1481
1532
  if ( (*p) == 34 )
1482
1533
  goto tr41;
1483
1534
  goto st24;
@@ -1503,14 +1554,14 @@ case 45:
1503
1554
  goto st45;
1504
1555
  goto st24;
1505
1556
  tr65:
1506
- #line 125 "hpricot_scan.rl"
1557
+ #line 159 "hpricot_scan.rl"
1507
1558
  { SET(aval, p); ATTR(ID2SYM(rb_intern("system_id")), aval); }
1508
1559
  goto st46;
1509
1560
  st46:
1510
1561
  if ( ++p == pe )
1511
1562
  goto _test_eof46;
1512
1563
  case 46:
1513
- #line 1514 "hpricot_scan.c"
1564
+ #line 1565 "hpricot_scan.c"
1514
1565
  switch( (*p) ) {
1515
1566
  case 32: goto tr81;
1516
1567
  case 39: goto tr38;
@@ -1521,14 +1572,14 @@ case 46:
1521
1572
  goto tr81;
1522
1573
  goto tr44;
1523
1574
  tr54:
1524
- #line 111 "hpricot_scan.rl"
1575
+ #line 134 "hpricot_scan.rl"
1525
1576
  { mark_aval = p; }
1526
1577
  goto st47;
1527
1578
  st47:
1528
1579
  if ( ++p == pe )
1529
1580
  goto _test_eof47;
1530
1581
  case 47:
1531
- #line 1532 "hpricot_scan.c"
1582
+ #line 1583 "hpricot_scan.c"
1532
1583
  switch( (*p) ) {
1533
1584
  case 9: goto st47;
1534
1585
  case 39: goto tr82;
@@ -1642,14 +1693,14 @@ case 59:
1642
1693
  goto tr94;
1643
1694
  goto tr0;
1644
1695
  tr94:
1645
- #line 110 "hpricot_scan.rl"
1696
+ #line 133 "hpricot_scan.rl"
1646
1697
  { mark_tag = p; }
1647
1698
  goto st60;
1648
1699
  st60:
1649
1700
  if ( ++p == pe )
1650
1701
  goto _test_eof60;
1651
1702
  case 60:
1652
- #line 1653 "hpricot_scan.c"
1703
+ #line 1704 "hpricot_scan.c"
1653
1704
  switch( (*p) ) {
1654
1705
  case 32: goto tr95;
1655
1706
  case 62: goto tr97;
@@ -1672,14 +1723,14 @@ case 60:
1672
1723
  goto st60;
1673
1724
  goto tr0;
1674
1725
  tr95:
1675
- #line 113 "hpricot_scan.rl"
1726
+ #line 136 "hpricot_scan.rl"
1676
1727
  { SET(tag, p); }
1677
1728
  goto st61;
1678
1729
  st61:
1679
1730
  if ( ++p == pe )
1680
1731
  goto _test_eof61;
1681
1732
  case 61:
1682
- #line 1683 "hpricot_scan.c"
1733
+ #line 1734 "hpricot_scan.c"
1683
1734
  switch( (*p) ) {
1684
1735
  case 32: goto st61;
1685
1736
  case 62: goto tr99;
@@ -1688,14 +1739,14 @@ case 61:
1688
1739
  goto st61;
1689
1740
  goto tr0;
1690
1741
  tr417:
1691
- #line 110 "hpricot_scan.rl"
1742
+ #line 133 "hpricot_scan.rl"
1692
1743
  { mark_tag = p; }
1693
1744
  goto st62;
1694
1745
  st62:
1695
1746
  if ( ++p == pe )
1696
1747
  goto _test_eof62;
1697
1748
  case 62:
1698
- #line 1699 "hpricot_scan.c"
1749
+ #line 1750 "hpricot_scan.c"
1699
1750
  switch( (*p) ) {
1700
1751
  case 32: goto tr100;
1701
1752
  case 47: goto tr102;
@@ -1716,14 +1767,14 @@ case 62:
1716
1767
  goto st62;
1717
1768
  goto tr0;
1718
1769
  tr100:
1719
- #line 113 "hpricot_scan.rl"
1770
+ #line 136 "hpricot_scan.rl"
1720
1771
  { SET(tag, p); }
1721
1772
  goto st63;
1722
1773
  st63:
1723
1774
  if ( ++p == pe )
1724
1775
  goto _test_eof63;
1725
1776
  case 63:
1726
- #line 1727 "hpricot_scan.c"
1777
+ #line 1778 "hpricot_scan.c"
1727
1778
  switch( (*p) ) {
1728
1779
  case 32: goto st63;
1729
1780
  case 47: goto st66;
@@ -1744,38 +1795,38 @@ case 63:
1744
1795
  goto tr105;
1745
1796
  goto tr0;
1746
1797
  tr105:
1747
- #line 127 "hpricot_scan.rl"
1798
+ #line 161 "hpricot_scan.rl"
1748
1799
  {
1749
1800
  akey = Qnil;
1750
1801
  aval = Qnil;
1751
1802
  mark_akey = NULL;
1752
1803
  mark_aval = NULL;
1753
1804
  }
1754
- #line 112 "hpricot_scan.rl"
1805
+ #line 135 "hpricot_scan.rl"
1755
1806
  { mark_akey = p; }
1756
1807
  goto st64;
1757
1808
  tr114:
1758
- #line 134 "hpricot_scan.rl"
1809
+ #line 168 "hpricot_scan.rl"
1759
1810
  {
1760
- if (!S->xml)
1811
+ if (!S->xml && !NIL_P(akey))
1761
1812
  akey = rb_funcall(akey, s_downcase, 0);
1762
1813
  ATTR(akey, aval);
1763
1814
  }
1764
- #line 127 "hpricot_scan.rl"
1815
+ #line 161 "hpricot_scan.rl"
1765
1816
  {
1766
1817
  akey = Qnil;
1767
1818
  aval = Qnil;
1768
1819
  mark_akey = NULL;
1769
1820
  mark_aval = NULL;
1770
1821
  }
1771
- #line 112 "hpricot_scan.rl"
1822
+ #line 135 "hpricot_scan.rl"
1772
1823
  { mark_akey = p; }
1773
1824
  goto st64;
1774
1825
  st64:
1775
1826
  if ( ++p == pe )
1776
1827
  goto _test_eof64;
1777
1828
  case 64:
1778
- #line 1779 "hpricot_scan.c"
1829
+ #line 1830 "hpricot_scan.c"
1779
1830
  switch( (*p) ) {
1780
1831
  case 32: goto tr108;
1781
1832
  case 47: goto tr110;
@@ -1797,20 +1848,20 @@ case 64:
1797
1848
  goto st64;
1798
1849
  goto tr39;
1799
1850
  tr108:
1800
- #line 120 "hpricot_scan.rl"
1851
+ #line 143 "hpricot_scan.rl"
1801
1852
  { SET(akey, p); }
1802
1853
  goto st65;
1803
1854
  tr140:
1804
- #line 116 "hpricot_scan.rl"
1855
+ #line 139 "hpricot_scan.rl"
1805
1856
  {
1806
1857
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
1807
1858
  else { SET(aval, p); }
1808
1859
  }
1809
1860
  goto st65;
1810
1861
  tr134:
1811
- #line 120 "hpricot_scan.rl"
1862
+ #line 143 "hpricot_scan.rl"
1812
1863
  { SET(akey, p); }
1813
- #line 116 "hpricot_scan.rl"
1864
+ #line 139 "hpricot_scan.rl"
1814
1865
  {
1815
1866
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
1816
1867
  else { SET(aval, p); }
@@ -1820,7 +1871,7 @@ st65:
1820
1871
  if ( ++p == pe )
1821
1872
  goto _test_eof65;
1822
1873
  case 65:
1823
- #line 1824 "hpricot_scan.c"
1874
+ #line 1875 "hpricot_scan.c"
1824
1875
  switch( (*p) ) {
1825
1876
  case 32: goto st65;
1826
1877
  case 47: goto tr115;
@@ -1842,23 +1893,23 @@ case 65:
1842
1893
  goto tr114;
1843
1894
  goto tr39;
1844
1895
  tr102:
1845
- #line 113 "hpricot_scan.rl"
1896
+ #line 136 "hpricot_scan.rl"
1846
1897
  { SET(tag, p); }
1847
1898
  goto st66;
1848
1899
  tr110:
1849
- #line 120 "hpricot_scan.rl"
1900
+ #line 143 "hpricot_scan.rl"
1850
1901
  { SET(akey, p); }
1851
- #line 134 "hpricot_scan.rl"
1902
+ #line 168 "hpricot_scan.rl"
1852
1903
  {
1853
- if (!S->xml)
1904
+ if (!S->xml && !NIL_P(akey))
1854
1905
  akey = rb_funcall(akey, s_downcase, 0);
1855
1906
  ATTR(akey, aval);
1856
1907
  }
1857
1908
  goto st66;
1858
1909
  tr115:
1859
- #line 134 "hpricot_scan.rl"
1910
+ #line 168 "hpricot_scan.rl"
1860
1911
  {
1861
- if (!S->xml)
1912
+ if (!S->xml && !NIL_P(akey))
1862
1913
  akey = rb_funcall(akey, s_downcase, 0);
1863
1914
  ATTR(akey, aval);
1864
1915
  }
@@ -1867,19 +1918,19 @@ st66:
1867
1918
  if ( ++p == pe )
1868
1919
  goto _test_eof66;
1869
1920
  case 66:
1870
- #line 1871 "hpricot_scan.c"
1921
+ #line 1922 "hpricot_scan.c"
1871
1922
  if ( (*p) == 62 )
1872
1923
  goto tr118;
1873
1924
  goto tr39;
1874
1925
  tr111:
1875
- #line 120 "hpricot_scan.rl"
1926
+ #line 143 "hpricot_scan.rl"
1876
1927
  { SET(akey, p); }
1877
1928
  goto st67;
1878
1929
  st67:
1879
1930
  if ( ++p == pe )
1880
1931
  goto _test_eof67;
1881
1932
  case 67:
1882
- #line 1883 "hpricot_scan.c"
1933
+ #line 1934 "hpricot_scan.c"
1883
1934
  switch( (*p) ) {
1884
1935
  case 13: goto tr120;
1885
1936
  case 32: goto tr120;
@@ -1896,14 +1947,14 @@ case 67:
1896
1947
  goto tr120;
1897
1948
  goto tr119;
1898
1949
  tr119:
1899
- #line 111 "hpricot_scan.rl"
1950
+ #line 134 "hpricot_scan.rl"
1900
1951
  { mark_aval = p; }
1901
1952
  goto st68;
1902
1953
  st68:
1903
1954
  if ( ++p == pe )
1904
1955
  goto _test_eof68;
1905
1956
  case 68:
1906
- #line 1907 "hpricot_scan.c"
1957
+ #line 1958 "hpricot_scan.c"
1907
1958
  switch( (*p) ) {
1908
1959
  case 13: goto tr126;
1909
1960
  case 32: goto tr126;
@@ -1918,27 +1969,27 @@ case 68:
1918
1969
  goto tr126;
1919
1970
  goto st68;
1920
1971
  tr126:
1921
- #line 116 "hpricot_scan.rl"
1972
+ #line 139 "hpricot_scan.rl"
1922
1973
  {
1923
1974
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
1924
1975
  else { SET(aval, p); }
1925
1976
  }
1926
1977
  goto st69;
1927
1978
  tr331:
1928
- #line 111 "hpricot_scan.rl"
1979
+ #line 134 "hpricot_scan.rl"
1929
1980
  { mark_aval = p; }
1930
- #line 115 "hpricot_scan.rl"
1981
+ #line 138 "hpricot_scan.rl"
1931
1982
  { SET(aval, p); }
1932
1983
  goto st69;
1933
1984
  tr169:
1934
- #line 115 "hpricot_scan.rl"
1985
+ #line 138 "hpricot_scan.rl"
1935
1986
  { SET(aval, p); }
1936
1987
  goto st69;
1937
1988
  st69:
1938
1989
  if ( ++p == pe )
1939
1990
  goto _test_eof69;
1940
1991
  case 69:
1941
- #line 1942 "hpricot_scan.c"
1992
+ #line 1993 "hpricot_scan.c"
1942
1993
  switch( (*p) ) {
1943
1994
  case 32: goto st69;
1944
1995
  case 47: goto tr115;
@@ -1959,27 +2010,27 @@ case 69:
1959
2010
  goto tr114;
1960
2011
  goto tr39;
1961
2012
  tr127:
1962
- #line 116 "hpricot_scan.rl"
2013
+ #line 139 "hpricot_scan.rl"
1963
2014
  {
1964
2015
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
1965
2016
  else { SET(aval, p); }
1966
2017
  }
1967
2018
  goto st70;
1968
2019
  tr155:
1969
- #line 111 "hpricot_scan.rl"
2020
+ #line 134 "hpricot_scan.rl"
1970
2021
  { mark_aval = p; }
1971
- #line 115 "hpricot_scan.rl"
2022
+ #line 138 "hpricot_scan.rl"
1972
2023
  { SET(aval, p); }
1973
2024
  goto st70;
1974
2025
  tr163:
1975
- #line 115 "hpricot_scan.rl"
2026
+ #line 138 "hpricot_scan.rl"
1976
2027
  { SET(aval, p); }
1977
2028
  goto st70;
1978
2029
  st70:
1979
2030
  if ( ++p == pe )
1980
2031
  goto _test_eof70;
1981
2032
  case 70:
1982
- #line 1983 "hpricot_scan.c"
2033
+ #line 2034 "hpricot_scan.c"
1983
2034
  switch( (*p) ) {
1984
2035
  case 13: goto tr126;
1985
2036
  case 32: goto tr126;
@@ -2005,46 +2056,46 @@ case 70:
2005
2056
  goto tr131;
2006
2057
  goto st68;
2007
2058
  tr131:
2008
- #line 134 "hpricot_scan.rl"
2059
+ #line 168 "hpricot_scan.rl"
2009
2060
  {
2010
- if (!S->xml)
2061
+ if (!S->xml && !NIL_P(akey))
2011
2062
  akey = rb_funcall(akey, s_downcase, 0);
2012
2063
  ATTR(akey, aval);
2013
2064
  }
2014
- #line 127 "hpricot_scan.rl"
2065
+ #line 161 "hpricot_scan.rl"
2015
2066
  {
2016
2067
  akey = Qnil;
2017
2068
  aval = Qnil;
2018
2069
  mark_akey = NULL;
2019
2070
  mark_aval = NULL;
2020
2071
  }
2021
- #line 112 "hpricot_scan.rl"
2072
+ #line 135 "hpricot_scan.rl"
2022
2073
  { mark_akey = p; }
2023
2074
  goto st71;
2024
2075
  tr150:
2025
- #line 111 "hpricot_scan.rl"
2026
- { mark_aval = p; }
2027
2076
  #line 134 "hpricot_scan.rl"
2077
+ { mark_aval = p; }
2078
+ #line 168 "hpricot_scan.rl"
2028
2079
  {
2029
- if (!S->xml)
2080
+ if (!S->xml && !NIL_P(akey))
2030
2081
  akey = rb_funcall(akey, s_downcase, 0);
2031
2082
  ATTR(akey, aval);
2032
2083
  }
2033
- #line 127 "hpricot_scan.rl"
2084
+ #line 161 "hpricot_scan.rl"
2034
2085
  {
2035
2086
  akey = Qnil;
2036
2087
  aval = Qnil;
2037
2088
  mark_akey = NULL;
2038
2089
  mark_aval = NULL;
2039
2090
  }
2040
- #line 112 "hpricot_scan.rl"
2091
+ #line 135 "hpricot_scan.rl"
2041
2092
  { mark_akey = p; }
2042
2093
  goto st71;
2043
2094
  st71:
2044
2095
  if ( ++p == pe )
2045
2096
  goto _test_eof71;
2046
2097
  case 71:
2047
- #line 2048 "hpricot_scan.c"
2098
+ #line 2099 "hpricot_scan.c"
2048
2099
  switch( (*p) ) {
2049
2100
  case 13: goto tr134;
2050
2101
  case 32: goto tr134;
@@ -2071,16 +2122,16 @@ case 71:
2071
2122
  goto st71;
2072
2123
  goto st68;
2073
2124
  tr141:
2074
- #line 116 "hpricot_scan.rl"
2125
+ #line 139 "hpricot_scan.rl"
2075
2126
  {
2076
2127
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2077
2128
  else { SET(aval, p); }
2078
2129
  }
2079
2130
  goto st72;
2080
2131
  tr135:
2081
- #line 120 "hpricot_scan.rl"
2132
+ #line 143 "hpricot_scan.rl"
2082
2133
  { SET(akey, p); }
2083
- #line 116 "hpricot_scan.rl"
2134
+ #line 139 "hpricot_scan.rl"
2084
2135
  {
2085
2136
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2086
2137
  else { SET(aval, p); }
@@ -2090,7 +2141,7 @@ st72:
2090
2141
  if ( ++p == pe )
2091
2142
  goto _test_eof72;
2092
2143
  case 72:
2093
- #line 2094 "hpricot_scan.c"
2144
+ #line 2145 "hpricot_scan.c"
2094
2145
  switch( (*p) ) {
2095
2146
  case 13: goto tr140;
2096
2147
  case 32: goto tr140;
@@ -2117,81 +2168,81 @@ case 72:
2117
2168
  goto tr131;
2118
2169
  goto st68;
2119
2170
  tr124:
2120
- #line 111 "hpricot_scan.rl"
2121
- { mark_aval = p; }
2122
2171
  #line 134 "hpricot_scan.rl"
2172
+ { mark_aval = p; }
2173
+ #line 168 "hpricot_scan.rl"
2123
2174
  {
2124
- if (!S->xml)
2175
+ if (!S->xml && !NIL_P(akey))
2125
2176
  akey = rb_funcall(akey, s_downcase, 0);
2126
2177
  ATTR(akey, aval);
2127
2178
  }
2128
2179
  goto st73;
2129
2180
  tr128:
2130
- #line 116 "hpricot_scan.rl"
2181
+ #line 139 "hpricot_scan.rl"
2131
2182
  {
2132
2183
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2133
2184
  else { SET(aval, p); }
2134
2185
  }
2135
- #line 134 "hpricot_scan.rl"
2186
+ #line 168 "hpricot_scan.rl"
2136
2187
  {
2137
- if (!S->xml)
2188
+ if (!S->xml && !NIL_P(akey))
2138
2189
  akey = rb_funcall(akey, s_downcase, 0);
2139
2190
  ATTR(akey, aval);
2140
2191
  }
2141
2192
  goto st73;
2142
2193
  tr132:
2143
- #line 134 "hpricot_scan.rl"
2194
+ #line 168 "hpricot_scan.rl"
2144
2195
  {
2145
- if (!S->xml)
2196
+ if (!S->xml && !NIL_P(akey))
2146
2197
  akey = rb_funcall(akey, s_downcase, 0);
2147
2198
  ATTR(akey, aval);
2148
2199
  }
2149
- #line 116 "hpricot_scan.rl"
2200
+ #line 139 "hpricot_scan.rl"
2150
2201
  {
2151
2202
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2152
2203
  else { SET(aval, p); }
2153
2204
  }
2154
2205
  goto st73;
2155
2206
  tr137:
2156
- #line 116 "hpricot_scan.rl"
2207
+ #line 139 "hpricot_scan.rl"
2157
2208
  {
2158
2209
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2159
2210
  else { SET(aval, p); }
2160
2211
  }
2161
- #line 120 "hpricot_scan.rl"
2212
+ #line 143 "hpricot_scan.rl"
2162
2213
  { SET(akey, p); }
2163
- #line 134 "hpricot_scan.rl"
2214
+ #line 168 "hpricot_scan.rl"
2164
2215
  {
2165
- if (!S->xml)
2216
+ if (!S->xml && !NIL_P(akey))
2166
2217
  akey = rb_funcall(akey, s_downcase, 0);
2167
2218
  ATTR(akey, aval);
2168
2219
  }
2169
2220
  goto st73;
2170
2221
  tr147:
2171
- #line 111 "hpricot_scan.rl"
2222
+ #line 134 "hpricot_scan.rl"
2172
2223
  { mark_aval = p; }
2173
- #line 116 "hpricot_scan.rl"
2224
+ #line 139 "hpricot_scan.rl"
2174
2225
  {
2175
2226
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2176
2227
  else { SET(aval, p); }
2177
2228
  }
2178
- #line 134 "hpricot_scan.rl"
2229
+ #line 168 "hpricot_scan.rl"
2179
2230
  {
2180
- if (!S->xml)
2231
+ if (!S->xml && !NIL_P(akey))
2181
2232
  akey = rb_funcall(akey, s_downcase, 0);
2182
2233
  ATTR(akey, aval);
2183
2234
  }
2184
2235
  goto st73;
2185
2236
  tr151:
2186
- #line 111 "hpricot_scan.rl"
2187
- { mark_aval = p; }
2188
2237
  #line 134 "hpricot_scan.rl"
2238
+ { mark_aval = p; }
2239
+ #line 168 "hpricot_scan.rl"
2189
2240
  {
2190
- if (!S->xml)
2241
+ if (!S->xml && !NIL_P(akey))
2191
2242
  akey = rb_funcall(akey, s_downcase, 0);
2192
2243
  ATTR(akey, aval);
2193
2244
  }
2194
- #line 116 "hpricot_scan.rl"
2245
+ #line 139 "hpricot_scan.rl"
2195
2246
  {
2196
2247
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2197
2248
  else { SET(aval, p); }
@@ -2201,7 +2252,7 @@ st73:
2201
2252
  if ( ++p == pe )
2202
2253
  goto _test_eof73;
2203
2254
  case 73:
2204
- #line 2205 "hpricot_scan.c"
2255
+ #line 2256 "hpricot_scan.c"
2205
2256
  switch( (*p) ) {
2206
2257
  case 13: goto tr126;
2207
2258
  case 32: goto tr126;
@@ -2216,18 +2267,18 @@ case 73:
2216
2267
  goto tr126;
2217
2268
  goto st68;
2218
2269
  tr121:
2219
- #line 111 "hpricot_scan.rl"
2270
+ #line 134 "hpricot_scan.rl"
2220
2271
  { mark_aval = p; }
2221
2272
  goto st74;
2222
2273
  tr138:
2223
- #line 120 "hpricot_scan.rl"
2274
+ #line 143 "hpricot_scan.rl"
2224
2275
  { SET(akey, p); }
2225
2276
  goto st74;
2226
2277
  st74:
2227
2278
  if ( ++p == pe )
2228
2279
  goto _test_eof74;
2229
2280
  case 74:
2230
- #line 2231 "hpricot_scan.c"
2281
+ #line 2282 "hpricot_scan.c"
2231
2282
  switch( (*p) ) {
2232
2283
  case 13: goto tr143;
2233
2284
  case 32: goto tr143;
@@ -2244,13 +2295,13 @@ case 74:
2244
2295
  goto tr143;
2245
2296
  goto tr119;
2246
2297
  tr148:
2247
- #line 111 "hpricot_scan.rl"
2298
+ #line 134 "hpricot_scan.rl"
2248
2299
  { mark_aval = p; }
2249
2300
  goto st75;
2250
2301
  tr143:
2251
- #line 111 "hpricot_scan.rl"
2302
+ #line 134 "hpricot_scan.rl"
2252
2303
  { mark_aval = p; }
2253
- #line 116 "hpricot_scan.rl"
2304
+ #line 139 "hpricot_scan.rl"
2254
2305
  {
2255
2306
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2256
2307
  else { SET(aval, p); }
@@ -2260,7 +2311,7 @@ st75:
2260
2311
  if ( ++p == pe )
2261
2312
  goto _test_eof75;
2262
2313
  case 75:
2263
- #line 2264 "hpricot_scan.c"
2314
+ #line 2315 "hpricot_scan.c"
2264
2315
  switch( (*p) ) {
2265
2316
  case 13: goto tr148;
2266
2317
  case 32: goto tr148;
@@ -2288,13 +2339,13 @@ case 75:
2288
2339
  goto tr150;
2289
2340
  goto tr119;
2290
2341
  tr149:
2291
- #line 111 "hpricot_scan.rl"
2342
+ #line 134 "hpricot_scan.rl"
2292
2343
  { mark_aval = p; }
2293
2344
  goto st76;
2294
2345
  tr144:
2295
- #line 111 "hpricot_scan.rl"
2346
+ #line 134 "hpricot_scan.rl"
2296
2347
  { mark_aval = p; }
2297
- #line 116 "hpricot_scan.rl"
2348
+ #line 139 "hpricot_scan.rl"
2298
2349
  {
2299
2350
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2300
2351
  else { SET(aval, p); }
@@ -2304,7 +2355,7 @@ st76:
2304
2355
  if ( ++p == pe )
2305
2356
  goto _test_eof76;
2306
2357
  case 76:
2307
- #line 2308 "hpricot_scan.c"
2358
+ #line 2359 "hpricot_scan.c"
2308
2359
  switch( (*p) ) {
2309
2360
  case 13: goto tr143;
2310
2361
  case 32: goto tr143;
@@ -2351,14 +2402,14 @@ case 77:
2351
2402
  goto tr153;
2352
2403
  goto tr152;
2353
2404
  tr152:
2354
- #line 111 "hpricot_scan.rl"
2405
+ #line 134 "hpricot_scan.rl"
2355
2406
  { mark_aval = p; }
2356
2407
  goto st78;
2357
2408
  st78:
2358
2409
  if ( ++p == pe )
2359
2410
  goto _test_eof78;
2360
2411
  case 78:
2361
- #line 2362 "hpricot_scan.c"
2412
+ #line 2413 "hpricot_scan.c"
2362
2413
  switch( (*p) ) {
2363
2414
  case 13: goto tr161;
2364
2415
  case 32: goto tr161;
@@ -2375,40 +2426,40 @@ case 78:
2375
2426
  goto tr161;
2376
2427
  goto st78;
2377
2428
  tr336:
2378
- #line 111 "hpricot_scan.rl"
2429
+ #line 134 "hpricot_scan.rl"
2379
2430
  { mark_aval = p; }
2380
2431
  goto st79;
2381
2432
  tr161:
2382
- #line 116 "hpricot_scan.rl"
2433
+ #line 139 "hpricot_scan.rl"
2383
2434
  {
2384
2435
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2385
2436
  else { SET(aval, p); }
2386
2437
  }
2387
2438
  goto st79;
2388
2439
  tr153:
2389
- #line 111 "hpricot_scan.rl"
2440
+ #line 134 "hpricot_scan.rl"
2390
2441
  { mark_aval = p; }
2391
- #line 116 "hpricot_scan.rl"
2442
+ #line 139 "hpricot_scan.rl"
2392
2443
  {
2393
2444
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2394
2445
  else { SET(aval, p); }
2395
2446
  }
2396
2447
  goto st79;
2397
2448
  tr317:
2398
- #line 111 "hpricot_scan.rl"
2449
+ #line 134 "hpricot_scan.rl"
2399
2450
  { mark_aval = p; }
2400
- #line 115 "hpricot_scan.rl"
2451
+ #line 138 "hpricot_scan.rl"
2401
2452
  { SET(aval, p); }
2402
2453
  goto st79;
2403
2454
  tr174:
2404
- #line 115 "hpricot_scan.rl"
2455
+ #line 138 "hpricot_scan.rl"
2405
2456
  { SET(aval, p); }
2406
2457
  goto st79;
2407
2458
  st79:
2408
2459
  if ( ++p == pe )
2409
2460
  goto _test_eof79;
2410
2461
  case 79:
2411
- #line 2412 "hpricot_scan.c"
2462
+ #line 2463 "hpricot_scan.c"
2412
2463
  switch( (*p) ) {
2413
2464
  case 32: goto st79;
2414
2465
  case 34: goto tr169;
@@ -2431,74 +2482,74 @@ case 79:
2431
2482
  goto tr170;
2432
2483
  goto st80;
2433
2484
  tr157:
2434
- #line 111 "hpricot_scan.rl"
2485
+ #line 134 "hpricot_scan.rl"
2435
2486
  { mark_aval = p; }
2436
2487
  goto st80;
2437
2488
  st80:
2438
2489
  if ( ++p == pe )
2439
2490
  goto _test_eof80;
2440
2491
  case 80:
2441
- #line 2442 "hpricot_scan.c"
2492
+ #line 2493 "hpricot_scan.c"
2442
2493
  switch( (*p) ) {
2443
2494
  case 34: goto tr169;
2444
2495
  case 92: goto st81;
2445
2496
  }
2446
2497
  goto st80;
2447
2498
  tr340:
2448
- #line 111 "hpricot_scan.rl"
2499
+ #line 134 "hpricot_scan.rl"
2449
2500
  { mark_aval = p; }
2450
2501
  goto st81;
2451
2502
  st81:
2452
2503
  if ( ++p == pe )
2453
2504
  goto _test_eof81;
2454
2505
  case 81:
2455
- #line 2456 "hpricot_scan.c"
2506
+ #line 2507 "hpricot_scan.c"
2456
2507
  switch( (*p) ) {
2457
2508
  case 34: goto tr174;
2458
2509
  case 92: goto st81;
2459
2510
  }
2460
2511
  goto st80;
2461
2512
  tr170:
2462
- #line 134 "hpricot_scan.rl"
2513
+ #line 168 "hpricot_scan.rl"
2463
2514
  {
2464
- if (!S->xml)
2515
+ if (!S->xml && !NIL_P(akey))
2465
2516
  akey = rb_funcall(akey, s_downcase, 0);
2466
2517
  ATTR(akey, aval);
2467
2518
  }
2468
- #line 127 "hpricot_scan.rl"
2519
+ #line 161 "hpricot_scan.rl"
2469
2520
  {
2470
2521
  akey = Qnil;
2471
2522
  aval = Qnil;
2472
2523
  mark_akey = NULL;
2473
2524
  mark_aval = NULL;
2474
2525
  }
2475
- #line 112 "hpricot_scan.rl"
2526
+ #line 135 "hpricot_scan.rl"
2476
2527
  { mark_akey = p; }
2477
2528
  goto st82;
2478
2529
  tr337:
2479
- #line 111 "hpricot_scan.rl"
2480
- { mark_aval = p; }
2481
2530
  #line 134 "hpricot_scan.rl"
2531
+ { mark_aval = p; }
2532
+ #line 168 "hpricot_scan.rl"
2482
2533
  {
2483
- if (!S->xml)
2534
+ if (!S->xml && !NIL_P(akey))
2484
2535
  akey = rb_funcall(akey, s_downcase, 0);
2485
2536
  ATTR(akey, aval);
2486
2537
  }
2487
- #line 127 "hpricot_scan.rl"
2538
+ #line 161 "hpricot_scan.rl"
2488
2539
  {
2489
2540
  akey = Qnil;
2490
2541
  aval = Qnil;
2491
2542
  mark_akey = NULL;
2492
2543
  mark_aval = NULL;
2493
2544
  }
2494
- #line 112 "hpricot_scan.rl"
2545
+ #line 135 "hpricot_scan.rl"
2495
2546
  { mark_akey = p; }
2496
2547
  goto st82;
2497
2548
  st82:
2498
2549
  if ( ++p == pe )
2499
2550
  goto _test_eof82;
2500
2551
  case 82:
2501
- #line 2502 "hpricot_scan.c"
2552
+ #line 2553 "hpricot_scan.c"
2502
2553
  switch( (*p) ) {
2503
2554
  case 32: goto tr175;
2504
2555
  case 34: goto tr169;
@@ -2522,20 +2573,20 @@ case 82:
2522
2573
  goto st82;
2523
2574
  goto st80;
2524
2575
  tr175:
2525
- #line 120 "hpricot_scan.rl"
2576
+ #line 143 "hpricot_scan.rl"
2526
2577
  { SET(akey, p); }
2527
2578
  goto st83;
2528
2579
  tr206:
2529
- #line 116 "hpricot_scan.rl"
2580
+ #line 139 "hpricot_scan.rl"
2530
2581
  {
2531
2582
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2532
2583
  else { SET(aval, p); }
2533
2584
  }
2534
2585
  goto st83;
2535
2586
  tr200:
2536
- #line 120 "hpricot_scan.rl"
2587
+ #line 143 "hpricot_scan.rl"
2537
2588
  { SET(akey, p); }
2538
- #line 116 "hpricot_scan.rl"
2589
+ #line 139 "hpricot_scan.rl"
2539
2590
  {
2540
2591
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2541
2592
  else { SET(aval, p); }
@@ -2545,7 +2596,7 @@ st83:
2545
2596
  if ( ++p == pe )
2546
2597
  goto _test_eof83;
2547
2598
  case 83:
2548
- #line 2549 "hpricot_scan.c"
2599
+ #line 2600 "hpricot_scan.c"
2549
2600
  switch( (*p) ) {
2550
2601
  case 32: goto st83;
2551
2602
  case 34: goto tr169;
@@ -2569,29 +2620,29 @@ case 83:
2569
2620
  goto tr170;
2570
2621
  goto st80;
2571
2622
  tr177:
2572
- #line 120 "hpricot_scan.rl"
2623
+ #line 143 "hpricot_scan.rl"
2573
2624
  { SET(akey, p); }
2574
- #line 134 "hpricot_scan.rl"
2625
+ #line 168 "hpricot_scan.rl"
2575
2626
  {
2576
- if (!S->xml)
2627
+ if (!S->xml && !NIL_P(akey))
2577
2628
  akey = rb_funcall(akey, s_downcase, 0);
2578
2629
  ATTR(akey, aval);
2579
2630
  }
2580
2631
  goto st84;
2581
2632
  tr171:
2582
- #line 134 "hpricot_scan.rl"
2633
+ #line 168 "hpricot_scan.rl"
2583
2634
  {
2584
- if (!S->xml)
2635
+ if (!S->xml && !NIL_P(akey))
2585
2636
  akey = rb_funcall(akey, s_downcase, 0);
2586
2637
  ATTR(akey, aval);
2587
2638
  }
2588
2639
  goto st84;
2589
2640
  tr338:
2590
- #line 111 "hpricot_scan.rl"
2591
- { mark_aval = p; }
2592
2641
  #line 134 "hpricot_scan.rl"
2642
+ { mark_aval = p; }
2643
+ #line 168 "hpricot_scan.rl"
2593
2644
  {
2594
- if (!S->xml)
2645
+ if (!S->xml && !NIL_P(akey))
2595
2646
  akey = rb_funcall(akey, s_downcase, 0);
2596
2647
  ATTR(akey, aval);
2597
2648
  }
@@ -2600,7 +2651,7 @@ st84:
2600
2651
  if ( ++p == pe )
2601
2652
  goto _test_eof84;
2602
2653
  case 84:
2603
- #line 2604 "hpricot_scan.c"
2654
+ #line 2655 "hpricot_scan.c"
2604
2655
  switch( (*p) ) {
2605
2656
  case 34: goto tr169;
2606
2657
  case 62: goto tr182;
@@ -2608,161 +2659,161 @@ case 84:
2608
2659
  }
2609
2660
  goto st80;
2610
2661
  tr158:
2611
- #line 1 "hpricot_scan.rl"
2662
+ #line 1 "NONE"
2612
2663
  {te = p+1;}
2613
- #line 111 "hpricot_scan.rl"
2664
+ #line 134 "hpricot_scan.rl"
2614
2665
  { mark_aval = p; }
2615
- #line 116 "hpricot_scan.rl"
2666
+ #line 139 "hpricot_scan.rl"
2616
2667
  {
2617
2668
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2618
2669
  else { SET(aval, p); }
2619
2670
  }
2620
- #line 134 "hpricot_scan.rl"
2671
+ #line 168 "hpricot_scan.rl"
2621
2672
  {
2622
- if (!S->xml)
2673
+ if (!S->xml && !NIL_P(akey))
2623
2674
  akey = rb_funcall(akey, s_downcase, 0);
2624
2675
  ATTR(akey, aval);
2625
2676
  }
2626
- #line 68 "hpricot_scan.rl"
2677
+ #line 68 "hpricot_common.rl"
2627
2678
  {act = 10;}
2628
2679
  goto st209;
2629
2680
  tr166:
2630
- #line 1 "hpricot_scan.rl"
2681
+ #line 1 "NONE"
2631
2682
  {te = p+1;}
2632
- #line 116 "hpricot_scan.rl"
2683
+ #line 139 "hpricot_scan.rl"
2633
2684
  {
2634
2685
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2635
2686
  else { SET(aval, p); }
2636
2687
  }
2637
- #line 134 "hpricot_scan.rl"
2688
+ #line 168 "hpricot_scan.rl"
2638
2689
  {
2639
- if (!S->xml)
2690
+ if (!S->xml && !NIL_P(akey))
2640
2691
  akey = rb_funcall(akey, s_downcase, 0);
2641
2692
  ATTR(akey, aval);
2642
2693
  }
2643
- #line 68 "hpricot_scan.rl"
2694
+ #line 68 "hpricot_common.rl"
2644
2695
  {act = 10;}
2645
2696
  goto st209;
2646
2697
  tr172:
2647
- #line 1 "hpricot_scan.rl"
2698
+ #line 1 "NONE"
2648
2699
  {te = p+1;}
2649
- #line 134 "hpricot_scan.rl"
2700
+ #line 168 "hpricot_scan.rl"
2650
2701
  {
2651
- if (!S->xml)
2702
+ if (!S->xml && !NIL_P(akey))
2652
2703
  akey = rb_funcall(akey, s_downcase, 0);
2653
2704
  ATTR(akey, aval);
2654
2705
  }
2655
- #line 68 "hpricot_scan.rl"
2706
+ #line 68 "hpricot_common.rl"
2656
2707
  {act = 10;}
2657
2708
  goto st209;
2658
2709
  tr179:
2659
- #line 1 "hpricot_scan.rl"
2710
+ #line 1 "NONE"
2660
2711
  {te = p+1;}
2661
- #line 120 "hpricot_scan.rl"
2712
+ #line 143 "hpricot_scan.rl"
2662
2713
  { SET(akey, p); }
2663
- #line 134 "hpricot_scan.rl"
2714
+ #line 168 "hpricot_scan.rl"
2664
2715
  {
2665
- if (!S->xml)
2716
+ if (!S->xml && !NIL_P(akey))
2666
2717
  akey = rb_funcall(akey, s_downcase, 0);
2667
2718
  ATTR(akey, aval);
2668
2719
  }
2669
- #line 68 "hpricot_scan.rl"
2720
+ #line 68 "hpricot_common.rl"
2670
2721
  {act = 10;}
2671
2722
  goto st209;
2672
2723
  tr182:
2673
- #line 1 "hpricot_scan.rl"
2724
+ #line 1 "NONE"
2674
2725
  {te = p+1;}
2675
- #line 70 "hpricot_scan.rl"
2726
+ #line 70 "hpricot_common.rl"
2676
2727
  {act = 12;}
2677
2728
  goto st209;
2678
2729
  tr196:
2679
- #line 1 "hpricot_scan.rl"
2730
+ #line 1 "NONE"
2680
2731
  {te = p+1;}
2681
- #line 134 "hpricot_scan.rl"
2732
+ #line 168 "hpricot_scan.rl"
2682
2733
  {
2683
- if (!S->xml)
2734
+ if (!S->xml && !NIL_P(akey))
2684
2735
  akey = rb_funcall(akey, s_downcase, 0);
2685
2736
  ATTR(akey, aval);
2686
2737
  }
2687
- #line 116 "hpricot_scan.rl"
2738
+ #line 139 "hpricot_scan.rl"
2688
2739
  {
2689
2740
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2690
2741
  else { SET(aval, p); }
2691
2742
  }
2692
- #line 68 "hpricot_scan.rl"
2743
+ #line 68 "hpricot_common.rl"
2693
2744
  {act = 10;}
2694
2745
  goto st209;
2695
2746
  tr197:
2696
- #line 1 "hpricot_scan.rl"
2747
+ #line 1 "NONE"
2697
2748
  {te = p+1;}
2698
- #line 111 "hpricot_scan.rl"
2699
- { mark_aval = p; }
2700
2749
  #line 134 "hpricot_scan.rl"
2750
+ { mark_aval = p; }
2751
+ #line 168 "hpricot_scan.rl"
2701
2752
  {
2702
- if (!S->xml)
2753
+ if (!S->xml && !NIL_P(akey))
2703
2754
  akey = rb_funcall(akey, s_downcase, 0);
2704
2755
  ATTR(akey, aval);
2705
2756
  }
2706
- #line 116 "hpricot_scan.rl"
2757
+ #line 139 "hpricot_scan.rl"
2707
2758
  {
2708
2759
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2709
2760
  else { SET(aval, p); }
2710
2761
  }
2711
- #line 68 "hpricot_scan.rl"
2762
+ #line 68 "hpricot_common.rl"
2712
2763
  {act = 10;}
2713
2764
  goto st209;
2714
2765
  tr205:
2715
- #line 1 "hpricot_scan.rl"
2766
+ #line 1 "NONE"
2716
2767
  {te = p+1;}
2717
- #line 116 "hpricot_scan.rl"
2768
+ #line 139 "hpricot_scan.rl"
2718
2769
  {
2719
2770
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2720
2771
  else { SET(aval, p); }
2721
2772
  }
2722
- #line 120 "hpricot_scan.rl"
2773
+ #line 143 "hpricot_scan.rl"
2723
2774
  { SET(akey, p); }
2724
- #line 134 "hpricot_scan.rl"
2775
+ #line 168 "hpricot_scan.rl"
2725
2776
  {
2726
- if (!S->xml)
2777
+ if (!S->xml && !NIL_P(akey))
2727
2778
  akey = rb_funcall(akey, s_downcase, 0);
2728
2779
  ATTR(akey, aval);
2729
2780
  }
2730
- #line 68 "hpricot_scan.rl"
2781
+ #line 68 "hpricot_common.rl"
2731
2782
  {act = 10;}
2732
2783
  goto st209;
2733
2784
  tr339:
2734
- #line 1 "hpricot_scan.rl"
2785
+ #line 1 "NONE"
2735
2786
  {te = p+1;}
2736
- #line 111 "hpricot_scan.rl"
2737
- { mark_aval = p; }
2738
2787
  #line 134 "hpricot_scan.rl"
2788
+ { mark_aval = p; }
2789
+ #line 168 "hpricot_scan.rl"
2739
2790
  {
2740
- if (!S->xml)
2791
+ if (!S->xml && !NIL_P(akey))
2741
2792
  akey = rb_funcall(akey, s_downcase, 0);
2742
2793
  ATTR(akey, aval);
2743
2794
  }
2744
- #line 68 "hpricot_scan.rl"
2795
+ #line 68 "hpricot_common.rl"
2745
2796
  {act = 10;}
2746
2797
  goto st209;
2747
2798
  st209:
2748
2799
  if ( ++p == pe )
2749
2800
  goto _test_eof209;
2750
2801
  case 209:
2751
- #line 2752 "hpricot_scan.c"
2802
+ #line 2803 "hpricot_scan.c"
2752
2803
  switch( (*p) ) {
2753
2804
  case 34: goto tr169;
2754
2805
  case 92: goto st81;
2755
2806
  }
2756
2807
  goto st80;
2757
2808
  tr178:
2758
- #line 120 "hpricot_scan.rl"
2809
+ #line 143 "hpricot_scan.rl"
2759
2810
  { SET(akey, p); }
2760
2811
  goto st85;
2761
2812
  st85:
2762
2813
  if ( ++p == pe )
2763
2814
  goto _test_eof85;
2764
2815
  case 85:
2765
- #line 2766 "hpricot_scan.c"
2816
+ #line 2817 "hpricot_scan.c"
2766
2817
  switch( (*p) ) {
2767
2818
  case 13: goto tr183;
2768
2819
  case 32: goto tr183;
@@ -2780,14 +2831,14 @@ case 85:
2780
2831
  goto tr183;
2781
2832
  goto tr152;
2782
2833
  tr183:
2783
- #line 111 "hpricot_scan.rl"
2834
+ #line 134 "hpricot_scan.rl"
2784
2835
  { mark_aval = p; }
2785
2836
  goto st86;
2786
2837
  st86:
2787
2838
  if ( ++p == pe )
2788
2839
  goto _test_eof86;
2789
2840
  case 86:
2790
- #line 2791 "hpricot_scan.c"
2841
+ #line 2842 "hpricot_scan.c"
2791
2842
  switch( (*p) ) {
2792
2843
  case 13: goto tr188;
2793
2844
  case 32: goto tr188;
@@ -2805,13 +2856,13 @@ case 86:
2805
2856
  goto tr188;
2806
2857
  goto tr152;
2807
2858
  tr188:
2808
- #line 111 "hpricot_scan.rl"
2859
+ #line 134 "hpricot_scan.rl"
2809
2860
  { mark_aval = p; }
2810
2861
  goto st87;
2811
2862
  tr191:
2812
- #line 111 "hpricot_scan.rl"
2863
+ #line 134 "hpricot_scan.rl"
2813
2864
  { mark_aval = p; }
2814
- #line 116 "hpricot_scan.rl"
2865
+ #line 139 "hpricot_scan.rl"
2815
2866
  {
2816
2867
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2817
2868
  else { SET(aval, p); }
@@ -2821,7 +2872,7 @@ st87:
2821
2872
  if ( ++p == pe )
2822
2873
  goto _test_eof87;
2823
2874
  case 87:
2824
- #line 2825 "hpricot_scan.c"
2875
+ #line 2876 "hpricot_scan.c"
2825
2876
  switch( (*p) ) {
2826
2877
  case 13: goto tr188;
2827
2878
  case 32: goto tr188;
@@ -2850,13 +2901,13 @@ case 87:
2850
2901
  goto tr190;
2851
2902
  goto tr152;
2852
2903
  tr189:
2853
- #line 111 "hpricot_scan.rl"
2904
+ #line 134 "hpricot_scan.rl"
2854
2905
  { mark_aval = p; }
2855
2906
  goto st88;
2856
2907
  tr192:
2857
- #line 111 "hpricot_scan.rl"
2908
+ #line 134 "hpricot_scan.rl"
2858
2909
  { mark_aval = p; }
2859
- #line 116 "hpricot_scan.rl"
2910
+ #line 139 "hpricot_scan.rl"
2860
2911
  {
2861
2912
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2862
2913
  else { SET(aval, p); }
@@ -2866,7 +2917,7 @@ st88:
2866
2917
  if ( ++p == pe )
2867
2918
  goto _test_eof88;
2868
2919
  case 88:
2869
- #line 2870 "hpricot_scan.c"
2920
+ #line 2921 "hpricot_scan.c"
2870
2921
  switch( (*p) ) {
2871
2922
  case 13: goto tr191;
2872
2923
  case 32: goto tr191;
@@ -2895,14 +2946,14 @@ case 88:
2895
2946
  goto tr190;
2896
2947
  goto tr152;
2897
2948
  tr193:
2898
- #line 115 "hpricot_scan.rl"
2949
+ #line 138 "hpricot_scan.rl"
2899
2950
  { SET(aval, p); }
2900
2951
  goto st89;
2901
2952
  st89:
2902
2953
  if ( ++p == pe )
2903
2954
  goto _test_eof89;
2904
2955
  case 89:
2905
- #line 2906 "hpricot_scan.c"
2956
+ #line 2957 "hpricot_scan.c"
2906
2957
  switch( (*p) ) {
2907
2958
  case 13: goto tr153;
2908
2959
  case 32: goto tr153;
@@ -2930,36 +2981,36 @@ case 89:
2930
2981
  goto tr190;
2931
2982
  goto tr152;
2932
2983
  tr162:
2933
- #line 116 "hpricot_scan.rl"
2984
+ #line 139 "hpricot_scan.rl"
2934
2985
  {
2935
2986
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2936
2987
  else { SET(aval, p); }
2937
2988
  }
2938
2989
  goto st90;
2939
2990
  tr154:
2940
- #line 111 "hpricot_scan.rl"
2991
+ #line 134 "hpricot_scan.rl"
2941
2992
  { mark_aval = p; }
2942
- #line 116 "hpricot_scan.rl"
2993
+ #line 139 "hpricot_scan.rl"
2943
2994
  {
2944
2995
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
2945
2996
  else { SET(aval, p); }
2946
2997
  }
2947
2998
  goto st90;
2948
2999
  tr214:
2949
- #line 111 "hpricot_scan.rl"
3000
+ #line 134 "hpricot_scan.rl"
2950
3001
  { mark_aval = p; }
2951
- #line 115 "hpricot_scan.rl"
3002
+ #line 138 "hpricot_scan.rl"
2952
3003
  { SET(aval, p); }
2953
3004
  goto st90;
2954
3005
  tr209:
2955
- #line 115 "hpricot_scan.rl"
3006
+ #line 138 "hpricot_scan.rl"
2956
3007
  { SET(aval, p); }
2957
3008
  goto st90;
2958
3009
  st90:
2959
3010
  if ( ++p == pe )
2960
3011
  goto _test_eof90;
2961
3012
  case 90:
2962
- #line 2963 "hpricot_scan.c"
3013
+ #line 3014 "hpricot_scan.c"
2963
3014
  switch( (*p) ) {
2964
3015
  case 13: goto tr161;
2965
3016
  case 32: goto tr161;
@@ -2987,46 +3038,46 @@ case 90:
2987
3038
  goto tr198;
2988
3039
  goto st78;
2989
3040
  tr198:
2990
- #line 134 "hpricot_scan.rl"
3041
+ #line 168 "hpricot_scan.rl"
2991
3042
  {
2992
- if (!S->xml)
3043
+ if (!S->xml && !NIL_P(akey))
2993
3044
  akey = rb_funcall(akey, s_downcase, 0);
2994
3045
  ATTR(akey, aval);
2995
3046
  }
2996
- #line 127 "hpricot_scan.rl"
3047
+ #line 161 "hpricot_scan.rl"
2997
3048
  {
2998
3049
  akey = Qnil;
2999
3050
  aval = Qnil;
3000
3051
  mark_akey = NULL;
3001
3052
  mark_aval = NULL;
3002
3053
  }
3003
- #line 112 "hpricot_scan.rl"
3054
+ #line 135 "hpricot_scan.rl"
3004
3055
  { mark_akey = p; }
3005
3056
  goto st91;
3006
3057
  tr190:
3007
- #line 111 "hpricot_scan.rl"
3008
- { mark_aval = p; }
3009
3058
  #line 134 "hpricot_scan.rl"
3059
+ { mark_aval = p; }
3060
+ #line 168 "hpricot_scan.rl"
3010
3061
  {
3011
- if (!S->xml)
3062
+ if (!S->xml && !NIL_P(akey))
3012
3063
  akey = rb_funcall(akey, s_downcase, 0);
3013
3064
  ATTR(akey, aval);
3014
3065
  }
3015
- #line 127 "hpricot_scan.rl"
3066
+ #line 161 "hpricot_scan.rl"
3016
3067
  {
3017
3068
  akey = Qnil;
3018
3069
  aval = Qnil;
3019
3070
  mark_akey = NULL;
3020
3071
  mark_aval = NULL;
3021
3072
  }
3022
- #line 112 "hpricot_scan.rl"
3073
+ #line 135 "hpricot_scan.rl"
3023
3074
  { mark_akey = p; }
3024
3075
  goto st91;
3025
3076
  st91:
3026
3077
  if ( ++p == pe )
3027
3078
  goto _test_eof91;
3028
3079
  case 91:
3029
- #line 3030 "hpricot_scan.c"
3080
+ #line 3081 "hpricot_scan.c"
3030
3081
  switch( (*p) ) {
3031
3082
  case 13: goto tr200;
3032
3083
  case 32: goto tr200;
@@ -3055,16 +3106,16 @@ case 91:
3055
3106
  goto st91;
3056
3107
  goto st78;
3057
3108
  tr207:
3058
- #line 116 "hpricot_scan.rl"
3109
+ #line 139 "hpricot_scan.rl"
3059
3110
  {
3060
3111
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3061
3112
  else { SET(aval, p); }
3062
3113
  }
3063
3114
  goto st92;
3064
3115
  tr201:
3065
- #line 120 "hpricot_scan.rl"
3116
+ #line 143 "hpricot_scan.rl"
3066
3117
  { SET(akey, p); }
3067
- #line 116 "hpricot_scan.rl"
3118
+ #line 139 "hpricot_scan.rl"
3068
3119
  {
3069
3120
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3070
3121
  else { SET(aval, p); }
@@ -3074,7 +3125,7 @@ st92:
3074
3125
  if ( ++p == pe )
3075
3126
  goto _test_eof92;
3076
3127
  case 92:
3077
- #line 3078 "hpricot_scan.c"
3128
+ #line 3129 "hpricot_scan.c"
3078
3129
  switch( (*p) ) {
3079
3130
  case 13: goto tr206;
3080
3131
  case 32: goto tr206;
@@ -3103,81 +3154,81 @@ case 92:
3103
3154
  goto tr198;
3104
3155
  goto st78;
3105
3156
  tr187:
3106
- #line 111 "hpricot_scan.rl"
3107
- { mark_aval = p; }
3108
3157
  #line 134 "hpricot_scan.rl"
3158
+ { mark_aval = p; }
3159
+ #line 168 "hpricot_scan.rl"
3109
3160
  {
3110
- if (!S->xml)
3161
+ if (!S->xml && !NIL_P(akey))
3111
3162
  akey = rb_funcall(akey, s_downcase, 0);
3112
3163
  ATTR(akey, aval);
3113
3164
  }
3114
3165
  goto st93;
3115
3166
  tr164:
3116
- #line 116 "hpricot_scan.rl"
3167
+ #line 139 "hpricot_scan.rl"
3117
3168
  {
3118
3169
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3119
3170
  else { SET(aval, p); }
3120
3171
  }
3121
- #line 134 "hpricot_scan.rl"
3172
+ #line 168 "hpricot_scan.rl"
3122
3173
  {
3123
- if (!S->xml)
3174
+ if (!S->xml && !NIL_P(akey))
3124
3175
  akey = rb_funcall(akey, s_downcase, 0);
3125
3176
  ATTR(akey, aval);
3126
3177
  }
3127
3178
  goto st93;
3128
3179
  tr199:
3129
- #line 134 "hpricot_scan.rl"
3180
+ #line 168 "hpricot_scan.rl"
3130
3181
  {
3131
- if (!S->xml)
3182
+ if (!S->xml && !NIL_P(akey))
3132
3183
  akey = rb_funcall(akey, s_downcase, 0);
3133
3184
  ATTR(akey, aval);
3134
3185
  }
3135
- #line 116 "hpricot_scan.rl"
3186
+ #line 139 "hpricot_scan.rl"
3136
3187
  {
3137
3188
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3138
3189
  else { SET(aval, p); }
3139
3190
  }
3140
3191
  goto st93;
3141
3192
  tr203:
3142
- #line 116 "hpricot_scan.rl"
3193
+ #line 139 "hpricot_scan.rl"
3143
3194
  {
3144
3195
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3145
3196
  else { SET(aval, p); }
3146
3197
  }
3147
- #line 120 "hpricot_scan.rl"
3198
+ #line 143 "hpricot_scan.rl"
3148
3199
  { SET(akey, p); }
3149
- #line 134 "hpricot_scan.rl"
3200
+ #line 168 "hpricot_scan.rl"
3150
3201
  {
3151
- if (!S->xml)
3202
+ if (!S->xml && !NIL_P(akey))
3152
3203
  akey = rb_funcall(akey, s_downcase, 0);
3153
3204
  ATTR(akey, aval);
3154
3205
  }
3155
3206
  goto st93;
3156
3207
  tr156:
3157
- #line 111 "hpricot_scan.rl"
3208
+ #line 134 "hpricot_scan.rl"
3158
3209
  { mark_aval = p; }
3159
- #line 116 "hpricot_scan.rl"
3210
+ #line 139 "hpricot_scan.rl"
3160
3211
  {
3161
3212
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3162
3213
  else { SET(aval, p); }
3163
3214
  }
3164
- #line 134 "hpricot_scan.rl"
3215
+ #line 168 "hpricot_scan.rl"
3165
3216
  {
3166
- if (!S->xml)
3217
+ if (!S->xml && !NIL_P(akey))
3167
3218
  akey = rb_funcall(akey, s_downcase, 0);
3168
3219
  ATTR(akey, aval);
3169
3220
  }
3170
3221
  goto st93;
3171
3222
  tr195:
3172
- #line 111 "hpricot_scan.rl"
3173
- { mark_aval = p; }
3174
3223
  #line 134 "hpricot_scan.rl"
3224
+ { mark_aval = p; }
3225
+ #line 168 "hpricot_scan.rl"
3175
3226
  {
3176
- if (!S->xml)
3227
+ if (!S->xml && !NIL_P(akey))
3177
3228
  akey = rb_funcall(akey, s_downcase, 0);
3178
3229
  ATTR(akey, aval);
3179
3230
  }
3180
- #line 116 "hpricot_scan.rl"
3231
+ #line 139 "hpricot_scan.rl"
3181
3232
  {
3182
3233
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3183
3234
  else { SET(aval, p); }
@@ -3187,7 +3238,7 @@ st93:
3187
3238
  if ( ++p == pe )
3188
3239
  goto _test_eof93;
3189
3240
  case 93:
3190
- #line 3191 "hpricot_scan.c"
3241
+ #line 3242 "hpricot_scan.c"
3191
3242
  switch( (*p) ) {
3192
3243
  case 13: goto tr161;
3193
3244
  case 32: goto tr161;
@@ -3204,14 +3255,14 @@ case 93:
3204
3255
  goto tr161;
3205
3256
  goto st78;
3206
3257
  tr159:
3207
- #line 111 "hpricot_scan.rl"
3258
+ #line 134 "hpricot_scan.rl"
3208
3259
  { mark_aval = p; }
3209
3260
  goto st94;
3210
3261
  st94:
3211
3262
  if ( ++p == pe )
3212
3263
  goto _test_eof94;
3213
3264
  case 94:
3214
- #line 3215 "hpricot_scan.c"
3265
+ #line 3266 "hpricot_scan.c"
3215
3266
  switch( (*p) ) {
3216
3267
  case 13: goto tr161;
3217
3268
  case 32: goto tr161;
@@ -3228,18 +3279,18 @@ case 94:
3228
3279
  goto tr161;
3229
3280
  goto st78;
3230
3281
  tr184:
3231
- #line 111 "hpricot_scan.rl"
3282
+ #line 134 "hpricot_scan.rl"
3232
3283
  { mark_aval = p; }
3233
3284
  goto st95;
3234
3285
  tr204:
3235
- #line 120 "hpricot_scan.rl"
3286
+ #line 143 "hpricot_scan.rl"
3236
3287
  { SET(akey, p); }
3237
3288
  goto st95;
3238
3289
  st95:
3239
3290
  if ( ++p == pe )
3240
3291
  goto _test_eof95;
3241
3292
  case 95:
3242
- #line 3243 "hpricot_scan.c"
3293
+ #line 3294 "hpricot_scan.c"
3243
3294
  switch( (*p) ) {
3244
3295
  case 13: goto tr191;
3245
3296
  case 32: goto tr191;
@@ -3277,14 +3328,14 @@ case 96:
3277
3328
  goto tr211;
3278
3329
  goto tr210;
3279
3330
  tr210:
3280
- #line 111 "hpricot_scan.rl"
3331
+ #line 134 "hpricot_scan.rl"
3281
3332
  { mark_aval = p; }
3282
3333
  goto st97;
3283
3334
  st97:
3284
3335
  if ( ++p == pe )
3285
3336
  goto _test_eof97;
3286
3337
  case 97:
3287
- #line 3288 "hpricot_scan.c"
3338
+ #line 3339 "hpricot_scan.c"
3288
3339
  switch( (*p) ) {
3289
3340
  case 13: goto tr220;
3290
3341
  case 32: goto tr220;
@@ -3302,34 +3353,34 @@ case 97:
3302
3353
  goto tr220;
3303
3354
  goto st97;
3304
3355
  tr315:
3305
- #line 111 "hpricot_scan.rl"
3356
+ #line 134 "hpricot_scan.rl"
3306
3357
  { mark_aval = p; }
3307
3358
  goto st98;
3308
3359
  tr220:
3309
- #line 116 "hpricot_scan.rl"
3360
+ #line 139 "hpricot_scan.rl"
3310
3361
  {
3311
3362
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3312
3363
  else { SET(aval, p); }
3313
3364
  }
3314
3365
  goto st98;
3315
3366
  tr211:
3316
- #line 111 "hpricot_scan.rl"
3367
+ #line 134 "hpricot_scan.rl"
3317
3368
  { mark_aval = p; }
3318
- #line 116 "hpricot_scan.rl"
3369
+ #line 139 "hpricot_scan.rl"
3319
3370
  {
3320
3371
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3321
3372
  else { SET(aval, p); }
3322
3373
  }
3323
3374
  goto st98;
3324
3375
  tr299:
3325
- #line 115 "hpricot_scan.rl"
3376
+ #line 138 "hpricot_scan.rl"
3326
3377
  { SET(aval, p); }
3327
3378
  goto st98;
3328
3379
  st98:
3329
3380
  if ( ++p == pe )
3330
3381
  goto _test_eof98;
3331
3382
  case 98:
3332
- #line 3333 "hpricot_scan.c"
3383
+ #line 3384 "hpricot_scan.c"
3333
3384
  switch( (*p) ) {
3334
3385
  case 32: goto st98;
3335
3386
  case 34: goto tr228;
@@ -3353,14 +3404,14 @@ case 98:
3353
3404
  goto tr229;
3354
3405
  goto st99;
3355
3406
  tr216:
3356
- #line 111 "hpricot_scan.rl"
3407
+ #line 134 "hpricot_scan.rl"
3357
3408
  { mark_aval = p; }
3358
3409
  goto st99;
3359
3410
  st99:
3360
3411
  if ( ++p == pe )
3361
3412
  goto _test_eof99;
3362
3413
  case 99:
3363
- #line 3364 "hpricot_scan.c"
3414
+ #line 3415 "hpricot_scan.c"
3364
3415
  switch( (*p) ) {
3365
3416
  case 34: goto tr228;
3366
3417
  case 39: goto tr174;
@@ -3368,46 +3419,46 @@ case 99:
3368
3419
  }
3369
3420
  goto st99;
3370
3421
  tr330:
3371
- #line 111 "hpricot_scan.rl"
3422
+ #line 134 "hpricot_scan.rl"
3372
3423
  { mark_aval = p; }
3373
3424
  goto st100;
3374
3425
  tr255:
3375
- #line 116 "hpricot_scan.rl"
3426
+ #line 139 "hpricot_scan.rl"
3376
3427
  {
3377
3428
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3378
3429
  else { SET(aval, p); }
3379
3430
  }
3380
3431
  goto st100;
3381
3432
  tr326:
3382
- #line 111 "hpricot_scan.rl"
3433
+ #line 134 "hpricot_scan.rl"
3383
3434
  { mark_aval = p; }
3384
- #line 116 "hpricot_scan.rl"
3435
+ #line 139 "hpricot_scan.rl"
3385
3436
  {
3386
3437
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3387
3438
  else { SET(aval, p); }
3388
3439
  }
3389
3440
  goto st100;
3390
3441
  tr316:
3391
- #line 111 "hpricot_scan.rl"
3442
+ #line 134 "hpricot_scan.rl"
3392
3443
  { mark_aval = p; }
3393
- #line 115 "hpricot_scan.rl"
3444
+ #line 138 "hpricot_scan.rl"
3394
3445
  { SET(aval, p); }
3395
3446
  goto st100;
3396
3447
  tr228:
3397
- #line 115 "hpricot_scan.rl"
3448
+ #line 138 "hpricot_scan.rl"
3398
3449
  { SET(aval, p); }
3399
3450
  goto st100;
3400
3451
  tr322:
3401
- #line 115 "hpricot_scan.rl"
3452
+ #line 138 "hpricot_scan.rl"
3402
3453
  { SET(aval, p); }
3403
- #line 111 "hpricot_scan.rl"
3454
+ #line 134 "hpricot_scan.rl"
3404
3455
  { mark_aval = p; }
3405
3456
  goto st100;
3406
3457
  st100:
3407
3458
  if ( ++p == pe )
3408
3459
  goto _test_eof100;
3409
3460
  case 100:
3410
- #line 3411 "hpricot_scan.c"
3461
+ #line 3462 "hpricot_scan.c"
3411
3462
  switch( (*p) ) {
3412
3463
  case 32: goto st100;
3413
3464
  case 39: goto tr169;
@@ -3430,74 +3481,74 @@ case 100:
3430
3481
  goto tr235;
3431
3482
  goto st101;
3432
3483
  tr328:
3433
- #line 111 "hpricot_scan.rl"
3484
+ #line 134 "hpricot_scan.rl"
3434
3485
  { mark_aval = p; }
3435
3486
  goto st101;
3436
3487
  st101:
3437
3488
  if ( ++p == pe )
3438
3489
  goto _test_eof101;
3439
3490
  case 101:
3440
- #line 3441 "hpricot_scan.c"
3491
+ #line 3492 "hpricot_scan.c"
3441
3492
  switch( (*p) ) {
3442
3493
  case 39: goto tr169;
3443
3494
  case 92: goto st102;
3444
3495
  }
3445
3496
  goto st101;
3446
3497
  tr335:
3447
- #line 111 "hpricot_scan.rl"
3498
+ #line 134 "hpricot_scan.rl"
3448
3499
  { mark_aval = p; }
3449
3500
  goto st102;
3450
3501
  st102:
3451
3502
  if ( ++p == pe )
3452
3503
  goto _test_eof102;
3453
3504
  case 102:
3454
- #line 3455 "hpricot_scan.c"
3505
+ #line 3506 "hpricot_scan.c"
3455
3506
  switch( (*p) ) {
3456
3507
  case 39: goto tr228;
3457
3508
  case 92: goto st102;
3458
3509
  }
3459
3510
  goto st101;
3460
3511
  tr235:
3461
- #line 134 "hpricot_scan.rl"
3512
+ #line 168 "hpricot_scan.rl"
3462
3513
  {
3463
- if (!S->xml)
3514
+ if (!S->xml && !NIL_P(akey))
3464
3515
  akey = rb_funcall(akey, s_downcase, 0);
3465
3516
  ATTR(akey, aval);
3466
3517
  }
3467
- #line 127 "hpricot_scan.rl"
3518
+ #line 161 "hpricot_scan.rl"
3468
3519
  {
3469
3520
  akey = Qnil;
3470
3521
  aval = Qnil;
3471
3522
  mark_akey = NULL;
3472
3523
  mark_aval = NULL;
3473
3524
  }
3474
- #line 112 "hpricot_scan.rl"
3525
+ #line 135 "hpricot_scan.rl"
3475
3526
  { mark_akey = p; }
3476
3527
  goto st103;
3477
3528
  tr332:
3478
- #line 111 "hpricot_scan.rl"
3479
- { mark_aval = p; }
3480
3529
  #line 134 "hpricot_scan.rl"
3530
+ { mark_aval = p; }
3531
+ #line 168 "hpricot_scan.rl"
3481
3532
  {
3482
- if (!S->xml)
3533
+ if (!S->xml && !NIL_P(akey))
3483
3534
  akey = rb_funcall(akey, s_downcase, 0);
3484
3535
  ATTR(akey, aval);
3485
3536
  }
3486
- #line 127 "hpricot_scan.rl"
3537
+ #line 161 "hpricot_scan.rl"
3487
3538
  {
3488
3539
  akey = Qnil;
3489
3540
  aval = Qnil;
3490
3541
  mark_akey = NULL;
3491
3542
  mark_aval = NULL;
3492
3543
  }
3493
- #line 112 "hpricot_scan.rl"
3544
+ #line 135 "hpricot_scan.rl"
3494
3545
  { mark_akey = p; }
3495
3546
  goto st103;
3496
3547
  st103:
3497
3548
  if ( ++p == pe )
3498
3549
  goto _test_eof103;
3499
3550
  case 103:
3500
- #line 3501 "hpricot_scan.c"
3551
+ #line 3552 "hpricot_scan.c"
3501
3552
  switch( (*p) ) {
3502
3553
  case 32: goto tr239;
3503
3554
  case 39: goto tr169;
@@ -3521,20 +3572,20 @@ case 103:
3521
3572
  goto st103;
3522
3573
  goto st101;
3523
3574
  tr239:
3524
- #line 120 "hpricot_scan.rl"
3575
+ #line 143 "hpricot_scan.rl"
3525
3576
  { SET(akey, p); }
3526
3577
  goto st104;
3527
3578
  tr269:
3528
- #line 116 "hpricot_scan.rl"
3579
+ #line 139 "hpricot_scan.rl"
3529
3580
  {
3530
3581
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3531
3582
  else { SET(aval, p); }
3532
3583
  }
3533
3584
  goto st104;
3534
3585
  tr263:
3535
- #line 120 "hpricot_scan.rl"
3586
+ #line 143 "hpricot_scan.rl"
3536
3587
  { SET(akey, p); }
3537
- #line 116 "hpricot_scan.rl"
3588
+ #line 139 "hpricot_scan.rl"
3538
3589
  {
3539
3590
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3540
3591
  else { SET(aval, p); }
@@ -3544,7 +3595,7 @@ st104:
3544
3595
  if ( ++p == pe )
3545
3596
  goto _test_eof104;
3546
3597
  case 104:
3547
- #line 3548 "hpricot_scan.c"
3598
+ #line 3599 "hpricot_scan.c"
3548
3599
  switch( (*p) ) {
3549
3600
  case 32: goto st104;
3550
3601
  case 39: goto tr169;
@@ -3568,29 +3619,29 @@ case 104:
3568
3619
  goto tr235;
3569
3620
  goto st101;
3570
3621
  tr241:
3571
- #line 120 "hpricot_scan.rl"
3622
+ #line 143 "hpricot_scan.rl"
3572
3623
  { SET(akey, p); }
3573
- #line 134 "hpricot_scan.rl"
3624
+ #line 168 "hpricot_scan.rl"
3574
3625
  {
3575
- if (!S->xml)
3626
+ if (!S->xml && !NIL_P(akey))
3576
3627
  akey = rb_funcall(akey, s_downcase, 0);
3577
3628
  ATTR(akey, aval);
3578
3629
  }
3579
3630
  goto st105;
3580
3631
  tr236:
3581
- #line 134 "hpricot_scan.rl"
3632
+ #line 168 "hpricot_scan.rl"
3582
3633
  {
3583
- if (!S->xml)
3634
+ if (!S->xml && !NIL_P(akey))
3584
3635
  akey = rb_funcall(akey, s_downcase, 0);
3585
3636
  ATTR(akey, aval);
3586
3637
  }
3587
3638
  goto st105;
3588
3639
  tr333:
3589
- #line 111 "hpricot_scan.rl"
3590
- { mark_aval = p; }
3591
3640
  #line 134 "hpricot_scan.rl"
3641
+ { mark_aval = p; }
3642
+ #line 168 "hpricot_scan.rl"
3592
3643
  {
3593
- if (!S->xml)
3644
+ if (!S->xml && !NIL_P(akey))
3594
3645
  akey = rb_funcall(akey, s_downcase, 0);
3595
3646
  ATTR(akey, aval);
3596
3647
  }
@@ -3599,7 +3650,7 @@ st105:
3599
3650
  if ( ++p == pe )
3600
3651
  goto _test_eof105;
3601
3652
  case 105:
3602
- #line 3603 "hpricot_scan.c"
3653
+ #line 3654 "hpricot_scan.c"
3603
3654
  switch( (*p) ) {
3604
3655
  case 39: goto tr169;
3605
3656
  case 62: goto tr246;
@@ -3607,161 +3658,161 @@ case 105:
3607
3658
  }
3608
3659
  goto st101;
3609
3660
  tr341:
3610
- #line 1 "hpricot_scan.rl"
3661
+ #line 1 "NONE"
3611
3662
  {te = p+1;}
3612
- #line 111 "hpricot_scan.rl"
3663
+ #line 134 "hpricot_scan.rl"
3613
3664
  { mark_aval = p; }
3614
- #line 116 "hpricot_scan.rl"
3665
+ #line 139 "hpricot_scan.rl"
3615
3666
  {
3616
3667
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3617
3668
  else { SET(aval, p); }
3618
3669
  }
3619
- #line 134 "hpricot_scan.rl"
3670
+ #line 168 "hpricot_scan.rl"
3620
3671
  {
3621
- if (!S->xml)
3672
+ if (!S->xml && !NIL_P(akey))
3622
3673
  akey = rb_funcall(akey, s_downcase, 0);
3623
3674
  ATTR(akey, aval);
3624
3675
  }
3625
- #line 68 "hpricot_scan.rl"
3676
+ #line 68 "hpricot_common.rl"
3626
3677
  {act = 10;}
3627
3678
  goto st210;
3628
3679
  tr258:
3629
- #line 1 "hpricot_scan.rl"
3680
+ #line 1 "NONE"
3630
3681
  {te = p+1;}
3631
- #line 116 "hpricot_scan.rl"
3682
+ #line 139 "hpricot_scan.rl"
3632
3683
  {
3633
3684
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3634
3685
  else { SET(aval, p); }
3635
3686
  }
3636
- #line 134 "hpricot_scan.rl"
3687
+ #line 168 "hpricot_scan.rl"
3637
3688
  {
3638
- if (!S->xml)
3689
+ if (!S->xml && !NIL_P(akey))
3639
3690
  akey = rb_funcall(akey, s_downcase, 0);
3640
3691
  ATTR(akey, aval);
3641
3692
  }
3642
- #line 68 "hpricot_scan.rl"
3693
+ #line 68 "hpricot_common.rl"
3643
3694
  {act = 10;}
3644
3695
  goto st210;
3645
3696
  tr237:
3646
- #line 1 "hpricot_scan.rl"
3697
+ #line 1 "NONE"
3647
3698
  {te = p+1;}
3648
- #line 134 "hpricot_scan.rl"
3699
+ #line 168 "hpricot_scan.rl"
3649
3700
  {
3650
- if (!S->xml)
3701
+ if (!S->xml && !NIL_P(akey))
3651
3702
  akey = rb_funcall(akey, s_downcase, 0);
3652
3703
  ATTR(akey, aval);
3653
3704
  }
3654
- #line 68 "hpricot_scan.rl"
3705
+ #line 68 "hpricot_common.rl"
3655
3706
  {act = 10;}
3656
3707
  goto st210;
3657
3708
  tr243:
3658
- #line 1 "hpricot_scan.rl"
3709
+ #line 1 "NONE"
3659
3710
  {te = p+1;}
3660
- #line 120 "hpricot_scan.rl"
3711
+ #line 143 "hpricot_scan.rl"
3661
3712
  { SET(akey, p); }
3662
- #line 134 "hpricot_scan.rl"
3713
+ #line 168 "hpricot_scan.rl"
3663
3714
  {
3664
- if (!S->xml)
3715
+ if (!S->xml && !NIL_P(akey))
3665
3716
  akey = rb_funcall(akey, s_downcase, 0);
3666
3717
  ATTR(akey, aval);
3667
3718
  }
3668
- #line 68 "hpricot_scan.rl"
3719
+ #line 68 "hpricot_common.rl"
3669
3720
  {act = 10;}
3670
3721
  goto st210;
3671
3722
  tr246:
3672
- #line 1 "hpricot_scan.rl"
3723
+ #line 1 "NONE"
3673
3724
  {te = p+1;}
3674
- #line 70 "hpricot_scan.rl"
3725
+ #line 70 "hpricot_common.rl"
3675
3726
  {act = 12;}
3676
3727
  goto st210;
3677
3728
  tr262:
3678
- #line 1 "hpricot_scan.rl"
3729
+ #line 1 "NONE"
3679
3730
  {te = p+1;}
3680
- #line 134 "hpricot_scan.rl"
3731
+ #line 168 "hpricot_scan.rl"
3681
3732
  {
3682
- if (!S->xml)
3733
+ if (!S->xml && !NIL_P(akey))
3683
3734
  akey = rb_funcall(akey, s_downcase, 0);
3684
3735
  ATTR(akey, aval);
3685
3736
  }
3686
- #line 116 "hpricot_scan.rl"
3737
+ #line 139 "hpricot_scan.rl"
3687
3738
  {
3688
3739
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3689
3740
  else { SET(aval, p); }
3690
3741
  }
3691
- #line 68 "hpricot_scan.rl"
3742
+ #line 68 "hpricot_common.rl"
3692
3743
  {act = 10;}
3693
3744
  goto st210;
3694
3745
  tr329:
3695
- #line 1 "hpricot_scan.rl"
3746
+ #line 1 "NONE"
3696
3747
  {te = p+1;}
3697
- #line 111 "hpricot_scan.rl"
3698
- { mark_aval = p; }
3699
3748
  #line 134 "hpricot_scan.rl"
3749
+ { mark_aval = p; }
3750
+ #line 168 "hpricot_scan.rl"
3700
3751
  {
3701
- if (!S->xml)
3752
+ if (!S->xml && !NIL_P(akey))
3702
3753
  akey = rb_funcall(akey, s_downcase, 0);
3703
3754
  ATTR(akey, aval);
3704
3755
  }
3705
- #line 116 "hpricot_scan.rl"
3756
+ #line 139 "hpricot_scan.rl"
3706
3757
  {
3707
3758
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3708
3759
  else { SET(aval, p); }
3709
3760
  }
3710
- #line 68 "hpricot_scan.rl"
3761
+ #line 68 "hpricot_common.rl"
3711
3762
  {act = 10;}
3712
3763
  goto st210;
3713
3764
  tr268:
3714
- #line 1 "hpricot_scan.rl"
3765
+ #line 1 "NONE"
3715
3766
  {te = p+1;}
3716
- #line 116 "hpricot_scan.rl"
3767
+ #line 139 "hpricot_scan.rl"
3717
3768
  {
3718
3769
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3719
3770
  else { SET(aval, p); }
3720
3771
  }
3721
- #line 120 "hpricot_scan.rl"
3772
+ #line 143 "hpricot_scan.rl"
3722
3773
  { SET(akey, p); }
3723
- #line 134 "hpricot_scan.rl"
3774
+ #line 168 "hpricot_scan.rl"
3724
3775
  {
3725
- if (!S->xml)
3776
+ if (!S->xml && !NIL_P(akey))
3726
3777
  akey = rb_funcall(akey, s_downcase, 0);
3727
3778
  ATTR(akey, aval);
3728
3779
  }
3729
- #line 68 "hpricot_scan.rl"
3780
+ #line 68 "hpricot_common.rl"
3730
3781
  {act = 10;}
3731
3782
  goto st210;
3732
3783
  tr334:
3733
- #line 1 "hpricot_scan.rl"
3784
+ #line 1 "NONE"
3734
3785
  {te = p+1;}
3735
- #line 111 "hpricot_scan.rl"
3736
- { mark_aval = p; }
3737
3786
  #line 134 "hpricot_scan.rl"
3787
+ { mark_aval = p; }
3788
+ #line 168 "hpricot_scan.rl"
3738
3789
  {
3739
- if (!S->xml)
3790
+ if (!S->xml && !NIL_P(akey))
3740
3791
  akey = rb_funcall(akey, s_downcase, 0);
3741
3792
  ATTR(akey, aval);
3742
3793
  }
3743
- #line 68 "hpricot_scan.rl"
3794
+ #line 68 "hpricot_common.rl"
3744
3795
  {act = 10;}
3745
3796
  goto st210;
3746
3797
  st210:
3747
3798
  if ( ++p == pe )
3748
3799
  goto _test_eof210;
3749
3800
  case 210:
3750
- #line 3751 "hpricot_scan.c"
3801
+ #line 3802 "hpricot_scan.c"
3751
3802
  switch( (*p) ) {
3752
3803
  case 39: goto tr169;
3753
3804
  case 92: goto st102;
3754
3805
  }
3755
3806
  goto st101;
3756
3807
  tr242:
3757
- #line 120 "hpricot_scan.rl"
3808
+ #line 143 "hpricot_scan.rl"
3758
3809
  { SET(akey, p); }
3759
3810
  goto st106;
3760
3811
  st106:
3761
3812
  if ( ++p == pe )
3762
3813
  goto _test_eof106;
3763
3814
  case 106:
3764
- #line 3765 "hpricot_scan.c"
3815
+ #line 3816 "hpricot_scan.c"
3765
3816
  switch( (*p) ) {
3766
3817
  case 13: goto tr248;
3767
3818
  case 32: goto tr248;
@@ -3779,14 +3830,14 @@ case 106:
3779
3830
  goto tr248;
3780
3831
  goto tr247;
3781
3832
  tr247:
3782
- #line 111 "hpricot_scan.rl"
3833
+ #line 134 "hpricot_scan.rl"
3783
3834
  { mark_aval = p; }
3784
3835
  goto st107;
3785
3836
  st107:
3786
3837
  if ( ++p == pe )
3787
3838
  goto _test_eof107;
3788
3839
  case 107:
3789
- #line 3790 "hpricot_scan.c"
3840
+ #line 3841 "hpricot_scan.c"
3790
3841
  switch( (*p) ) {
3791
3842
  case 13: goto tr255;
3792
3843
  case 32: goto tr255;
@@ -3803,42 +3854,42 @@ case 107:
3803
3854
  goto tr255;
3804
3855
  goto st107;
3805
3856
  tr256:
3806
- #line 116 "hpricot_scan.rl"
3857
+ #line 139 "hpricot_scan.rl"
3807
3858
  {
3808
3859
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3809
3860
  else { SET(aval, p); }
3810
3861
  }
3811
3862
  goto st108;
3812
3863
  tr327:
3813
- #line 111 "hpricot_scan.rl"
3864
+ #line 134 "hpricot_scan.rl"
3814
3865
  { mark_aval = p; }
3815
- #line 116 "hpricot_scan.rl"
3866
+ #line 139 "hpricot_scan.rl"
3816
3867
  {
3817
3868
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3818
3869
  else { SET(aval, p); }
3819
3870
  }
3820
3871
  goto st108;
3821
3872
  tr281:
3822
- #line 111 "hpricot_scan.rl"
3873
+ #line 134 "hpricot_scan.rl"
3823
3874
  { mark_aval = p; }
3824
- #line 115 "hpricot_scan.rl"
3875
+ #line 138 "hpricot_scan.rl"
3825
3876
  { SET(aval, p); }
3826
3877
  goto st108;
3827
3878
  tr222:
3828
- #line 115 "hpricot_scan.rl"
3879
+ #line 138 "hpricot_scan.rl"
3829
3880
  { SET(aval, p); }
3830
3881
  goto st108;
3831
3882
  tr213:
3832
- #line 115 "hpricot_scan.rl"
3883
+ #line 138 "hpricot_scan.rl"
3833
3884
  { SET(aval, p); }
3834
- #line 111 "hpricot_scan.rl"
3885
+ #line 134 "hpricot_scan.rl"
3835
3886
  { mark_aval = p; }
3836
3887
  goto st108;
3837
3888
  st108:
3838
3889
  if ( ++p == pe )
3839
3890
  goto _test_eof108;
3840
3891
  case 108:
3841
- #line 3842 "hpricot_scan.c"
3892
+ #line 3893 "hpricot_scan.c"
3842
3893
  switch( (*p) ) {
3843
3894
  case 13: goto tr255;
3844
3895
  case 32: goto tr255;
@@ -3866,46 +3917,46 @@ case 108:
3866
3917
  goto tr260;
3867
3918
  goto st107;
3868
3919
  tr260:
3869
- #line 134 "hpricot_scan.rl"
3920
+ #line 168 "hpricot_scan.rl"
3870
3921
  {
3871
- if (!S->xml)
3922
+ if (!S->xml && !NIL_P(akey))
3872
3923
  akey = rb_funcall(akey, s_downcase, 0);
3873
3924
  ATTR(akey, aval);
3874
3925
  }
3875
- #line 127 "hpricot_scan.rl"
3926
+ #line 161 "hpricot_scan.rl"
3876
3927
  {
3877
3928
  akey = Qnil;
3878
3929
  aval = Qnil;
3879
3930
  mark_akey = NULL;
3880
3931
  mark_aval = NULL;
3881
3932
  }
3882
- #line 112 "hpricot_scan.rl"
3933
+ #line 135 "hpricot_scan.rl"
3883
3934
  { mark_akey = p; }
3884
3935
  goto st109;
3885
3936
  tr279:
3886
- #line 111 "hpricot_scan.rl"
3887
- { mark_aval = p; }
3888
3937
  #line 134 "hpricot_scan.rl"
3938
+ { mark_aval = p; }
3939
+ #line 168 "hpricot_scan.rl"
3889
3940
  {
3890
- if (!S->xml)
3941
+ if (!S->xml && !NIL_P(akey))
3891
3942
  akey = rb_funcall(akey, s_downcase, 0);
3892
3943
  ATTR(akey, aval);
3893
3944
  }
3894
- #line 127 "hpricot_scan.rl"
3945
+ #line 161 "hpricot_scan.rl"
3895
3946
  {
3896
3947
  akey = Qnil;
3897
3948
  aval = Qnil;
3898
3949
  mark_akey = NULL;
3899
3950
  mark_aval = NULL;
3900
3951
  }
3901
- #line 112 "hpricot_scan.rl"
3952
+ #line 135 "hpricot_scan.rl"
3902
3953
  { mark_akey = p; }
3903
3954
  goto st109;
3904
3955
  st109:
3905
3956
  if ( ++p == pe )
3906
3957
  goto _test_eof109;
3907
3958
  case 109:
3908
- #line 3909 "hpricot_scan.c"
3959
+ #line 3960 "hpricot_scan.c"
3909
3960
  switch( (*p) ) {
3910
3961
  case 13: goto tr263;
3911
3962
  case 32: goto tr263;
@@ -3934,16 +3985,16 @@ case 109:
3934
3985
  goto st109;
3935
3986
  goto st107;
3936
3987
  tr270:
3937
- #line 116 "hpricot_scan.rl"
3988
+ #line 139 "hpricot_scan.rl"
3938
3989
  {
3939
3990
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3940
3991
  else { SET(aval, p); }
3941
3992
  }
3942
3993
  goto st110;
3943
3994
  tr264:
3944
- #line 120 "hpricot_scan.rl"
3995
+ #line 143 "hpricot_scan.rl"
3945
3996
  { SET(akey, p); }
3946
- #line 116 "hpricot_scan.rl"
3997
+ #line 139 "hpricot_scan.rl"
3947
3998
  {
3948
3999
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3949
4000
  else { SET(aval, p); }
@@ -3953,7 +4004,7 @@ st110:
3953
4004
  if ( ++p == pe )
3954
4005
  goto _test_eof110;
3955
4006
  case 110:
3956
- #line 3957 "hpricot_scan.c"
4007
+ #line 4008 "hpricot_scan.c"
3957
4008
  switch( (*p) ) {
3958
4009
  case 13: goto tr269;
3959
4010
  case 32: goto tr269;
@@ -3982,81 +4033,81 @@ case 110:
3982
4033
  goto tr260;
3983
4034
  goto st107;
3984
4035
  tr252:
3985
- #line 111 "hpricot_scan.rl"
3986
- { mark_aval = p; }
3987
4036
  #line 134 "hpricot_scan.rl"
4037
+ { mark_aval = p; }
4038
+ #line 168 "hpricot_scan.rl"
3988
4039
  {
3989
- if (!S->xml)
4040
+ if (!S->xml && !NIL_P(akey))
3990
4041
  akey = rb_funcall(akey, s_downcase, 0);
3991
4042
  ATTR(akey, aval);
3992
4043
  }
3993
4044
  goto st111;
3994
4045
  tr257:
3995
- #line 116 "hpricot_scan.rl"
4046
+ #line 139 "hpricot_scan.rl"
3996
4047
  {
3997
4048
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
3998
4049
  else { SET(aval, p); }
3999
4050
  }
4000
- #line 134 "hpricot_scan.rl"
4051
+ #line 168 "hpricot_scan.rl"
4001
4052
  {
4002
- if (!S->xml)
4053
+ if (!S->xml && !NIL_P(akey))
4003
4054
  akey = rb_funcall(akey, s_downcase, 0);
4004
4055
  ATTR(akey, aval);
4005
4056
  }
4006
4057
  goto st111;
4007
4058
  tr261:
4008
- #line 134 "hpricot_scan.rl"
4059
+ #line 168 "hpricot_scan.rl"
4009
4060
  {
4010
- if (!S->xml)
4061
+ if (!S->xml && !NIL_P(akey))
4011
4062
  akey = rb_funcall(akey, s_downcase, 0);
4012
4063
  ATTR(akey, aval);
4013
4064
  }
4014
- #line 116 "hpricot_scan.rl"
4065
+ #line 139 "hpricot_scan.rl"
4015
4066
  {
4016
4067
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4017
4068
  else { SET(aval, p); }
4018
4069
  }
4019
4070
  goto st111;
4020
4071
  tr266:
4021
- #line 116 "hpricot_scan.rl"
4072
+ #line 139 "hpricot_scan.rl"
4022
4073
  {
4023
4074
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4024
4075
  else { SET(aval, p); }
4025
4076
  }
4026
- #line 120 "hpricot_scan.rl"
4077
+ #line 143 "hpricot_scan.rl"
4027
4078
  { SET(akey, p); }
4028
- #line 134 "hpricot_scan.rl"
4079
+ #line 168 "hpricot_scan.rl"
4029
4080
  {
4030
- if (!S->xml)
4081
+ if (!S->xml && !NIL_P(akey))
4031
4082
  akey = rb_funcall(akey, s_downcase, 0);
4032
4083
  ATTR(akey, aval);
4033
4084
  }
4034
4085
  goto st111;
4035
4086
  tr276:
4036
- #line 111 "hpricot_scan.rl"
4087
+ #line 134 "hpricot_scan.rl"
4037
4088
  { mark_aval = p; }
4038
- #line 116 "hpricot_scan.rl"
4089
+ #line 139 "hpricot_scan.rl"
4039
4090
  {
4040
4091
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4041
4092
  else { SET(aval, p); }
4042
4093
  }
4043
- #line 134 "hpricot_scan.rl"
4094
+ #line 168 "hpricot_scan.rl"
4044
4095
  {
4045
- if (!S->xml)
4096
+ if (!S->xml && !NIL_P(akey))
4046
4097
  akey = rb_funcall(akey, s_downcase, 0);
4047
4098
  ATTR(akey, aval);
4048
4099
  }
4049
4100
  goto st111;
4050
4101
  tr280:
4051
- #line 111 "hpricot_scan.rl"
4052
- { mark_aval = p; }
4053
4102
  #line 134 "hpricot_scan.rl"
4103
+ { mark_aval = p; }
4104
+ #line 168 "hpricot_scan.rl"
4054
4105
  {
4055
- if (!S->xml)
4106
+ if (!S->xml && !NIL_P(akey))
4056
4107
  akey = rb_funcall(akey, s_downcase, 0);
4057
4108
  ATTR(akey, aval);
4058
4109
  }
4059
- #line 116 "hpricot_scan.rl"
4110
+ #line 139 "hpricot_scan.rl"
4060
4111
  {
4061
4112
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4062
4113
  else { SET(aval, p); }
@@ -4066,7 +4117,7 @@ st111:
4066
4117
  if ( ++p == pe )
4067
4118
  goto _test_eof111;
4068
4119
  case 111:
4069
- #line 4070 "hpricot_scan.c"
4120
+ #line 4121 "hpricot_scan.c"
4070
4121
  switch( (*p) ) {
4071
4122
  case 13: goto tr255;
4072
4123
  case 32: goto tr255;
@@ -4083,14 +4134,14 @@ case 111:
4083
4134
  goto tr255;
4084
4135
  goto st107;
4085
4136
  tr253:
4086
- #line 111 "hpricot_scan.rl"
4137
+ #line 134 "hpricot_scan.rl"
4087
4138
  { mark_aval = p; }
4088
4139
  goto st112;
4089
4140
  st112:
4090
4141
  if ( ++p == pe )
4091
4142
  goto _test_eof112;
4092
4143
  case 112:
4093
- #line 4094 "hpricot_scan.c"
4144
+ #line 4145 "hpricot_scan.c"
4094
4145
  switch( (*p) ) {
4095
4146
  case 13: goto tr255;
4096
4147
  case 32: goto tr255;
@@ -4107,18 +4158,18 @@ case 112:
4107
4158
  goto tr255;
4108
4159
  goto st107;
4109
4160
  tr249:
4110
- #line 111 "hpricot_scan.rl"
4161
+ #line 134 "hpricot_scan.rl"
4111
4162
  { mark_aval = p; }
4112
4163
  goto st113;
4113
4164
  tr267:
4114
- #line 120 "hpricot_scan.rl"
4165
+ #line 143 "hpricot_scan.rl"
4115
4166
  { SET(akey, p); }
4116
4167
  goto st113;
4117
4168
  st113:
4118
4169
  if ( ++p == pe )
4119
4170
  goto _test_eof113;
4120
4171
  case 113:
4121
- #line 4122 "hpricot_scan.c"
4172
+ #line 4173 "hpricot_scan.c"
4122
4173
  switch( (*p) ) {
4123
4174
  case 13: goto tr272;
4124
4175
  case 32: goto tr272;
@@ -4136,13 +4187,13 @@ case 113:
4136
4187
  goto tr272;
4137
4188
  goto tr247;
4138
4189
  tr277:
4139
- #line 111 "hpricot_scan.rl"
4190
+ #line 134 "hpricot_scan.rl"
4140
4191
  { mark_aval = p; }
4141
4192
  goto st114;
4142
4193
  tr272:
4143
- #line 111 "hpricot_scan.rl"
4194
+ #line 134 "hpricot_scan.rl"
4144
4195
  { mark_aval = p; }
4145
- #line 116 "hpricot_scan.rl"
4196
+ #line 139 "hpricot_scan.rl"
4146
4197
  {
4147
4198
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4148
4199
  else { SET(aval, p); }
@@ -4152,7 +4203,7 @@ st114:
4152
4203
  if ( ++p == pe )
4153
4204
  goto _test_eof114;
4154
4205
  case 114:
4155
- #line 4156 "hpricot_scan.c"
4206
+ #line 4207 "hpricot_scan.c"
4156
4207
  switch( (*p) ) {
4157
4208
  case 13: goto tr277;
4158
4209
  case 32: goto tr277;
@@ -4181,13 +4232,13 @@ case 114:
4181
4232
  goto tr279;
4182
4233
  goto tr247;
4183
4234
  tr278:
4184
- #line 111 "hpricot_scan.rl"
4235
+ #line 134 "hpricot_scan.rl"
4185
4236
  { mark_aval = p; }
4186
4237
  goto st115;
4187
4238
  tr273:
4188
- #line 111 "hpricot_scan.rl"
4239
+ #line 134 "hpricot_scan.rl"
4189
4240
  { mark_aval = p; }
4190
- #line 116 "hpricot_scan.rl"
4241
+ #line 139 "hpricot_scan.rl"
4191
4242
  {
4192
4243
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4193
4244
  else { SET(aval, p); }
@@ -4197,7 +4248,7 @@ st115:
4197
4248
  if ( ++p == pe )
4198
4249
  goto _test_eof115;
4199
4250
  case 115:
4200
- #line 4201 "hpricot_scan.c"
4251
+ #line 4252 "hpricot_scan.c"
4201
4252
  switch( (*p) ) {
4202
4253
  case 13: goto tr272;
4203
4254
  case 32: goto tr272;
@@ -4246,30 +4297,30 @@ case 116:
4246
4297
  goto tr211;
4247
4298
  goto tr210;
4248
4299
  tr221:
4249
- #line 116 "hpricot_scan.rl"
4300
+ #line 139 "hpricot_scan.rl"
4250
4301
  {
4251
4302
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4252
4303
  else { SET(aval, p); }
4253
4304
  }
4254
4305
  goto st117;
4255
4306
  tr212:
4256
- #line 111 "hpricot_scan.rl"
4307
+ #line 134 "hpricot_scan.rl"
4257
4308
  { mark_aval = p; }
4258
- #line 116 "hpricot_scan.rl"
4309
+ #line 139 "hpricot_scan.rl"
4259
4310
  {
4260
4311
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4261
4312
  else { SET(aval, p); }
4262
4313
  }
4263
4314
  goto st117;
4264
4315
  tr314:
4265
- #line 115 "hpricot_scan.rl"
4316
+ #line 138 "hpricot_scan.rl"
4266
4317
  { SET(aval, p); }
4267
4318
  goto st117;
4268
4319
  st117:
4269
4320
  if ( ++p == pe )
4270
4321
  goto _test_eof117;
4271
4322
  case 117:
4272
- #line 4273 "hpricot_scan.c"
4323
+ #line 4324 "hpricot_scan.c"
4273
4324
  switch( (*p) ) {
4274
4325
  case 13: goto tr220;
4275
4326
  case 32: goto tr220;
@@ -4298,46 +4349,46 @@ case 117:
4298
4349
  goto tr282;
4299
4350
  goto st97;
4300
4351
  tr282:
4301
- #line 134 "hpricot_scan.rl"
4352
+ #line 168 "hpricot_scan.rl"
4302
4353
  {
4303
- if (!S->xml)
4354
+ if (!S->xml && !NIL_P(akey))
4304
4355
  akey = rb_funcall(akey, s_downcase, 0);
4305
4356
  ATTR(akey, aval);
4306
4357
  }
4307
- #line 127 "hpricot_scan.rl"
4358
+ #line 161 "hpricot_scan.rl"
4308
4359
  {
4309
4360
  akey = Qnil;
4310
4361
  aval = Qnil;
4311
4362
  mark_akey = NULL;
4312
4363
  mark_aval = NULL;
4313
4364
  }
4314
- #line 112 "hpricot_scan.rl"
4365
+ #line 135 "hpricot_scan.rl"
4315
4366
  { mark_akey = p; }
4316
4367
  goto st118;
4317
4368
  tr307:
4318
- #line 111 "hpricot_scan.rl"
4319
- { mark_aval = p; }
4320
4369
  #line 134 "hpricot_scan.rl"
4370
+ { mark_aval = p; }
4371
+ #line 168 "hpricot_scan.rl"
4321
4372
  {
4322
- if (!S->xml)
4373
+ if (!S->xml && !NIL_P(akey))
4323
4374
  akey = rb_funcall(akey, s_downcase, 0);
4324
4375
  ATTR(akey, aval);
4325
4376
  }
4326
- #line 127 "hpricot_scan.rl"
4377
+ #line 161 "hpricot_scan.rl"
4327
4378
  {
4328
4379
  akey = Qnil;
4329
4380
  aval = Qnil;
4330
4381
  mark_akey = NULL;
4331
4382
  mark_aval = NULL;
4332
4383
  }
4333
- #line 112 "hpricot_scan.rl"
4384
+ #line 135 "hpricot_scan.rl"
4334
4385
  { mark_akey = p; }
4335
4386
  goto st118;
4336
4387
  st118:
4337
4388
  if ( ++p == pe )
4338
4389
  goto _test_eof118;
4339
4390
  case 118:
4340
- #line 4341 "hpricot_scan.c"
4391
+ #line 4392 "hpricot_scan.c"
4341
4392
  switch( (*p) ) {
4342
4393
  case 13: goto tr285;
4343
4394
  case 32: goto tr285;
@@ -4367,20 +4418,20 @@ case 118:
4367
4418
  goto st118;
4368
4419
  goto st97;
4369
4420
  tr293:
4370
- #line 120 "hpricot_scan.rl"
4421
+ #line 143 "hpricot_scan.rl"
4371
4422
  { SET(akey, p); }
4372
4423
  goto st119;
4373
4424
  tr323:
4374
- #line 116 "hpricot_scan.rl"
4425
+ #line 139 "hpricot_scan.rl"
4375
4426
  {
4376
4427
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4377
4428
  else { SET(aval, p); }
4378
4429
  }
4379
4430
  goto st119;
4380
4431
  tr285:
4381
- #line 120 "hpricot_scan.rl"
4432
+ #line 143 "hpricot_scan.rl"
4382
4433
  { SET(akey, p); }
4383
- #line 116 "hpricot_scan.rl"
4434
+ #line 139 "hpricot_scan.rl"
4384
4435
  {
4385
4436
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4386
4437
  else { SET(aval, p); }
@@ -4390,7 +4441,7 @@ st119:
4390
4441
  if ( ++p == pe )
4391
4442
  goto _test_eof119;
4392
4443
  case 119:
4393
- #line 4394 "hpricot_scan.c"
4444
+ #line 4445 "hpricot_scan.c"
4394
4445
  switch( (*p) ) {
4395
4446
  case 32: goto st119;
4396
4447
  case 34: goto tr228;
@@ -4415,46 +4466,46 @@ case 119:
4415
4466
  goto tr229;
4416
4467
  goto st99;
4417
4468
  tr229:
4418
- #line 134 "hpricot_scan.rl"
4469
+ #line 168 "hpricot_scan.rl"
4419
4470
  {
4420
- if (!S->xml)
4471
+ if (!S->xml && !NIL_P(akey))
4421
4472
  akey = rb_funcall(akey, s_downcase, 0);
4422
4473
  ATTR(akey, aval);
4423
4474
  }
4424
- #line 127 "hpricot_scan.rl"
4475
+ #line 161 "hpricot_scan.rl"
4425
4476
  {
4426
4477
  akey = Qnil;
4427
4478
  aval = Qnil;
4428
4479
  mark_akey = NULL;
4429
4480
  mark_aval = NULL;
4430
4481
  }
4431
- #line 112 "hpricot_scan.rl"
4482
+ #line 135 "hpricot_scan.rl"
4432
4483
  { mark_akey = p; }
4433
4484
  goto st120;
4434
4485
  tr318:
4435
- #line 111 "hpricot_scan.rl"
4436
- { mark_aval = p; }
4437
4486
  #line 134 "hpricot_scan.rl"
4487
+ { mark_aval = p; }
4488
+ #line 168 "hpricot_scan.rl"
4438
4489
  {
4439
- if (!S->xml)
4490
+ if (!S->xml && !NIL_P(akey))
4440
4491
  akey = rb_funcall(akey, s_downcase, 0);
4441
4492
  ATTR(akey, aval);
4442
4493
  }
4443
- #line 127 "hpricot_scan.rl"
4494
+ #line 161 "hpricot_scan.rl"
4444
4495
  {
4445
4496
  akey = Qnil;
4446
4497
  aval = Qnil;
4447
4498
  mark_akey = NULL;
4448
4499
  mark_aval = NULL;
4449
4500
  }
4450
- #line 112 "hpricot_scan.rl"
4501
+ #line 135 "hpricot_scan.rl"
4451
4502
  { mark_akey = p; }
4452
4503
  goto st120;
4453
4504
  st120:
4454
4505
  if ( ++p == pe )
4455
4506
  goto _test_eof120;
4456
4507
  case 120:
4457
- #line 4458 "hpricot_scan.c"
4508
+ #line 4509 "hpricot_scan.c"
4458
4509
  switch( (*p) ) {
4459
4510
  case 32: goto tr293;
4460
4511
  case 34: goto tr228;
@@ -4479,29 +4530,29 @@ case 120:
4479
4530
  goto st120;
4480
4531
  goto st99;
4481
4532
  tr295:
4482
- #line 120 "hpricot_scan.rl"
4533
+ #line 143 "hpricot_scan.rl"
4483
4534
  { SET(akey, p); }
4484
- #line 134 "hpricot_scan.rl"
4535
+ #line 168 "hpricot_scan.rl"
4485
4536
  {
4486
- if (!S->xml)
4537
+ if (!S->xml && !NIL_P(akey))
4487
4538
  akey = rb_funcall(akey, s_downcase, 0);
4488
4539
  ATTR(akey, aval);
4489
4540
  }
4490
4541
  goto st121;
4491
4542
  tr230:
4492
- #line 134 "hpricot_scan.rl"
4543
+ #line 168 "hpricot_scan.rl"
4493
4544
  {
4494
- if (!S->xml)
4545
+ if (!S->xml && !NIL_P(akey))
4495
4546
  akey = rb_funcall(akey, s_downcase, 0);
4496
4547
  ATTR(akey, aval);
4497
4548
  }
4498
4549
  goto st121;
4499
4550
  tr319:
4500
- #line 111 "hpricot_scan.rl"
4501
- { mark_aval = p; }
4502
4551
  #line 134 "hpricot_scan.rl"
4552
+ { mark_aval = p; }
4553
+ #line 168 "hpricot_scan.rl"
4503
4554
  {
4504
- if (!S->xml)
4555
+ if (!S->xml && !NIL_P(akey))
4505
4556
  akey = rb_funcall(akey, s_downcase, 0);
4506
4557
  ATTR(akey, aval);
4507
4558
  }
@@ -4510,7 +4561,7 @@ st121:
4510
4561
  if ( ++p == pe )
4511
4562
  goto _test_eof121;
4512
4563
  case 121:
4513
- #line 4514 "hpricot_scan.c"
4564
+ #line 4565 "hpricot_scan.c"
4514
4565
  switch( (*p) ) {
4515
4566
  case 34: goto tr228;
4516
4567
  case 39: goto tr174;
@@ -4519,147 +4570,147 @@ case 121:
4519
4570
  }
4520
4571
  goto st99;
4521
4572
  tr217:
4522
- #line 1 "hpricot_scan.rl"
4573
+ #line 1 "NONE"
4523
4574
  {te = p+1;}
4524
- #line 111 "hpricot_scan.rl"
4575
+ #line 134 "hpricot_scan.rl"
4525
4576
  { mark_aval = p; }
4526
- #line 116 "hpricot_scan.rl"
4577
+ #line 139 "hpricot_scan.rl"
4527
4578
  {
4528
4579
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4529
4580
  else { SET(aval, p); }
4530
4581
  }
4531
- #line 134 "hpricot_scan.rl"
4582
+ #line 168 "hpricot_scan.rl"
4532
4583
  {
4533
- if (!S->xml)
4584
+ if (!S->xml && !NIL_P(akey))
4534
4585
  akey = rb_funcall(akey, s_downcase, 0);
4535
4586
  ATTR(akey, aval);
4536
4587
  }
4537
- #line 68 "hpricot_scan.rl"
4588
+ #line 68 "hpricot_common.rl"
4538
4589
  {act = 10;}
4539
4590
  goto st211;
4540
4591
  tr225:
4541
- #line 1 "hpricot_scan.rl"
4592
+ #line 1 "NONE"
4542
4593
  {te = p+1;}
4543
- #line 116 "hpricot_scan.rl"
4594
+ #line 139 "hpricot_scan.rl"
4544
4595
  {
4545
4596
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4546
4597
  else { SET(aval, p); }
4547
4598
  }
4548
- #line 134 "hpricot_scan.rl"
4599
+ #line 168 "hpricot_scan.rl"
4549
4600
  {
4550
- if (!S->xml)
4601
+ if (!S->xml && !NIL_P(akey))
4551
4602
  akey = rb_funcall(akey, s_downcase, 0);
4552
4603
  ATTR(akey, aval);
4553
4604
  }
4554
- #line 68 "hpricot_scan.rl"
4605
+ #line 68 "hpricot_common.rl"
4555
4606
  {act = 10;}
4556
4607
  goto st211;
4557
4608
  tr231:
4558
- #line 1 "hpricot_scan.rl"
4609
+ #line 1 "NONE"
4559
4610
  {te = p+1;}
4560
- #line 134 "hpricot_scan.rl"
4611
+ #line 168 "hpricot_scan.rl"
4561
4612
  {
4562
- if (!S->xml)
4613
+ if (!S->xml && !NIL_P(akey))
4563
4614
  akey = rb_funcall(akey, s_downcase, 0);
4564
4615
  ATTR(akey, aval);
4565
4616
  }
4566
- #line 68 "hpricot_scan.rl"
4617
+ #line 68 "hpricot_common.rl"
4567
4618
  {act = 10;}
4568
4619
  goto st211;
4569
4620
  tr297:
4570
- #line 1 "hpricot_scan.rl"
4621
+ #line 1 "NONE"
4571
4622
  {te = p+1;}
4572
- #line 120 "hpricot_scan.rl"
4623
+ #line 143 "hpricot_scan.rl"
4573
4624
  { SET(akey, p); }
4574
- #line 134 "hpricot_scan.rl"
4625
+ #line 168 "hpricot_scan.rl"
4575
4626
  {
4576
- if (!S->xml)
4627
+ if (!S->xml && !NIL_P(akey))
4577
4628
  akey = rb_funcall(akey, s_downcase, 0);
4578
4629
  ATTR(akey, aval);
4579
4630
  }
4580
- #line 68 "hpricot_scan.rl"
4631
+ #line 68 "hpricot_common.rl"
4581
4632
  {act = 10;}
4582
4633
  goto st211;
4583
4634
  tr298:
4584
- #line 1 "hpricot_scan.rl"
4635
+ #line 1 "NONE"
4585
4636
  {te = p+1;}
4586
- #line 70 "hpricot_scan.rl"
4637
+ #line 70 "hpricot_common.rl"
4587
4638
  {act = 12;}
4588
4639
  goto st211;
4589
4640
  tr284:
4590
- #line 1 "hpricot_scan.rl"
4641
+ #line 1 "NONE"
4591
4642
  {te = p+1;}
4592
- #line 134 "hpricot_scan.rl"
4643
+ #line 168 "hpricot_scan.rl"
4593
4644
  {
4594
- if (!S->xml)
4645
+ if (!S->xml && !NIL_P(akey))
4595
4646
  akey = rb_funcall(akey, s_downcase, 0);
4596
4647
  ATTR(akey, aval);
4597
4648
  }
4598
- #line 116 "hpricot_scan.rl"
4649
+ #line 139 "hpricot_scan.rl"
4599
4650
  {
4600
4651
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4601
4652
  else { SET(aval, p); }
4602
4653
  }
4603
- #line 68 "hpricot_scan.rl"
4654
+ #line 68 "hpricot_common.rl"
4604
4655
  {act = 10;}
4605
4656
  goto st211;
4606
4657
  tr313:
4607
- #line 1 "hpricot_scan.rl"
4658
+ #line 1 "NONE"
4608
4659
  {te = p+1;}
4609
- #line 111 "hpricot_scan.rl"
4610
- { mark_aval = p; }
4611
4660
  #line 134 "hpricot_scan.rl"
4661
+ { mark_aval = p; }
4662
+ #line 168 "hpricot_scan.rl"
4612
4663
  {
4613
- if (!S->xml)
4664
+ if (!S->xml && !NIL_P(akey))
4614
4665
  akey = rb_funcall(akey, s_downcase, 0);
4615
4666
  ATTR(akey, aval);
4616
4667
  }
4617
- #line 116 "hpricot_scan.rl"
4668
+ #line 139 "hpricot_scan.rl"
4618
4669
  {
4619
4670
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4620
4671
  else { SET(aval, p); }
4621
4672
  }
4622
- #line 68 "hpricot_scan.rl"
4673
+ #line 68 "hpricot_common.rl"
4623
4674
  {act = 10;}
4624
4675
  goto st211;
4625
4676
  tr290:
4626
- #line 1 "hpricot_scan.rl"
4677
+ #line 1 "NONE"
4627
4678
  {te = p+1;}
4628
- #line 116 "hpricot_scan.rl"
4679
+ #line 139 "hpricot_scan.rl"
4629
4680
  {
4630
4681
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4631
4682
  else { SET(aval, p); }
4632
4683
  }
4633
- #line 120 "hpricot_scan.rl"
4684
+ #line 143 "hpricot_scan.rl"
4634
4685
  { SET(akey, p); }
4635
- #line 134 "hpricot_scan.rl"
4686
+ #line 168 "hpricot_scan.rl"
4636
4687
  {
4637
- if (!S->xml)
4688
+ if (!S->xml && !NIL_P(akey))
4638
4689
  akey = rb_funcall(akey, s_downcase, 0);
4639
4690
  ATTR(akey, aval);
4640
4691
  }
4641
- #line 68 "hpricot_scan.rl"
4692
+ #line 68 "hpricot_common.rl"
4642
4693
  {act = 10;}
4643
4694
  goto st211;
4644
4695
  tr320:
4645
- #line 1 "hpricot_scan.rl"
4696
+ #line 1 "NONE"
4646
4697
  {te = p+1;}
4647
- #line 111 "hpricot_scan.rl"
4648
- { mark_aval = p; }
4649
4698
  #line 134 "hpricot_scan.rl"
4699
+ { mark_aval = p; }
4700
+ #line 168 "hpricot_scan.rl"
4650
4701
  {
4651
- if (!S->xml)
4702
+ if (!S->xml && !NIL_P(akey))
4652
4703
  akey = rb_funcall(akey, s_downcase, 0);
4653
4704
  ATTR(akey, aval);
4654
4705
  }
4655
- #line 68 "hpricot_scan.rl"
4706
+ #line 68 "hpricot_common.rl"
4656
4707
  {act = 10;}
4657
4708
  goto st211;
4658
4709
  st211:
4659
4710
  if ( ++p == pe )
4660
4711
  goto _test_eof211;
4661
4712
  case 211:
4662
- #line 4663 "hpricot_scan.c"
4713
+ #line 4714 "hpricot_scan.c"
4663
4714
  switch( (*p) ) {
4664
4715
  case 34: goto tr228;
4665
4716
  case 39: goto tr174;
@@ -4667,14 +4718,14 @@ case 211:
4667
4718
  }
4668
4719
  goto st99;
4669
4720
  tr321:
4670
- #line 111 "hpricot_scan.rl"
4721
+ #line 134 "hpricot_scan.rl"
4671
4722
  { mark_aval = p; }
4672
4723
  goto st122;
4673
4724
  st122:
4674
4725
  if ( ++p == pe )
4675
4726
  goto _test_eof122;
4676
4727
  case 122:
4677
- #line 4678 "hpricot_scan.c"
4728
+ #line 4729 "hpricot_scan.c"
4678
4729
  switch( (*p) ) {
4679
4730
  case 34: goto tr299;
4680
4731
  case 39: goto tr299;
@@ -4682,14 +4733,14 @@ case 122:
4682
4733
  }
4683
4734
  goto st99;
4684
4735
  tr296:
4685
- #line 120 "hpricot_scan.rl"
4736
+ #line 143 "hpricot_scan.rl"
4686
4737
  { SET(akey, p); }
4687
4738
  goto st123;
4688
4739
  st123:
4689
4740
  if ( ++p == pe )
4690
4741
  goto _test_eof123;
4691
4742
  case 123:
4692
- #line 4693 "hpricot_scan.c"
4743
+ #line 4744 "hpricot_scan.c"
4693
4744
  switch( (*p) ) {
4694
4745
  case 13: goto tr300;
4695
4746
  case 32: goto tr300;
@@ -4707,14 +4758,14 @@ case 123:
4707
4758
  goto tr300;
4708
4759
  goto tr210;
4709
4760
  tr300:
4710
- #line 111 "hpricot_scan.rl"
4761
+ #line 134 "hpricot_scan.rl"
4711
4762
  { mark_aval = p; }
4712
4763
  goto st124;
4713
4764
  st124:
4714
4765
  if ( ++p == pe )
4715
4766
  goto _test_eof124;
4716
4767
  case 124:
4717
- #line 4718 "hpricot_scan.c"
4768
+ #line 4769 "hpricot_scan.c"
4718
4769
  switch( (*p) ) {
4719
4770
  case 13: goto tr305;
4720
4771
  case 32: goto tr305;
@@ -4732,13 +4783,13 @@ case 124:
4732
4783
  goto tr305;
4733
4784
  goto tr210;
4734
4785
  tr305:
4735
- #line 111 "hpricot_scan.rl"
4786
+ #line 134 "hpricot_scan.rl"
4736
4787
  { mark_aval = p; }
4737
4788
  goto st125;
4738
4789
  tr308:
4739
- #line 111 "hpricot_scan.rl"
4790
+ #line 134 "hpricot_scan.rl"
4740
4791
  { mark_aval = p; }
4741
- #line 116 "hpricot_scan.rl"
4792
+ #line 139 "hpricot_scan.rl"
4742
4793
  {
4743
4794
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4744
4795
  else { SET(aval, p); }
@@ -4748,7 +4799,7 @@ st125:
4748
4799
  if ( ++p == pe )
4749
4800
  goto _test_eof125;
4750
4801
  case 125:
4751
- #line 4752 "hpricot_scan.c"
4802
+ #line 4803 "hpricot_scan.c"
4752
4803
  switch( (*p) ) {
4753
4804
  case 13: goto tr305;
4754
4805
  case 32: goto tr305;
@@ -4777,13 +4828,13 @@ case 125:
4777
4828
  goto tr307;
4778
4829
  goto tr210;
4779
4830
  tr306:
4780
- #line 111 "hpricot_scan.rl"
4831
+ #line 134 "hpricot_scan.rl"
4781
4832
  { mark_aval = p; }
4782
4833
  goto st126;
4783
4834
  tr309:
4784
- #line 111 "hpricot_scan.rl"
4835
+ #line 134 "hpricot_scan.rl"
4785
4836
  { mark_aval = p; }
4786
- #line 116 "hpricot_scan.rl"
4837
+ #line 139 "hpricot_scan.rl"
4787
4838
  {
4788
4839
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4789
4840
  else { SET(aval, p); }
@@ -4793,7 +4844,7 @@ st126:
4793
4844
  if ( ++p == pe )
4794
4845
  goto _test_eof126;
4795
4846
  case 126:
4796
- #line 4797 "hpricot_scan.c"
4847
+ #line 4848 "hpricot_scan.c"
4797
4848
  switch( (*p) ) {
4798
4849
  case 13: goto tr308;
4799
4850
  case 32: goto tr308;
@@ -4822,14 +4873,14 @@ case 126:
4822
4873
  goto tr307;
4823
4874
  goto tr210;
4824
4875
  tr310:
4825
- #line 115 "hpricot_scan.rl"
4876
+ #line 138 "hpricot_scan.rl"
4826
4877
  { SET(aval, p); }
4827
4878
  goto st127;
4828
4879
  st127:
4829
4880
  if ( ++p == pe )
4830
4881
  goto _test_eof127;
4831
4882
  case 127:
4832
- #line 4833 "hpricot_scan.c"
4883
+ #line 4884 "hpricot_scan.c"
4833
4884
  switch( (*p) ) {
4834
4885
  case 13: goto tr211;
4835
4886
  case 32: goto tr211;
@@ -4858,81 +4909,81 @@ case 127:
4858
4909
  goto tr307;
4859
4910
  goto tr210;
4860
4911
  tr304:
4861
- #line 111 "hpricot_scan.rl"
4862
- { mark_aval = p; }
4863
4912
  #line 134 "hpricot_scan.rl"
4913
+ { mark_aval = p; }
4914
+ #line 168 "hpricot_scan.rl"
4864
4915
  {
4865
- if (!S->xml)
4916
+ if (!S->xml && !NIL_P(akey))
4866
4917
  akey = rb_funcall(akey, s_downcase, 0);
4867
4918
  ATTR(akey, aval);
4868
4919
  }
4869
4920
  goto st128;
4870
4921
  tr223:
4871
- #line 116 "hpricot_scan.rl"
4922
+ #line 139 "hpricot_scan.rl"
4872
4923
  {
4873
4924
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4874
4925
  else { SET(aval, p); }
4875
4926
  }
4876
- #line 134 "hpricot_scan.rl"
4927
+ #line 168 "hpricot_scan.rl"
4877
4928
  {
4878
- if (!S->xml)
4929
+ if (!S->xml && !NIL_P(akey))
4879
4930
  akey = rb_funcall(akey, s_downcase, 0);
4880
4931
  ATTR(akey, aval);
4881
4932
  }
4882
4933
  goto st128;
4883
4934
  tr283:
4884
- #line 134 "hpricot_scan.rl"
4935
+ #line 168 "hpricot_scan.rl"
4885
4936
  {
4886
- if (!S->xml)
4937
+ if (!S->xml && !NIL_P(akey))
4887
4938
  akey = rb_funcall(akey, s_downcase, 0);
4888
4939
  ATTR(akey, aval);
4889
4940
  }
4890
- #line 116 "hpricot_scan.rl"
4941
+ #line 139 "hpricot_scan.rl"
4891
4942
  {
4892
4943
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4893
4944
  else { SET(aval, p); }
4894
4945
  }
4895
4946
  goto st128;
4896
4947
  tr288:
4897
- #line 116 "hpricot_scan.rl"
4948
+ #line 139 "hpricot_scan.rl"
4898
4949
  {
4899
4950
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4900
4951
  else { SET(aval, p); }
4901
4952
  }
4902
- #line 120 "hpricot_scan.rl"
4953
+ #line 143 "hpricot_scan.rl"
4903
4954
  { SET(akey, p); }
4904
- #line 134 "hpricot_scan.rl"
4955
+ #line 168 "hpricot_scan.rl"
4905
4956
  {
4906
- if (!S->xml)
4957
+ if (!S->xml && !NIL_P(akey))
4907
4958
  akey = rb_funcall(akey, s_downcase, 0);
4908
4959
  ATTR(akey, aval);
4909
4960
  }
4910
4961
  goto st128;
4911
4962
  tr215:
4912
- #line 111 "hpricot_scan.rl"
4963
+ #line 134 "hpricot_scan.rl"
4913
4964
  { mark_aval = p; }
4914
- #line 116 "hpricot_scan.rl"
4965
+ #line 139 "hpricot_scan.rl"
4915
4966
  {
4916
4967
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4917
4968
  else { SET(aval, p); }
4918
4969
  }
4919
- #line 134 "hpricot_scan.rl"
4970
+ #line 168 "hpricot_scan.rl"
4920
4971
  {
4921
- if (!S->xml)
4972
+ if (!S->xml && !NIL_P(akey))
4922
4973
  akey = rb_funcall(akey, s_downcase, 0);
4923
4974
  ATTR(akey, aval);
4924
4975
  }
4925
4976
  goto st128;
4926
4977
  tr312:
4927
- #line 111 "hpricot_scan.rl"
4928
- { mark_aval = p; }
4929
4978
  #line 134 "hpricot_scan.rl"
4979
+ { mark_aval = p; }
4980
+ #line 168 "hpricot_scan.rl"
4930
4981
  {
4931
- if (!S->xml)
4982
+ if (!S->xml && !NIL_P(akey))
4932
4983
  akey = rb_funcall(akey, s_downcase, 0);
4933
4984
  ATTR(akey, aval);
4934
4985
  }
4935
- #line 116 "hpricot_scan.rl"
4986
+ #line 139 "hpricot_scan.rl"
4936
4987
  {
4937
4988
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
4938
4989
  else { SET(aval, p); }
@@ -4942,7 +4993,7 @@ st128:
4942
4993
  if ( ++p == pe )
4943
4994
  goto _test_eof128;
4944
4995
  case 128:
4945
- #line 4946 "hpricot_scan.c"
4996
+ #line 4997 "hpricot_scan.c"
4946
4997
  switch( (*p) ) {
4947
4998
  case 13: goto tr220;
4948
4999
  case 32: goto tr220;
@@ -4960,14 +5011,14 @@ case 128:
4960
5011
  goto tr220;
4961
5012
  goto st97;
4962
5013
  tr218:
4963
- #line 111 "hpricot_scan.rl"
5014
+ #line 134 "hpricot_scan.rl"
4964
5015
  { mark_aval = p; }
4965
5016
  goto st129;
4966
5017
  st129:
4967
5018
  if ( ++p == pe )
4968
5019
  goto _test_eof129;
4969
5020
  case 129:
4970
- #line 4971 "hpricot_scan.c"
5021
+ #line 5022 "hpricot_scan.c"
4971
5022
  switch( (*p) ) {
4972
5023
  case 13: goto tr220;
4973
5024
  case 32: goto tr220;
@@ -4985,14 +5036,14 @@ case 129:
4985
5036
  goto tr220;
4986
5037
  goto st97;
4987
5038
  tr311:
4988
- #line 115 "hpricot_scan.rl"
5039
+ #line 138 "hpricot_scan.rl"
4989
5040
  { SET(aval, p); }
4990
5041
  goto st130;
4991
5042
  st130:
4992
5043
  if ( ++p == pe )
4993
5044
  goto _test_eof130;
4994
5045
  case 130:
4995
- #line 4996 "hpricot_scan.c"
5046
+ #line 5047 "hpricot_scan.c"
4996
5047
  switch( (*p) ) {
4997
5048
  case 13: goto tr211;
4998
5049
  case 32: goto tr211;
@@ -5021,14 +5072,14 @@ case 130:
5021
5072
  goto tr307;
5022
5073
  goto tr210;
5023
5074
  tr302:
5024
- #line 115 "hpricot_scan.rl"
5075
+ #line 138 "hpricot_scan.rl"
5025
5076
  { SET(aval, p); }
5026
5077
  goto st131;
5027
5078
  st131:
5028
5079
  if ( ++p == pe )
5029
5080
  goto _test_eof131;
5030
5081
  case 131:
5031
- #line 5032 "hpricot_scan.c"
5082
+ #line 5083 "hpricot_scan.c"
5032
5083
  switch( (*p) ) {
5033
5084
  case 32: goto tr315;
5034
5085
  case 34: goto tr316;
@@ -5052,14 +5103,14 @@ case 131:
5052
5103
  goto tr318;
5053
5104
  goto tr216;
5054
5105
  tr303:
5055
- #line 115 "hpricot_scan.rl"
5106
+ #line 138 "hpricot_scan.rl"
5056
5107
  { SET(aval, p); }
5057
5108
  goto st132;
5058
5109
  st132:
5059
5110
  if ( ++p == pe )
5060
5111
  goto _test_eof132;
5061
5112
  case 132:
5062
- #line 5063 "hpricot_scan.c"
5113
+ #line 5114 "hpricot_scan.c"
5063
5114
  switch( (*p) ) {
5064
5115
  case 32: goto tr315;
5065
5116
  case 34: goto tr322;
@@ -5083,18 +5134,18 @@ case 132:
5083
5134
  goto tr318;
5084
5135
  goto tr216;
5085
5136
  tr301:
5086
- #line 111 "hpricot_scan.rl"
5137
+ #line 134 "hpricot_scan.rl"
5087
5138
  { mark_aval = p; }
5088
5139
  goto st133;
5089
5140
  tr289:
5090
- #line 120 "hpricot_scan.rl"
5141
+ #line 143 "hpricot_scan.rl"
5091
5142
  { SET(akey, p); }
5092
5143
  goto st133;
5093
5144
  st133:
5094
5145
  if ( ++p == pe )
5095
5146
  goto _test_eof133;
5096
5147
  case 133:
5097
- #line 5098 "hpricot_scan.c"
5148
+ #line 5149 "hpricot_scan.c"
5098
5149
  switch( (*p) ) {
5099
5150
  case 13: goto tr308;
5100
5151
  case 32: goto tr308;
@@ -5112,16 +5163,16 @@ case 133:
5112
5163
  goto tr308;
5113
5164
  goto tr210;
5114
5165
  tr324:
5115
- #line 116 "hpricot_scan.rl"
5166
+ #line 139 "hpricot_scan.rl"
5116
5167
  {
5117
5168
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
5118
5169
  else { SET(aval, p); }
5119
5170
  }
5120
5171
  goto st134;
5121
5172
  tr286:
5122
- #line 120 "hpricot_scan.rl"
5173
+ #line 143 "hpricot_scan.rl"
5123
5174
  { SET(akey, p); }
5124
- #line 116 "hpricot_scan.rl"
5175
+ #line 139 "hpricot_scan.rl"
5125
5176
  {
5126
5177
  if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); }
5127
5178
  else { SET(aval, p); }
@@ -5131,7 +5182,7 @@ st134:
5131
5182
  if ( ++p == pe )
5132
5183
  goto _test_eof134;
5133
5184
  case 134:
5134
- #line 5135 "hpricot_scan.c"
5185
+ #line 5186 "hpricot_scan.c"
5135
5186
  switch( (*p) ) {
5136
5187
  case 13: goto tr323;
5137
5188
  case 32: goto tr323;
@@ -5161,14 +5212,14 @@ case 134:
5161
5212
  goto tr282;
5162
5213
  goto st97;
5163
5214
  tr275:
5164
- #line 115 "hpricot_scan.rl"
5215
+ #line 138 "hpricot_scan.rl"
5165
5216
  { SET(aval, p); }
5166
5217
  goto st135;
5167
5218
  st135:
5168
5219
  if ( ++p == pe )
5169
5220
  goto _test_eof135;
5170
5221
  case 135:
5171
- #line 5172 "hpricot_scan.c"
5222
+ #line 5223 "hpricot_scan.c"
5172
5223
  switch( (*p) ) {
5173
5224
  case 13: goto tr326;
5174
5225
  case 32: goto tr326;
@@ -5206,14 +5257,14 @@ case 136:
5206
5257
  }
5207
5258
  goto tr216;
5208
5259
  tr251:
5209
- #line 115 "hpricot_scan.rl"
5260
+ #line 138 "hpricot_scan.rl"
5210
5261
  { SET(aval, p); }
5211
5262
  goto st137;
5212
5263
  st137:
5213
5264
  if ( ++p == pe )
5214
5265
  goto _test_eof137;
5215
5266
  case 137:
5216
- #line 5217 "hpricot_scan.c"
5267
+ #line 5268 "hpricot_scan.c"
5217
5268
  switch( (*p) ) {
5218
5269
  case 32: goto tr330;
5219
5270
  case 39: goto tr331;
@@ -5236,14 +5287,14 @@ case 137:
5236
5287
  goto tr332;
5237
5288
  goto tr328;
5238
5289
  tr248:
5239
- #line 111 "hpricot_scan.rl"
5290
+ #line 134 "hpricot_scan.rl"
5240
5291
  { mark_aval = p; }
5241
5292
  goto st138;
5242
5293
  st138:
5243
5294
  if ( ++p == pe )
5244
5295
  goto _test_eof138;
5245
5296
  case 138:
5246
- #line 5247 "hpricot_scan.c"
5297
+ #line 5298 "hpricot_scan.c"
5247
5298
  switch( (*p) ) {
5248
5299
  case 13: goto tr277;
5249
5300
  case 32: goto tr277;
@@ -5261,14 +5312,14 @@ case 138:
5261
5312
  goto tr277;
5262
5313
  goto tr247;
5263
5314
  tr185:
5264
- #line 115 "hpricot_scan.rl"
5315
+ #line 138 "hpricot_scan.rl"
5265
5316
  { SET(aval, p); }
5266
5317
  goto st139;
5267
5318
  st139:
5268
5319
  if ( ++p == pe )
5269
5320
  goto _test_eof139;
5270
5321
  case 139:
5271
- #line 5272 "hpricot_scan.c"
5322
+ #line 5323 "hpricot_scan.c"
5272
5323
  switch( (*p) ) {
5273
5324
  case 32: goto tr336;
5274
5325
  case 34: goto tr331;
@@ -5338,14 +5389,14 @@ case 143:
5338
5389
  }
5339
5390
  goto tr328;
5340
5391
  tr120:
5341
- #line 111 "hpricot_scan.rl"
5392
+ #line 134 "hpricot_scan.rl"
5342
5393
  { mark_aval = p; }
5343
5394
  goto st144;
5344
5395
  st144:
5345
5396
  if ( ++p == pe )
5346
5397
  goto _test_eof144;
5347
5398
  case 144:
5348
- #line 5349 "hpricot_scan.c"
5399
+ #line 5400 "hpricot_scan.c"
5349
5400
  switch( (*p) ) {
5350
5401
  case 13: goto tr148;
5351
5402
  case 32: goto tr148;
@@ -5377,14 +5428,14 @@ case 145:
5377
5428
  goto tr342;
5378
5429
  goto tr0;
5379
5430
  tr342:
5380
- #line 46 "hpricot_scan.rl"
5431
+ #line 46 "hpricot_common.rl"
5381
5432
  { TEXT_PASS(); }
5382
5433
  goto st146;
5383
5434
  st146:
5384
5435
  if ( ++p == pe )
5385
5436
  goto _test_eof146;
5386
5437
  case 146:
5387
- #line 5388 "hpricot_scan.c"
5438
+ #line 5439 "hpricot_scan.c"
5388
5439
  switch( (*p) ) {
5389
5440
  case 32: goto st212;
5390
5441
  case 63: goto st146;
@@ -5415,14 +5466,14 @@ case 212:
5415
5466
  goto st212;
5416
5467
  goto tr420;
5417
5468
  tr343:
5418
- #line 46 "hpricot_scan.rl"
5469
+ #line 46 "hpricot_common.rl"
5419
5470
  { TEXT_PASS(); }
5420
5471
  goto st147;
5421
5472
  st147:
5422
5473
  if ( ++p == pe )
5423
5474
  goto _test_eof147;
5424
5475
  case 147:
5425
- #line 5426 "hpricot_scan.c"
5476
+ #line 5477 "hpricot_scan.c"
5426
5477
  switch( (*p) ) {
5427
5478
  case 32: goto st212;
5428
5479
  case 63: goto st146;
@@ -5494,14 +5545,14 @@ case 149:
5494
5545
  goto st146;
5495
5546
  goto tr0;
5496
5547
  tr348:
5497
- #line 1 "hpricot_scan.rl"
5548
+ #line 1 "NONE"
5498
5549
  {te = p+1;}
5499
5550
  goto st213;
5500
5551
  st213:
5501
5552
  if ( ++p == pe )
5502
5553
  goto _test_eof213;
5503
5554
  case 213:
5504
- #line 5505 "hpricot_scan.c"
5555
+ #line 5556 "hpricot_scan.c"
5505
5556
  switch( (*p) ) {
5506
5557
  case 32: goto tr348;
5507
5558
  case 118: goto st150;
@@ -5593,14 +5644,14 @@ case 158:
5593
5644
  goto tr359;
5594
5645
  goto tr349;
5595
5646
  tr359:
5596
- #line 111 "hpricot_scan.rl"
5647
+ #line 134 "hpricot_scan.rl"
5597
5648
  { mark_aval = p; }
5598
5649
  goto st159;
5599
5650
  st159:
5600
5651
  if ( ++p == pe )
5601
5652
  goto _test_eof159;
5602
5653
  case 159:
5603
- #line 5604 "hpricot_scan.c"
5654
+ #line 5655 "hpricot_scan.c"
5604
5655
  switch( (*p) ) {
5605
5656
  case 34: goto tr360;
5606
5657
  case 95: goto st159;
@@ -5618,14 +5669,14 @@ case 159:
5618
5669
  goto st159;
5619
5670
  goto tr349;
5620
5671
  tr360:
5621
- #line 121 "hpricot_scan.rl"
5672
+ #line 144 "hpricot_scan.rl"
5622
5673
  { SET(aval, p); ATTR(ID2SYM(rb_intern("version")), aval); }
5623
5674
  goto st160;
5624
5675
  st160:
5625
5676
  if ( ++p == pe )
5626
5677
  goto _test_eof160;
5627
5678
  case 160:
5628
- #line 5629 "hpricot_scan.c"
5679
+ #line 5680 "hpricot_scan.c"
5629
5680
  switch( (*p) ) {
5630
5681
  case 32: goto st161;
5631
5682
  case 62: goto tr363;
@@ -5738,14 +5789,14 @@ case 172:
5738
5789
  goto tr377;
5739
5790
  goto tr349;
5740
5791
  tr377:
5741
- #line 111 "hpricot_scan.rl"
5792
+ #line 134 "hpricot_scan.rl"
5742
5793
  { mark_aval = p; }
5743
5794
  goto st173;
5744
5795
  st173:
5745
5796
  if ( ++p == pe )
5746
5797
  goto _test_eof173;
5747
5798
  case 173:
5748
- #line 5749 "hpricot_scan.c"
5799
+ #line 5800 "hpricot_scan.c"
5749
5800
  switch( (*p) ) {
5750
5801
  case 34: goto tr378;
5751
5802
  case 95: goto st173;
@@ -5763,14 +5814,25 @@ case 173:
5763
5814
  goto st173;
5764
5815
  goto tr349;
5765
5816
  tr378:
5766
- #line 122 "hpricot_scan.rl"
5767
- { SET(aval, p); ATTR(ID2SYM(rb_intern("encoding")), aval); }
5817
+ #line 145 "hpricot_scan.rl"
5818
+ {
5819
+ #ifdef HAVE_RUBY_ENCODING_H
5820
+ if (mark_aval < p) {
5821
+ char psave = *p;
5822
+ *p = '\0';
5823
+ encoding_index = rb_enc_find_index(mark_aval);
5824
+ *p = psave;
5825
+ }
5826
+ #endif
5827
+ SET(aval, p);
5828
+ ATTR(ID2SYM(rb_intern("encoding")), aval);
5829
+ }
5768
5830
  goto st174;
5769
5831
  st174:
5770
5832
  if ( ++p == pe )
5771
5833
  goto _test_eof174;
5772
5834
  case 174:
5773
- #line 5774 "hpricot_scan.c"
5835
+ #line 5836 "hpricot_scan.c"
5774
5836
  switch( (*p) ) {
5775
5837
  case 32: goto st175;
5776
5838
  case 62: goto tr363;
@@ -5888,14 +5950,14 @@ case 187:
5888
5950
  }
5889
5951
  goto tr349;
5890
5952
  tr393:
5891
- #line 111 "hpricot_scan.rl"
5953
+ #line 134 "hpricot_scan.rl"
5892
5954
  { mark_aval = p; }
5893
5955
  goto st188;
5894
5956
  st188:
5895
5957
  if ( ++p == pe )
5896
5958
  goto _test_eof188;
5897
5959
  case 188:
5898
- #line 5899 "hpricot_scan.c"
5960
+ #line 5961 "hpricot_scan.c"
5899
5961
  if ( (*p) == 111 )
5900
5962
  goto st189;
5901
5963
  goto tr349;
@@ -5907,14 +5969,14 @@ case 189:
5907
5969
  goto tr396;
5908
5970
  goto tr349;
5909
5971
  tr396:
5910
- #line 123 "hpricot_scan.rl"
5972
+ #line 157 "hpricot_scan.rl"
5911
5973
  { SET(aval, p); ATTR(ID2SYM(rb_intern("standalone")), aval); }
5912
5974
  goto st190;
5913
5975
  st190:
5914
5976
  if ( ++p == pe )
5915
5977
  goto _test_eof190;
5916
5978
  case 190:
5917
- #line 5918 "hpricot_scan.c"
5979
+ #line 5980 "hpricot_scan.c"
5918
5980
  switch( (*p) ) {
5919
5981
  case 32: goto st190;
5920
5982
  case 62: goto tr363;
@@ -5924,14 +5986,14 @@ case 190:
5924
5986
  goto st190;
5925
5987
  goto tr349;
5926
5988
  tr394:
5927
- #line 111 "hpricot_scan.rl"
5989
+ #line 134 "hpricot_scan.rl"
5928
5990
  { mark_aval = p; }
5929
5991
  goto st191;
5930
5992
  st191:
5931
5993
  if ( ++p == pe )
5932
5994
  goto _test_eof191;
5933
5995
  case 191:
5934
- #line 5935 "hpricot_scan.c"
5996
+ #line 5997 "hpricot_scan.c"
5935
5997
  if ( (*p) == 101 )
5936
5998
  goto st192;
5937
5999
  goto tr349;
@@ -5952,14 +6014,14 @@ case 193:
5952
6014
  }
5953
6015
  goto tr349;
5954
6016
  tr399:
5955
- #line 111 "hpricot_scan.rl"
6017
+ #line 134 "hpricot_scan.rl"
5956
6018
  { mark_aval = p; }
5957
6019
  goto st194;
5958
6020
  st194:
5959
6021
  if ( ++p == pe )
5960
6022
  goto _test_eof194;
5961
6023
  case 194:
5962
- #line 5963 "hpricot_scan.c"
6024
+ #line 6025 "hpricot_scan.c"
5963
6025
  if ( (*p) == 111 )
5964
6026
  goto st195;
5965
6027
  goto tr349;
@@ -5971,14 +6033,14 @@ case 195:
5971
6033
  goto tr396;
5972
6034
  goto tr349;
5973
6035
  tr400:
5974
- #line 111 "hpricot_scan.rl"
6036
+ #line 134 "hpricot_scan.rl"
5975
6037
  { mark_aval = p; }
5976
6038
  goto st196;
5977
6039
  st196:
5978
6040
  if ( ++p == pe )
5979
6041
  goto _test_eof196;
5980
6042
  case 196:
5981
- #line 5982 "hpricot_scan.c"
6043
+ #line 6044 "hpricot_scan.c"
5982
6044
  if ( (*p) == 101 )
5983
6045
  goto st197;
5984
6046
  goto tr349;
@@ -6000,14 +6062,14 @@ case 198:
6000
6062
  goto tr403;
6001
6063
  goto tr349;
6002
6064
  tr403:
6003
- #line 111 "hpricot_scan.rl"
6065
+ #line 134 "hpricot_scan.rl"
6004
6066
  { mark_aval = p; }
6005
6067
  goto st199;
6006
6068
  st199:
6007
6069
  if ( ++p == pe )
6008
6070
  goto _test_eof199;
6009
6071
  case 199:
6010
- #line 6011 "hpricot_scan.c"
6072
+ #line 6073 "hpricot_scan.c"
6011
6073
  switch( (*p) ) {
6012
6074
  case 39: goto tr378;
6013
6075
  case 95: goto st199;
@@ -6043,14 +6105,14 @@ case 200:
6043
6105
  goto tr405;
6044
6106
  goto tr349;
6045
6107
  tr405:
6046
- #line 111 "hpricot_scan.rl"
6108
+ #line 134 "hpricot_scan.rl"
6047
6109
  { mark_aval = p; }
6048
6110
  goto st201;
6049
6111
  st201:
6050
6112
  if ( ++p == pe )
6051
6113
  goto _test_eof201;
6052
6114
  case 201:
6053
- #line 6054 "hpricot_scan.c"
6115
+ #line 6116 "hpricot_scan.c"
6054
6116
  switch( (*p) ) {
6055
6117
  case 39: goto tr360;
6056
6118
  case 95: goto st201;
@@ -6068,52 +6130,52 @@ case 201:
6068
6130
  goto st201;
6069
6131
  goto tr349;
6070
6132
  tr407:
6071
- #line 51 "hpricot_scan.rl"
6133
+ #line 51 "hpricot_common.rl"
6072
6134
  {{p = ((te))-1;}{ TEXT_PASS(); }}
6073
6135
  goto st214;
6074
6136
  tr408:
6075
- #line 50 "hpricot_scan.rl"
6137
+ #line 50 "hpricot_common.rl"
6076
6138
  { EBLK(comment, 3); {goto st204;} }
6077
- #line 50 "hpricot_scan.rl"
6139
+ #line 50 "hpricot_common.rl"
6078
6140
  {te = p+1;}
6079
6141
  goto st214;
6080
6142
  tr422:
6081
- #line 51 "hpricot_scan.rl"
6143
+ #line 51 "hpricot_common.rl"
6082
6144
  {te = p+1;{ TEXT_PASS(); }}
6083
6145
  goto st214;
6084
6146
  tr423:
6085
- #line 9 "hpricot_scan.rl"
6147
+ #line 9 "hpricot_common.rl"
6086
6148
  {curline += 1;}
6087
- #line 51 "hpricot_scan.rl"
6149
+ #line 51 "hpricot_common.rl"
6088
6150
  {te = p+1;{ TEXT_PASS(); }}
6089
6151
  goto st214;
6090
6152
  tr425:
6091
- #line 51 "hpricot_scan.rl"
6153
+ #line 51 "hpricot_common.rl"
6092
6154
  {te = p;p--;{ TEXT_PASS(); }}
6093
6155
  goto st214;
6094
6156
  st214:
6095
- #line 1 "hpricot_scan.rl"
6157
+ #line 1 "NONE"
6096
6158
  {ts = 0;}
6097
6159
  if ( ++p == pe )
6098
6160
  goto _test_eof214;
6099
6161
  case 214:
6100
- #line 1 "hpricot_scan.rl"
6162
+ #line 1 "NONE"
6101
6163
  {ts = p;}
6102
- #line 6103 "hpricot_scan.c"
6164
+ #line 6165 "hpricot_scan.c"
6103
6165
  switch( (*p) ) {
6104
6166
  case 10: goto tr423;
6105
6167
  case 45: goto tr424;
6106
6168
  }
6107
6169
  goto tr422;
6108
6170
  tr424:
6109
- #line 1 "hpricot_scan.rl"
6171
+ #line 1 "NONE"
6110
6172
  {te = p+1;}
6111
6173
  goto st215;
6112
6174
  st215:
6113
6175
  if ( ++p == pe )
6114
6176
  goto _test_eof215;
6115
6177
  case 215:
6116
- #line 6117 "hpricot_scan.c"
6178
+ #line 6179 "hpricot_scan.c"
6117
6179
  if ( (*p) == 45 )
6118
6180
  goto st202;
6119
6181
  goto tr425;
@@ -6125,52 +6187,52 @@ case 202:
6125
6187
  goto tr408;
6126
6188
  goto tr407;
6127
6189
  tr409:
6128
- #line 56 "hpricot_scan.rl"
6190
+ #line 56 "hpricot_common.rl"
6129
6191
  {{p = ((te))-1;}{ TEXT_PASS(); }}
6130
6192
  goto st216;
6131
6193
  tr410:
6132
- #line 55 "hpricot_scan.rl"
6194
+ #line 55 "hpricot_common.rl"
6133
6195
  { EBLK(cdata, 3); {goto st204;} }
6134
- #line 55 "hpricot_scan.rl"
6196
+ #line 55 "hpricot_common.rl"
6135
6197
  {te = p+1;}
6136
6198
  goto st216;
6137
6199
  tr427:
6138
- #line 56 "hpricot_scan.rl"
6200
+ #line 56 "hpricot_common.rl"
6139
6201
  {te = p+1;{ TEXT_PASS(); }}
6140
6202
  goto st216;
6141
6203
  tr428:
6142
- #line 9 "hpricot_scan.rl"
6204
+ #line 9 "hpricot_common.rl"
6143
6205
  {curline += 1;}
6144
- #line 56 "hpricot_scan.rl"
6206
+ #line 56 "hpricot_common.rl"
6145
6207
  {te = p+1;{ TEXT_PASS(); }}
6146
6208
  goto st216;
6147
6209
  tr430:
6148
- #line 56 "hpricot_scan.rl"
6210
+ #line 56 "hpricot_common.rl"
6149
6211
  {te = p;p--;{ TEXT_PASS(); }}
6150
6212
  goto st216;
6151
6213
  st216:
6152
- #line 1 "hpricot_scan.rl"
6214
+ #line 1 "NONE"
6153
6215
  {ts = 0;}
6154
6216
  if ( ++p == pe )
6155
6217
  goto _test_eof216;
6156
6218
  case 216:
6157
- #line 1 "hpricot_scan.rl"
6219
+ #line 1 "NONE"
6158
6220
  {ts = p;}
6159
- #line 6160 "hpricot_scan.c"
6221
+ #line 6222 "hpricot_scan.c"
6160
6222
  switch( (*p) ) {
6161
6223
  case 10: goto tr428;
6162
6224
  case 93: goto tr429;
6163
6225
  }
6164
6226
  goto tr427;
6165
6227
  tr429:
6166
- #line 1 "hpricot_scan.rl"
6228
+ #line 1 "NONE"
6167
6229
  {te = p+1;}
6168
6230
  goto st217;
6169
6231
  st217:
6170
6232
  if ( ++p == pe )
6171
6233
  goto _test_eof217;
6172
6234
  case 217:
6173
- #line 6174 "hpricot_scan.c"
6235
+ #line 6236 "hpricot_scan.c"
6174
6236
  if ( (*p) == 93 )
6175
6237
  goto st203;
6176
6238
  goto tr430;
@@ -6182,34 +6244,34 @@ case 203:
6182
6244
  goto tr410;
6183
6245
  goto tr409;
6184
6246
  tr432:
6185
- #line 61 "hpricot_scan.rl"
6247
+ #line 61 "hpricot_common.rl"
6186
6248
  {te = p+1;{ TEXT_PASS(); }}
6187
6249
  goto st218;
6188
6250
  tr433:
6189
- #line 9 "hpricot_scan.rl"
6251
+ #line 9 "hpricot_common.rl"
6190
6252
  {curline += 1;}
6191
- #line 61 "hpricot_scan.rl"
6253
+ #line 61 "hpricot_common.rl"
6192
6254
  {te = p+1;{ TEXT_PASS(); }}
6193
6255
  goto st218;
6194
6256
  tr434:
6195
- #line 60 "hpricot_scan.rl"
6257
+ #line 60 "hpricot_common.rl"
6196
6258
  { EBLK(procins, 2); {goto st204;} }
6197
- #line 60 "hpricot_scan.rl"
6259
+ #line 60 "hpricot_common.rl"
6198
6260
  {te = p+1;}
6199
6261
  goto st218;
6200
6262
  tr436:
6201
- #line 61 "hpricot_scan.rl"
6263
+ #line 61 "hpricot_common.rl"
6202
6264
  {te = p;p--;{ TEXT_PASS(); }}
6203
6265
  goto st218;
6204
6266
  st218:
6205
- #line 1 "hpricot_scan.rl"
6267
+ #line 1 "NONE"
6206
6268
  {ts = 0;}
6207
6269
  if ( ++p == pe )
6208
6270
  goto _test_eof218;
6209
6271
  case 218:
6210
- #line 1 "hpricot_scan.rl"
6272
+ #line 1 "NONE"
6211
6273
  {ts = p;}
6212
- #line 6213 "hpricot_scan.c"
6274
+ #line 6275 "hpricot_scan.c"
6213
6275
  switch( (*p) ) {
6214
6276
  case 10: goto tr433;
6215
6277
  case 62: goto tr434;
@@ -6669,7 +6731,8 @@ case 219:
6669
6731
  }
6670
6732
 
6671
6733
  }
6672
- #line 534 "hpricot_scan.rl"
6734
+
6735
+ #line 593 "hpricot_scan.rl"
6673
6736
 
6674
6737
  if (cs == hpricot_scan_error) {
6675
6738
  if (buf != NULL)
@@ -6744,34 +6807,68 @@ case 219:
6744
6807
  return Qnil;
6745
6808
  }
6746
6809
 
6810
+ void hstruct_mark(void* ptr) {
6811
+ struct hpricot_struct* st = (struct hpricot_struct*)ptr;
6812
+ int i;
6813
+
6814
+ for(i = 0; i < st->len; i++) {
6815
+ rb_gc_mark(st->ptr[i]);
6816
+ }
6817
+ }
6818
+
6819
+ void hstruct_free(void* ptr) {
6820
+ struct hpricot_struct* st = (struct hpricot_struct*)ptr;
6821
+
6822
+ free(st->ptr);
6823
+ free(st);
6824
+ }
6825
+
6747
6826
  static VALUE
6748
- alloc_hpricot_struct(VALUE klass)
6827
+ alloc_hpricot_struct8(VALUE klass)
6749
6828
  {
6750
- VALUE size;
6751
- long n;
6752
- NEWOBJ(st, struct RStruct);
6753
- OBJSETUP(st, klass, T_STRUCT);
6829
+ VALUE obj;
6830
+ struct hpricot_struct* st;
6754
6831
 
6755
- size = rb_struct_iv_get(klass, "__size__");
6756
- n = FIX2LONG(size);
6832
+ obj = Data_Make_Struct(klass, struct hpricot_struct, hstruct_mark, hstruct_free, st);
6757
6833
 
6758
- #ifndef RSTRUCT_EMBED_LEN_MAX
6759
- st->ptr = ALLOC_N(VALUE, n);
6760
- rb_mem_clear(st->ptr, n);
6761
- st->len = n;
6762
- #else
6763
- if (0 < n && n <= RSTRUCT_EMBED_LEN_MAX) {
6764
- RBASIC(st)->flags &= ~RSTRUCT_EMBED_LEN_MASK;
6765
- RBASIC(st)->flags |= n << RSTRUCT_EMBED_LEN_SHIFT;
6766
- rb_mem_clear(st->as.ary, n);
6767
- } else {
6768
- st->as.heap.ptr = ALLOC_N(VALUE, n);
6769
- rb_mem_clear(st->as.heap.ptr, n);
6770
- st->as.heap.len = n;
6771
- }
6772
- #endif
6834
+ st->len = 8;
6835
+ st->ptr = ALLOC_N(VALUE, 8);
6836
+
6837
+ rb_mem_clear(st->ptr, 8);
6838
+
6839
+ return obj;
6840
+ }
6841
+
6842
+ static VALUE
6843
+ alloc_hpricot_struct2(VALUE klass)
6844
+ {
6845
+ VALUE obj;
6846
+ struct hpricot_struct* st;
6847
+
6848
+ obj = Data_Make_Struct(klass, struct hpricot_struct, hstruct_mark, hstruct_free, st);
6849
+
6850
+ st->len = 2;
6851
+ st->ptr = ALLOC_N(VALUE, 2);
6852
+
6853
+ rb_mem_clear(st->ptr, 2);
6854
+
6855
+ return obj;
6856
+ }
6857
+
6858
+ static VALUE
6859
+ alloc_hpricot_struct3(VALUE klass)
6860
+ {
6861
+ VALUE obj;
6862
+ struct hpricot_struct* st;
6863
+
6864
+ obj = Data_Make_Struct(klass, struct hpricot_struct, hstruct_mark, hstruct_free, st);
6865
+
6866
+ st->len = 3;
6867
+ st->ptr = ALLOC_N(VALUE, 3);
6773
6868
 
6774
- return (VALUE)st;
6869
+ rb_mem_clear(st->ptr, 3);
6870
+
6871
+ return obj;
6775
6872
  }
6776
6873
 
6777
6874
  static VALUE hpricot_struct_ref0(VALUE obj) {return H_ELE_GET(obj, 0);}
@@ -6823,17 +6920,28 @@ static VALUE (*set_func[10])() = {
6823
6920
  };
6824
6921
 
6825
6922
  static VALUE
6826
- make_hpricot_struct(VALUE members)
6923
+ make_hpricot_struct(VALUE members, VALUE (*alloc)(VALUE klass))
6827
6924
  {
6828
6925
  int i = 0;
6926
+ char attr_set[128];
6927
+
6829
6928
  VALUE klass = rb_class_new(rb_cObject);
6830
- rb_iv_set(klass, "__size__", INT2NUM(RARRAY_LEN(members)));
6831
- rb_define_alloc_func(klass, alloc_hpricot_struct);
6832
- rb_define_singleton_method(klass, "new", rb_class_new_instance, -1);
6833
- for (i = 0; i < RARRAY_LEN(members); i++) {
6834
- ID id = SYM2ID(RARRAY_PTR(members)[i]);
6835
- rb_define_method_id(klass, id, ref_func[i], 0);
6836
- rb_define_method_id(klass, rb_id_attrset(id), set_func[i], 1);
6929
+ rb_define_alloc_func(klass, alloc);
6930
+
6931
+ int len = RARRAY_LEN(members);
6932
+ assert(len < 10);
6933
+
6934
+ for (i = 0; i < len; i++) {
6935
+ ID id = SYM2ID(rb_ary_entry(members, i));
6936
+ const char* name = rb_id2name(id);
6937
+ int len = strlen(name);
6938
+
6939
+ memcpy(attr_set, name, strlen(name));
6940
+ attr_set[len] = '=';
6941
+ attr_set[len+1] = 0;
6942
+
6943
+ rb_define_method(klass, name, ref_func[i], 0);
6944
+ rb_define_method(klass, attr_set, set_func[i], 1);
6837
6945
  }
6838
6946
  return klass;
6839
6947
  }
@@ -6877,9 +6985,13 @@ void Init_hpricot_scan()
6877
6985
 
6878
6986
  structElem = make_hpricot_struct(rb_ary_new3(8, sym_name, sym_parent,
6879
6987
  sym_raw_attributes, sym_etag, sym_raw_string, sym_allowed,
6880
- sym_tagno, sym_children));
6881
- structAttr = make_hpricot_struct(rb_ary_new3(3, sym_name, sym_parent, sym_raw_attributes));
6882
- structBasic = make_hpricot_struct(rb_ary_new3(2, sym_name, sym_parent));
6988
+ sym_tagno, sym_children), alloc_hpricot_struct8);
6989
+ structAttr = make_hpricot_struct(
6990
+ rb_ary_new3(3, sym_name, sym_parent, sym_raw_attributes),
6991
+ alloc_hpricot_struct3);
6992
+ structBasic = make_hpricot_struct(
6993
+ rb_ary_new3(2, sym_name, sym_parent),
6994
+ alloc_hpricot_struct2);
6883
6995
 
6884
6996
  cDoc = rb_define_class_under(mHpricot, "Doc", structElem);
6885
6997
  cCData = rb_define_class_under(mHpricot, "CData", structBasic);