home_run 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,10 @@
2
2
  #line 1 "date_parser.rl"
3
3
  #include "date_ext.h"
4
4
 
5
+ #ifdef RHR_ENCODING
6
+ extern int rhrd_encoding_index;
7
+ #endif
8
+
5
9
  #define RHRR_ISO_PARSER 0x1
6
10
  #define RHRR_RFC_PARSER 0x2
7
11
  #define RHRR_CLF_PARSER 0x4
@@ -76,7 +80,7 @@ long rhrd__weekday_num(char * str) {
76
80
  }
77
81
 
78
82
 
79
- #line 80 "date_parser.c"
83
+ #line 84 "date_parser.c"
80
84
  static const char _date_parser_actions[] = {
81
85
  0, 1, 0, 1, 1, 1, 2, 1,
82
86
  3, 1, 4, 1, 5, 1, 6, 1,
@@ -392,7 +396,7 @@ static const int date_parser_error = 0;
392
396
  static const int date_parser_en_main = 1;
393
397
 
394
398
 
395
- #line 181 "date_parser.rl"
399
+ #line 185 "date_parser.rl"
396
400
 
397
401
 
398
402
  VALUE rhrd__ragel_parse(char * p, long len) {
@@ -452,14 +456,14 @@ VALUE rhrd__ragel_parse(char * p, long len) {
452
456
  eof = pe;
453
457
 
454
458
 
455
- #line 456 "date_parser.c"
459
+ #line 460 "date_parser.c"
456
460
  {
457
461
  cs = date_parser_start;
458
462
  }
459
463
 
460
- #line 240 "date_parser.rl"
464
+ #line 244 "date_parser.rl"
461
465
 
462
- #line 463 "date_parser.c"
466
+ #line 467 "date_parser.c"
463
467
  {
464
468
  int _klen;
465
469
  unsigned int _trans;
@@ -534,134 +538,134 @@ _match:
534
538
  switch ( *_acts++ )
535
539
  {
536
540
  case 0:
537
- #line 85 "date_parser.rl"
541
+ #line 89 "date_parser.rl"
538
542
  { t_iso_year = p; }
539
543
  break;
540
544
  case 1:
541
- #line 86 "date_parser.rl"
545
+ #line 90 "date_parser.rl"
542
546
  { t_iso_month = p; }
543
547
  break;
544
548
  case 2:
545
- #line 87 "date_parser.rl"
549
+ #line 91 "date_parser.rl"
546
550
  { t_iso_day = p; }
547
551
  break;
548
552
  case 3:
549
- #line 88 "date_parser.rl"
553
+ #line 92 "date_parser.rl"
550
554
  { t_iso_hour = p; }
551
555
  break;
552
556
  case 4:
553
- #line 89 "date_parser.rl"
557
+ #line 93 "date_parser.rl"
554
558
  { t_iso_minute = p; }
555
559
  break;
556
560
  case 5:
557
- #line 90 "date_parser.rl"
561
+ #line 94 "date_parser.rl"
558
562
  { t_iso_second = p; }
559
563
  break;
560
564
  case 6:
561
- #line 91 "date_parser.rl"
565
+ #line 95 "date_parser.rl"
562
566
  { t_iso_zone = p; }
563
567
  break;
564
568
  case 7:
565
- #line 93 "date_parser.rl"
569
+ #line 97 "date_parser.rl"
566
570
  { iso_state |= RHRR_ISO_TIME_SET; }
567
571
  break;
568
572
  case 8:
569
- #line 94 "date_parser.rl"
573
+ #line 98 "date_parser.rl"
570
574
  {
571
575
  t_iso_zone_end = p;
572
576
  iso_state |= RHRR_ISO_ZONE_SET;
573
577
  }
574
578
  break;
575
579
  case 10:
576
- #line 114 "date_parser.rl"
580
+ #line 118 "date_parser.rl"
577
581
  { t_rfc_wday = p; }
578
582
  break;
579
583
  case 11:
580
- #line 115 "date_parser.rl"
584
+ #line 119 "date_parser.rl"
581
585
  { t_rfc_day = p; }
582
586
  break;
583
587
  case 12:
584
- #line 116 "date_parser.rl"
588
+ #line 120 "date_parser.rl"
585
589
  { t_rfc_month = p; }
586
590
  break;
587
591
  case 13:
588
- #line 117 "date_parser.rl"
592
+ #line 121 "date_parser.rl"
589
593
  { t_rfc_year = p; }
590
594
  break;
591
595
  case 14:
592
- #line 118 "date_parser.rl"
596
+ #line 122 "date_parser.rl"
593
597
  { t_rfc_hour = p; }
594
598
  break;
595
599
  case 15:
596
- #line 119 "date_parser.rl"
600
+ #line 123 "date_parser.rl"
597
601
  { t_rfc_minute = p; }
598
602
  break;
599
603
  case 16:
600
- #line 120 "date_parser.rl"
604
+ #line 124 "date_parser.rl"
601
605
  { t_rfc_second = p; }
602
606
  break;
603
607
  case 17:
604
- #line 121 "date_parser.rl"
608
+ #line 125 "date_parser.rl"
605
609
  { t_rfc_zone = p; }
606
610
  break;
607
611
  case 18:
608
- #line 123 "date_parser.rl"
612
+ #line 127 "date_parser.rl"
609
613
  { rfc_state |= RHRR_RFC_TIME_SET; }
610
614
  break;
611
615
  case 19:
612
- #line 124 "date_parser.rl"
616
+ #line 128 "date_parser.rl"
613
617
  {
614
618
  t_rfc_zone_end = p;
615
619
  rfc_state |= RHRR_RFC_ZONE_SET | RHRR_RFC_ZONE_NUM_SET;
616
620
  }
617
621
  break;
618
622
  case 20:
619
- #line 128 "date_parser.rl"
623
+ #line 132 "date_parser.rl"
620
624
  {
621
625
  t_rfc_zone_end = p;
622
626
  rfc_state |= RHRR_RFC_ZONE_SET | RHRR_RFC_ZONE_NAME_SET;
623
627
  }
624
628
  break;
625
629
  case 22:
626
- #line 151 "date_parser.rl"
630
+ #line 155 "date_parser.rl"
627
631
  { t_clf_day = p; }
628
632
  break;
629
633
  case 23:
630
- #line 152 "date_parser.rl"
634
+ #line 156 "date_parser.rl"
631
635
  { t_clf_month = p; }
632
636
  break;
633
637
  case 24:
634
- #line 153 "date_parser.rl"
638
+ #line 157 "date_parser.rl"
635
639
  { t_clf_year = p; }
636
640
  break;
637
641
  case 25:
638
- #line 154 "date_parser.rl"
642
+ #line 158 "date_parser.rl"
639
643
  { t_clf_hour = p; }
640
644
  break;
641
645
  case 26:
642
- #line 155 "date_parser.rl"
646
+ #line 159 "date_parser.rl"
643
647
  { t_clf_minute = p; }
644
648
  break;
645
649
  case 27:
646
- #line 156 "date_parser.rl"
650
+ #line 160 "date_parser.rl"
647
651
  { t_clf_second = p; }
648
652
  break;
649
653
  case 28:
650
- #line 157 "date_parser.rl"
654
+ #line 161 "date_parser.rl"
651
655
  { t_clf_zone = p; }
652
656
  break;
653
657
  case 29:
654
- #line 159 "date_parser.rl"
658
+ #line 163 "date_parser.rl"
655
659
  { clf_state |= RHRR_CLF_TIME_SET; }
656
660
  break;
657
661
  case 30:
658
- #line 160 "date_parser.rl"
662
+ #line 164 "date_parser.rl"
659
663
  {
660
664
  t_clf_zone_end = p;
661
665
  clf_state |= RHRR_CLF_ZONE_SET;
662
666
  }
663
667
  break;
664
- #line 665 "date_parser.c"
668
+ #line 669 "date_parser.c"
665
669
  }
666
670
  }
667
671
 
@@ -678,58 +682,58 @@ _again:
678
682
  while ( __nacts-- > 0 ) {
679
683
  switch ( *__acts++ ) {
680
684
  case 7:
681
- #line 93 "date_parser.rl"
685
+ #line 97 "date_parser.rl"
682
686
  { iso_state |= RHRR_ISO_TIME_SET; }
683
687
  break;
684
688
  case 8:
685
- #line 94 "date_parser.rl"
689
+ #line 98 "date_parser.rl"
686
690
  {
687
691
  t_iso_zone_end = p;
688
692
  iso_state |= RHRR_ISO_ZONE_SET;
689
693
  }
690
694
  break;
691
695
  case 9:
692
- #line 98 "date_parser.rl"
696
+ #line 102 "date_parser.rl"
693
697
  { parsers |= RHRR_ISO_PARSER; }
694
698
  break;
695
699
  case 18:
696
- #line 123 "date_parser.rl"
700
+ #line 127 "date_parser.rl"
697
701
  { rfc_state |= RHRR_RFC_TIME_SET; }
698
702
  break;
699
703
  case 19:
700
- #line 124 "date_parser.rl"
704
+ #line 128 "date_parser.rl"
701
705
  {
702
706
  t_rfc_zone_end = p;
703
707
  rfc_state |= RHRR_RFC_ZONE_SET | RHRR_RFC_ZONE_NUM_SET;
704
708
  }
705
709
  break;
706
710
  case 20:
707
- #line 128 "date_parser.rl"
711
+ #line 132 "date_parser.rl"
708
712
  {
709
713
  t_rfc_zone_end = p;
710
714
  rfc_state |= RHRR_RFC_ZONE_SET | RHRR_RFC_ZONE_NAME_SET;
711
715
  }
712
716
  break;
713
717
  case 21:
714
- #line 132 "date_parser.rl"
718
+ #line 136 "date_parser.rl"
715
719
  { parsers |= RHRR_RFC_PARSER; }
716
720
  break;
717
721
  case 29:
718
- #line 159 "date_parser.rl"
722
+ #line 163 "date_parser.rl"
719
723
  { clf_state |= RHRR_CLF_TIME_SET; }
720
724
  break;
721
725
  case 30:
722
- #line 160 "date_parser.rl"
726
+ #line 164 "date_parser.rl"
723
727
  {
724
728
  t_clf_zone_end = p;
725
729
  clf_state |= RHRR_CLF_ZONE_SET;
726
730
  }
727
731
  break;
728
732
  case 31:
729
- #line 164 "date_parser.rl"
733
+ #line 168 "date_parser.rl"
730
734
  { parsers |= RHRR_CLF_PARSER; }
731
735
  break;
732
- #line 733 "date_parser.c"
736
+ #line 737 "date_parser.c"
733
737
  }
734
738
  }
735
739
  }
@@ -737,7 +741,7 @@ _again:
737
741
  _out: {}
738
742
  }
739
743
 
740
- #line 241 "date_parser.rl"
744
+ #line 245 "date_parser.rl"
741
745
 
742
746
  switch(parsers) {
743
747
  case RHRR_ISO_PARSER:
@@ -815,31 +819,31 @@ _again:
815
819
 
816
820
  hash = rb_hash_new();
817
821
  if(state & RHRR_WDAY_SET) {
818
- rb_hash_aset(hash, rhrd_sym_wday, INT2NUM(wday));
822
+ rb_hash_aset(hash, rhrd_sym_wday, LONG2NUM(wday));
819
823
  }
820
824
  if(state & RHRR_YEAR_SET) {
821
- rb_hash_aset(hash, rhrd_sym_year, INT2NUM(year));
825
+ rb_hash_aset(hash, rhrd_sym_year, LONG2NUM(year));
822
826
  }
823
827
  if(state & RHRR_MONTH_SET) {
824
- rb_hash_aset(hash, rhrd_sym_mon, INT2NUM(month));
828
+ rb_hash_aset(hash, rhrd_sym_mon, LONG2NUM(month));
825
829
  }
826
830
  if(state & RHRR_DAY_SET) {
827
- rb_hash_aset(hash, rhrd_sym_mday, INT2NUM(day));
831
+ rb_hash_aset(hash, rhrd_sym_mday, LONG2NUM(day));
828
832
  }
829
833
  if(state & RHRR_HOUR_SET) {
830
- rb_hash_aset(hash, rhrd_sym_hour, INT2NUM(hour));
834
+ rb_hash_aset(hash, rhrd_sym_hour, LONG2NUM(hour));
831
835
  }
832
836
  if(state & RHRR_MINUTE_SET) {
833
- rb_hash_aset(hash, rhrd_sym_min, INT2NUM(minute));
837
+ rb_hash_aset(hash, rhrd_sym_min, LONG2NUM(minute));
834
838
  }
835
839
  if(state & RHRR_SECOND_SET) {
836
- rb_hash_aset(hash, rhrd_sym_sec, INT2NUM(second));
840
+ rb_hash_aset(hash, rhrd_sym_sec, LONG2NUM(second));
837
841
  }
838
842
  if(state & RHRR_ZONE_SET) {
839
843
  rzone = rb_str_new(zone, zone_len);
840
844
  rb_hash_aset(hash, rhrd_sym_zone, rzone);
841
845
  if (state & RHRR_OFFSET_SET) {
842
- rb_hash_aset(hash, rhrd_sym_offset, INT2NUM(offset));
846
+ rb_hash_aset(hash, rhrd_sym_offset, LONG2NUM(offset));
843
847
  } else {
844
848
  rzone = rhrd_s_zone_to_diff(rzone, rzone);
845
849
  if(RTEST(rzone)) {
@@ -1,5 +1,9 @@
1
1
  #include "date_ext.h"
2
2
 
3
+ #ifdef RHR_ENCODING
4
+ extern int rhrd_encoding_index;
5
+ #endif
6
+
3
7
  #define RHRR_ISO_PARSER 0x1
4
8
  #define RHRR_RFC_PARSER 0x2
5
9
  #define RHRR_CLF_PARSER 0x4
@@ -315,31 +319,31 @@ VALUE rhrd__ragel_parse(char * p, long len) {
315
319
 
316
320
  hash = rb_hash_new();
317
321
  if(state & RHRR_WDAY_SET) {
318
- rb_hash_aset(hash, rhrd_sym_wday, INT2NUM(wday));
322
+ rb_hash_aset(hash, rhrd_sym_wday, LONG2NUM(wday));
319
323
  }
320
324
  if(state & RHRR_YEAR_SET) {
321
- rb_hash_aset(hash, rhrd_sym_year, INT2NUM(year));
325
+ rb_hash_aset(hash, rhrd_sym_year, LONG2NUM(year));
322
326
  }
323
327
  if(state & RHRR_MONTH_SET) {
324
- rb_hash_aset(hash, rhrd_sym_mon, INT2NUM(month));
328
+ rb_hash_aset(hash, rhrd_sym_mon, LONG2NUM(month));
325
329
  }
326
330
  if(state & RHRR_DAY_SET) {
327
- rb_hash_aset(hash, rhrd_sym_mday, INT2NUM(day));
331
+ rb_hash_aset(hash, rhrd_sym_mday, LONG2NUM(day));
328
332
  }
329
333
  if(state & RHRR_HOUR_SET) {
330
- rb_hash_aset(hash, rhrd_sym_hour, INT2NUM(hour));
334
+ rb_hash_aset(hash, rhrd_sym_hour, LONG2NUM(hour));
331
335
  }
332
336
  if(state & RHRR_MINUTE_SET) {
333
- rb_hash_aset(hash, rhrd_sym_min, INT2NUM(minute));
337
+ rb_hash_aset(hash, rhrd_sym_min, LONG2NUM(minute));
334
338
  }
335
339
  if(state & RHRR_SECOND_SET) {
336
- rb_hash_aset(hash, rhrd_sym_sec, INT2NUM(second));
340
+ rb_hash_aset(hash, rhrd_sym_sec, LONG2NUM(second));
337
341
  }
338
342
  if(state & RHRR_ZONE_SET) {
339
343
  rzone = rb_str_new(zone, zone_len);
340
344
  rb_hash_aset(hash, rhrd_sym_zone, rzone);
341
345
  if (state & RHRR_OFFSET_SET) {
342
- rb_hash_aset(hash, rhrd_sym_offset, INT2NUM(offset));
346
+ rb_hash_aset(hash, rhrd_sym_offset, LONG2NUM(offset));
343
347
  } else {
344
348
  rzone = rhrd_s_zone_to_diff(rzone, rzone);
345
349
  if(RTEST(rzone)) {