fastcsv 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -3
- data/.yardopts +3 -0
- data/Gemfile +1 -1
- data/README.md +1 -2
- data/Rakefile +5 -5
- data/ext/fastcsv/fastcsv.c +545 -1129
- data/ext/fastcsv/fastcsv.rl +5 -5
- data/fastcsv.gemspec +3 -3
- data/lib/fastcsv.rb +1 -1
- data/spec/fastcsv_spec.rb +16 -1
- metadata +14 -29
- data/USAGE +0 -1
data/ext/fastcsv/fastcsv.c
CHANGED
@@ -43,11 +43,11 @@ typedef struct {
|
|
43
43
|
|
44
44
|
|
45
45
|
#line 46 "ext/fastcsv/fastcsv.c"
|
46
|
-
static const int raw_parse_start =
|
47
|
-
static const int raw_parse_first_final =
|
46
|
+
static const int raw_parse_start = 4;
|
47
|
+
static const int raw_parse_first_final = 4;
|
48
48
|
static const int raw_parse_error = 0;
|
49
49
|
|
50
|
-
static const int raw_parse_en_main =
|
50
|
+
static const int raw_parse_en_main = 4;
|
51
51
|
|
52
52
|
|
53
53
|
#line 175 "ext/fastcsv/fastcsv.rl"
|
@@ -132,7 +132,7 @@ static VALUE raw_parse(int argc, VALUE *argv, VALUE self) {
|
|
132
132
|
rb_raise(rb_eArgError, ":col_sep has to be a single character String");
|
133
133
|
}
|
134
134
|
|
135
|
-
// @see rb_io_extract_modeenc
|
135
|
+
// @see rb_io_extract_modeenc parse_mode_enc
|
136
136
|
/* Set to defaults */
|
137
137
|
rb_io_ext_int_to_encs(NULL, NULL, &enc, &enc2, 0);
|
138
138
|
|
@@ -350,7 +350,7 @@ tr0:
|
|
350
350
|
break;
|
351
351
|
}
|
352
352
|
}
|
353
|
-
goto
|
353
|
+
goto st4;
|
354
354
|
tr5:
|
355
355
|
#line 49 "ext/fastcsv/fastcsv.rl"
|
356
356
|
{
|
@@ -382,7 +382,7 @@ tr5:
|
|
382
382
|
}
|
383
383
|
#line 170 "ext/fastcsv/fastcsv.rl"
|
384
384
|
{te = p+1;}
|
385
|
-
goto
|
385
|
+
goto st4;
|
386
386
|
tr6:
|
387
387
|
#line 49 "ext/fastcsv/fastcsv.rl"
|
388
388
|
{
|
@@ -402,7 +402,7 @@ tr6:
|
|
402
402
|
}
|
403
403
|
#line 168 "ext/fastcsv/fastcsv.rl"
|
404
404
|
{te = p+1;}
|
405
|
-
goto
|
405
|
+
goto st4;
|
406
406
|
tr7:
|
407
407
|
#line 49 "ext/fastcsv/fastcsv.rl"
|
408
408
|
{
|
@@ -439,8 +439,8 @@ tr7:
|
|
439
439
|
rb_yield(row);
|
440
440
|
}
|
441
441
|
}
|
442
|
-
goto
|
443
|
-
|
442
|
+
goto st4;
|
443
|
+
tr12:
|
444
444
|
#line 138 "ext/fastcsv/fastcsv.rl"
|
445
445
|
{
|
446
446
|
if (d->start == 0 || p == d->start) { // same as new_row
|
@@ -460,8 +460,8 @@ tr13:
|
|
460
460
|
}
|
461
461
|
#line 170 "ext/fastcsv/fastcsv.rl"
|
462
462
|
{te = p+1;}
|
463
|
-
goto
|
464
|
-
|
463
|
+
goto st4;
|
464
|
+
tr18:
|
465
465
|
#line 95 "ext/fastcsv/fastcsv.rl"
|
466
466
|
{
|
467
467
|
rb_ary_push(row, field);
|
@@ -469,8 +469,8 @@ tr19:
|
|
469
469
|
}
|
470
470
|
#line 168 "ext/fastcsv/fastcsv.rl"
|
471
471
|
{te = p+1;}
|
472
|
-
goto
|
473
|
-
|
472
|
+
goto st4;
|
473
|
+
tr19:
|
474
474
|
#line 95 "ext/fastcsv/fastcsv.rl"
|
475
475
|
{
|
476
476
|
rb_ary_push(row, field);
|
@@ -495,12 +495,12 @@ tr20:
|
|
495
495
|
rb_yield(row);
|
496
496
|
}
|
497
497
|
}
|
498
|
-
goto
|
499
|
-
|
498
|
+
goto st4;
|
499
|
+
tr36:
|
500
500
|
#line 170 "ext/fastcsv/fastcsv.rl"
|
501
501
|
{te = p;p--;}
|
502
|
-
goto
|
503
|
-
|
502
|
+
goto st4;
|
503
|
+
tr37:
|
504
504
|
#line 100 "ext/fastcsv/fastcsv.rl"
|
505
505
|
{
|
506
506
|
d->start = p;
|
@@ -530,8 +530,35 @@ tr43:
|
|
530
530
|
break;
|
531
531
|
}
|
532
532
|
}
|
533
|
-
goto
|
534
|
-
|
533
|
+
goto st4;
|
534
|
+
tr43:
|
535
|
+
#line 100 "ext/fastcsv/fastcsv.rl"
|
536
|
+
{
|
537
|
+
d->start = p;
|
538
|
+
|
539
|
+
if (len_row_sep) {
|
540
|
+
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
541
|
+
FREE;
|
542
|
+
|
543
|
+
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
544
|
+
}
|
545
|
+
}
|
546
|
+
else {
|
547
|
+
len_row_sep = p - mark_row_sep;
|
548
|
+
row_sep = ALLOC_N(char, len_row_sep);
|
549
|
+
memcpy(row_sep, mark_row_sep, len_row_sep);
|
550
|
+
}
|
551
|
+
|
552
|
+
curline++;
|
553
|
+
}
|
554
|
+
#line 169 "ext/fastcsv/fastcsv.rl"
|
555
|
+
{te = p;p--;}
|
556
|
+
goto st4;
|
557
|
+
tr44:
|
558
|
+
#line 169 "ext/fastcsv/fastcsv.rl"
|
559
|
+
{te = p;p--;}
|
560
|
+
goto st4;
|
561
|
+
tr45:
|
535
562
|
#line 100 "ext/fastcsv/fastcsv.rl"
|
536
563
|
{
|
537
564
|
d->start = p;
|
@@ -570,8 +597,36 @@ tr50:
|
|
570
597
|
}
|
571
598
|
#line 170 "ext/fastcsv/fastcsv.rl"
|
572
599
|
{te = p+1;}
|
573
|
-
goto
|
574
|
-
|
600
|
+
goto st4;
|
601
|
+
tr51:
|
602
|
+
#line 95 "ext/fastcsv/fastcsv.rl"
|
603
|
+
{
|
604
|
+
rb_ary_push(row, field);
|
605
|
+
field = Qnil;
|
606
|
+
}
|
607
|
+
#line 168 "ext/fastcsv/fastcsv.rl"
|
608
|
+
{te = p+1;}
|
609
|
+
#line 100 "ext/fastcsv/fastcsv.rl"
|
610
|
+
{
|
611
|
+
d->start = p;
|
612
|
+
|
613
|
+
if (len_row_sep) {
|
614
|
+
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
615
|
+
FREE;
|
616
|
+
|
617
|
+
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
618
|
+
}
|
619
|
+
}
|
620
|
+
else {
|
621
|
+
len_row_sep = p - mark_row_sep;
|
622
|
+
row_sep = ALLOC_N(char, len_row_sep);
|
623
|
+
memcpy(row_sep, mark_row_sep, len_row_sep);
|
624
|
+
}
|
625
|
+
|
626
|
+
curline++;
|
627
|
+
}
|
628
|
+
goto st4;
|
629
|
+
tr52:
|
575
630
|
#line 95 "ext/fastcsv/fastcsv.rl"
|
576
631
|
{
|
577
632
|
rb_ary_push(row, field);
|
@@ -615,18 +670,18 @@ tr56:
|
|
615
670
|
rb_yield(row);
|
616
671
|
}
|
617
672
|
}
|
618
|
-
goto
|
619
|
-
|
673
|
+
goto st4;
|
674
|
+
st4:
|
620
675
|
#line 1 "NONE"
|
621
676
|
{ts = 0;}
|
622
677
|
#line 1 "NONE"
|
623
678
|
{act = 0;}
|
624
679
|
if ( ++p == pe )
|
625
|
-
goto
|
626
|
-
case
|
680
|
+
goto _test_eof4;
|
681
|
+
case 4:
|
627
682
|
#line 1 "NONE"
|
628
683
|
{ts = p;}
|
629
|
-
#line
|
684
|
+
#line 685 "ext/fastcsv/fastcsv.c"
|
630
685
|
_widec = (*p);
|
631
686
|
_widec = (short)(1152 + ((*p) - -128));
|
632
687
|
if (
|
@@ -636,18 +691,18 @@ case 5:
|
|
636
691
|
#line 157 "ext/fastcsv/fastcsv.rl"
|
637
692
|
(*p) == col_sep ) _widec += 512;
|
638
693
|
switch( _widec ) {
|
639
|
-
case 1280: goto
|
694
|
+
case 1280: goto tr27;
|
640
695
|
case 1290: goto tr3;
|
641
696
|
case 1293: goto tr4;
|
642
|
-
case 1536: goto
|
643
|
-
case 1546: goto
|
644
|
-
case 1549: goto
|
697
|
+
case 1536: goto tr29;
|
698
|
+
case 1546: goto tr30;
|
699
|
+
case 1549: goto tr31;
|
645
700
|
case 1792: goto tr7;
|
646
701
|
case 1802: goto tr8;
|
647
702
|
case 1805: goto tr9;
|
648
|
-
case 2048: goto
|
649
|
-
case 2058: goto
|
650
|
-
case 2061: goto
|
703
|
+
case 2048: goto tr33;
|
704
|
+
case 2058: goto tr34;
|
705
|
+
case 2061: goto tr35;
|
651
706
|
}
|
652
707
|
if ( _widec < 1408 ) {
|
653
708
|
if ( 1152 <= _widec && _widec <= 1407 )
|
@@ -655,11 +710,11 @@ case 5:
|
|
655
710
|
} else if ( _widec > 1663 ) {
|
656
711
|
if ( _widec > 1919 ) {
|
657
712
|
if ( 1920 <= _widec && _widec <= 2175 )
|
658
|
-
goto
|
713
|
+
goto tr32;
|
659
714
|
} else if ( _widec >= 1664 )
|
660
715
|
goto tr6;
|
661
716
|
} else
|
662
|
-
goto
|
717
|
+
goto tr28;
|
663
718
|
goto st0;
|
664
719
|
st0:
|
665
720
|
cs = 0;
|
@@ -729,12 +784,12 @@ tr2:
|
|
729
784
|
}
|
730
785
|
#line 170 "ext/fastcsv/fastcsv.rl"
|
731
786
|
{act = 3;}
|
732
|
-
goto
|
733
|
-
|
787
|
+
goto st5;
|
788
|
+
st5:
|
734
789
|
if ( ++p == pe )
|
735
|
-
goto
|
736
|
-
case
|
737
|
-
#line
|
790
|
+
goto _test_eof5;
|
791
|
+
case 5:
|
792
|
+
#line 793 "ext/fastcsv/fastcsv.c"
|
738
793
|
_widec = (*p);
|
739
794
|
_widec = (short)(1152 + ((*p) - -128));
|
740
795
|
if (
|
@@ -762,7 +817,7 @@ case 6:
|
|
762
817
|
goto tr6;
|
763
818
|
} else if ( _widec >= 1152 )
|
764
819
|
goto st1;
|
765
|
-
goto
|
820
|
+
goto tr36;
|
766
821
|
tr3:
|
767
822
|
#line 1 "NONE"
|
768
823
|
{te = p+1;}
|
@@ -798,7 +853,7 @@ tr3:
|
|
798
853
|
}
|
799
854
|
#line 169 "ext/fastcsv/fastcsv.rl"
|
800
855
|
{act = 2;}
|
801
|
-
goto
|
856
|
+
goto st6;
|
802
857
|
tr8:
|
803
858
|
#line 1 "NONE"
|
804
859
|
{te = p+1;}
|
@@ -839,8 +894,8 @@ tr8:
|
|
839
894
|
rb_yield(row);
|
840
895
|
row = rb_ary_new();
|
841
896
|
}
|
842
|
-
goto
|
843
|
-
|
897
|
+
goto st6;
|
898
|
+
tr13:
|
844
899
|
#line 1 "NONE"
|
845
900
|
{te = p+1;}
|
846
901
|
#line 119 "ext/fastcsv/fastcsv.rl"
|
@@ -864,8 +919,8 @@ tr14:
|
|
864
919
|
}
|
865
920
|
#line 169 "ext/fastcsv/fastcsv.rl"
|
866
921
|
{act = 2;}
|
867
|
-
goto
|
868
|
-
|
922
|
+
goto st6;
|
923
|
+
tr20:
|
869
924
|
#line 1 "NONE"
|
870
925
|
{te = p+1;}
|
871
926
|
#line 95 "ext/fastcsv/fastcsv.rl"
|
@@ -894,19 +949,112 @@ tr21:
|
|
894
949
|
rb_yield(row);
|
895
950
|
row = rb_ary_new();
|
896
951
|
}
|
897
|
-
goto
|
898
|
-
|
952
|
+
goto st6;
|
953
|
+
tr38:
|
899
954
|
#line 1 "NONE"
|
900
955
|
{te = p+1;}
|
901
956
|
#line 169 "ext/fastcsv/fastcsv.rl"
|
902
957
|
{act = 2;}
|
903
|
-
goto
|
904
|
-
|
958
|
+
goto st6;
|
959
|
+
tr46:
|
960
|
+
#line 1 "NONE"
|
961
|
+
{te = p+1;}
|
962
|
+
#line 119 "ext/fastcsv/fastcsv.rl"
|
963
|
+
{
|
964
|
+
mark_row_sep = p;
|
965
|
+
|
966
|
+
if (d->start == 0 || p == d->start) {
|
967
|
+
rb_ivar_set(self, s_row, rb_str_new2(""));
|
968
|
+
}
|
969
|
+
else if (p > d->start) {
|
970
|
+
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
971
|
+
}
|
972
|
+
|
973
|
+
if (!NIL_P(field) || RARRAY_LEN(row)) { // same as new_field
|
974
|
+
rb_ary_push(row, field);
|
975
|
+
field = Qnil;
|
976
|
+
}
|
977
|
+
|
978
|
+
rb_yield(row);
|
979
|
+
row = rb_ary_new();
|
980
|
+
}
|
981
|
+
#line 100 "ext/fastcsv/fastcsv.rl"
|
982
|
+
{
|
983
|
+
d->start = p;
|
984
|
+
|
985
|
+
if (len_row_sep) {
|
986
|
+
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
987
|
+
FREE;
|
988
|
+
|
989
|
+
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
990
|
+
}
|
991
|
+
}
|
992
|
+
else {
|
993
|
+
len_row_sep = p - mark_row_sep;
|
994
|
+
row_sep = ALLOC_N(char, len_row_sep);
|
995
|
+
memcpy(row_sep, mark_row_sep, len_row_sep);
|
996
|
+
}
|
997
|
+
|
998
|
+
curline++;
|
999
|
+
}
|
1000
|
+
#line 169 "ext/fastcsv/fastcsv.rl"
|
1001
|
+
{act = 2;}
|
1002
|
+
goto st6;
|
1003
|
+
tr53:
|
1004
|
+
#line 1 "NONE"
|
1005
|
+
{te = p+1;}
|
1006
|
+
#line 95 "ext/fastcsv/fastcsv.rl"
|
1007
|
+
{
|
1008
|
+
rb_ary_push(row, field);
|
1009
|
+
field = Qnil;
|
1010
|
+
}
|
1011
|
+
#line 168 "ext/fastcsv/fastcsv.rl"
|
1012
|
+
{act = 1;}
|
1013
|
+
#line 119 "ext/fastcsv/fastcsv.rl"
|
1014
|
+
{
|
1015
|
+
mark_row_sep = p;
|
1016
|
+
|
1017
|
+
if (d->start == 0 || p == d->start) {
|
1018
|
+
rb_ivar_set(self, s_row, rb_str_new2(""));
|
1019
|
+
}
|
1020
|
+
else if (p > d->start) {
|
1021
|
+
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
if (!NIL_P(field) || RARRAY_LEN(row)) { // same as new_field
|
1025
|
+
rb_ary_push(row, field);
|
1026
|
+
field = Qnil;
|
1027
|
+
}
|
1028
|
+
|
1029
|
+
rb_yield(row);
|
1030
|
+
row = rb_ary_new();
|
1031
|
+
}
|
1032
|
+
#line 100 "ext/fastcsv/fastcsv.rl"
|
1033
|
+
{
|
1034
|
+
d->start = p;
|
1035
|
+
|
1036
|
+
if (len_row_sep) {
|
1037
|
+
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
1038
|
+
FREE;
|
1039
|
+
|
1040
|
+
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
1041
|
+
}
|
1042
|
+
}
|
1043
|
+
else {
|
1044
|
+
len_row_sep = p - mark_row_sep;
|
1045
|
+
row_sep = ALLOC_N(char, len_row_sep);
|
1046
|
+
memcpy(row_sep, mark_row_sep, len_row_sep);
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
curline++;
|
1050
|
+
}
|
1051
|
+
goto st6;
|
1052
|
+
st6:
|
905
1053
|
if ( ++p == pe )
|
906
|
-
goto
|
907
|
-
case
|
908
|
-
#line
|
909
|
-
goto
|
1054
|
+
goto _test_eof6;
|
1055
|
+
case 6:
|
1056
|
+
#line 1057 "ext/fastcsv/fastcsv.c"
|
1057
|
+
goto tr37;
|
910
1058
|
tr4:
|
911
1059
|
#line 1 "NONE"
|
912
1060
|
{te = p+1;}
|
@@ -942,7 +1090,7 @@ tr4:
|
|
942
1090
|
}
|
943
1091
|
#line 169 "ext/fastcsv/fastcsv.rl"
|
944
1092
|
{act = 2;}
|
945
|
-
goto
|
1093
|
+
goto st7;
|
946
1094
|
tr9:
|
947
1095
|
#line 1 "NONE"
|
948
1096
|
{te = p+1;}
|
@@ -983,8 +1131,8 @@ tr9:
|
|
983
1131
|
rb_yield(row);
|
984
1132
|
row = rb_ary_new();
|
985
1133
|
}
|
986
|
-
goto
|
987
|
-
|
1134
|
+
goto st7;
|
1135
|
+
tr14:
|
988
1136
|
#line 1 "NONE"
|
989
1137
|
{te = p+1;}
|
990
1138
|
#line 119 "ext/fastcsv/fastcsv.rl"
|
@@ -1008,8 +1156,8 @@ tr15:
|
|
1008
1156
|
}
|
1009
1157
|
#line 169 "ext/fastcsv/fastcsv.rl"
|
1010
1158
|
{act = 2;}
|
1011
|
-
goto
|
1012
|
-
|
1159
|
+
goto st7;
|
1160
|
+
tr21:
|
1013
1161
|
#line 1 "NONE"
|
1014
1162
|
{te = p+1;}
|
1015
1163
|
#line 95 "ext/fastcsv/fastcsv.rl"
|
@@ -1038,32 +1186,125 @@ tr22:
|
|
1038
1186
|
rb_yield(row);
|
1039
1187
|
row = rb_ary_new();
|
1040
1188
|
}
|
1041
|
-
goto
|
1042
|
-
|
1043
|
-
if ( ++p == pe )
|
1044
|
-
goto _test_eof8;
|
1045
|
-
case 8:
|
1046
|
-
#line 1047 "ext/fastcsv/fastcsv.c"
|
1047
|
-
if ( (*p) == 10 )
|
1048
|
-
goto tr44;
|
1049
|
-
goto tr43;
|
1050
|
-
tr33:
|
1189
|
+
goto st7;
|
1190
|
+
tr47:
|
1051
1191
|
#line 1 "NONE"
|
1052
1192
|
{te = p+1;}
|
1053
|
-
#line
|
1054
|
-
{
|
1055
|
-
if (p == ts) {
|
1056
|
-
// Unquoted empty fields are nil, not "", in Ruby.
|
1057
|
-
field = Qnil;
|
1058
|
-
}
|
1059
|
-
else if (p > ts) {
|
1060
|
-
field = rb_enc_str_new(ts, p - ts, encoding);
|
1061
|
-
ENCODE;
|
1062
|
-
}
|
1063
|
-
}
|
1064
|
-
#line 138 "ext/fastcsv/fastcsv.rl"
|
1193
|
+
#line 119 "ext/fastcsv/fastcsv.rl"
|
1065
1194
|
{
|
1066
|
-
|
1195
|
+
mark_row_sep = p;
|
1196
|
+
|
1197
|
+
if (d->start == 0 || p == d->start) {
|
1198
|
+
rb_ivar_set(self, s_row, rb_str_new2(""));
|
1199
|
+
}
|
1200
|
+
else if (p > d->start) {
|
1201
|
+
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
1202
|
+
}
|
1203
|
+
|
1204
|
+
if (!NIL_P(field) || RARRAY_LEN(row)) { // same as new_field
|
1205
|
+
rb_ary_push(row, field);
|
1206
|
+
field = Qnil;
|
1207
|
+
}
|
1208
|
+
|
1209
|
+
rb_yield(row);
|
1210
|
+
row = rb_ary_new();
|
1211
|
+
}
|
1212
|
+
#line 100 "ext/fastcsv/fastcsv.rl"
|
1213
|
+
{
|
1214
|
+
d->start = p;
|
1215
|
+
|
1216
|
+
if (len_row_sep) {
|
1217
|
+
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
1218
|
+
FREE;
|
1219
|
+
|
1220
|
+
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
1221
|
+
}
|
1222
|
+
}
|
1223
|
+
else {
|
1224
|
+
len_row_sep = p - mark_row_sep;
|
1225
|
+
row_sep = ALLOC_N(char, len_row_sep);
|
1226
|
+
memcpy(row_sep, mark_row_sep, len_row_sep);
|
1227
|
+
}
|
1228
|
+
|
1229
|
+
curline++;
|
1230
|
+
}
|
1231
|
+
#line 169 "ext/fastcsv/fastcsv.rl"
|
1232
|
+
{act = 2;}
|
1233
|
+
goto st7;
|
1234
|
+
tr54:
|
1235
|
+
#line 1 "NONE"
|
1236
|
+
{te = p+1;}
|
1237
|
+
#line 95 "ext/fastcsv/fastcsv.rl"
|
1238
|
+
{
|
1239
|
+
rb_ary_push(row, field);
|
1240
|
+
field = Qnil;
|
1241
|
+
}
|
1242
|
+
#line 168 "ext/fastcsv/fastcsv.rl"
|
1243
|
+
{act = 1;}
|
1244
|
+
#line 119 "ext/fastcsv/fastcsv.rl"
|
1245
|
+
{
|
1246
|
+
mark_row_sep = p;
|
1247
|
+
|
1248
|
+
if (d->start == 0 || p == d->start) {
|
1249
|
+
rb_ivar_set(self, s_row, rb_str_new2(""));
|
1250
|
+
}
|
1251
|
+
else if (p > d->start) {
|
1252
|
+
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
1253
|
+
}
|
1254
|
+
|
1255
|
+
if (!NIL_P(field) || RARRAY_LEN(row)) { // same as new_field
|
1256
|
+
rb_ary_push(row, field);
|
1257
|
+
field = Qnil;
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
rb_yield(row);
|
1261
|
+
row = rb_ary_new();
|
1262
|
+
}
|
1263
|
+
#line 100 "ext/fastcsv/fastcsv.rl"
|
1264
|
+
{
|
1265
|
+
d->start = p;
|
1266
|
+
|
1267
|
+
if (len_row_sep) {
|
1268
|
+
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
1269
|
+
FREE;
|
1270
|
+
|
1271
|
+
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
1272
|
+
}
|
1273
|
+
}
|
1274
|
+
else {
|
1275
|
+
len_row_sep = p - mark_row_sep;
|
1276
|
+
row_sep = ALLOC_N(char, len_row_sep);
|
1277
|
+
memcpy(row_sep, mark_row_sep, len_row_sep);
|
1278
|
+
}
|
1279
|
+
|
1280
|
+
curline++;
|
1281
|
+
}
|
1282
|
+
goto st7;
|
1283
|
+
st7:
|
1284
|
+
if ( ++p == pe )
|
1285
|
+
goto _test_eof7;
|
1286
|
+
case 7:
|
1287
|
+
#line 1288 "ext/fastcsv/fastcsv.c"
|
1288
|
+
if ( (*p) == 10 )
|
1289
|
+
goto tr38;
|
1290
|
+
goto tr37;
|
1291
|
+
tr27:
|
1292
|
+
#line 1 "NONE"
|
1293
|
+
{te = p+1;}
|
1294
|
+
#line 49 "ext/fastcsv/fastcsv.rl"
|
1295
|
+
{
|
1296
|
+
if (p == ts) {
|
1297
|
+
// Unquoted empty fields are nil, not "", in Ruby.
|
1298
|
+
field = Qnil;
|
1299
|
+
}
|
1300
|
+
else if (p > ts) {
|
1301
|
+
field = rb_enc_str_new(ts, p - ts, encoding);
|
1302
|
+
ENCODE;
|
1303
|
+
}
|
1304
|
+
}
|
1305
|
+
#line 138 "ext/fastcsv/fastcsv.rl"
|
1306
|
+
{
|
1307
|
+
if (d->start == 0 || p == d->start) { // same as new_row
|
1067
1308
|
rb_ivar_set(self, s_row, rb_str_new2(""));
|
1068
1309
|
}
|
1069
1310
|
else if (p > d->start) {
|
@@ -1080,12 +1321,12 @@ tr33:
|
|
1080
1321
|
}
|
1081
1322
|
#line 170 "ext/fastcsv/fastcsv.rl"
|
1082
1323
|
{act = 3;}
|
1083
|
-
goto
|
1084
|
-
|
1324
|
+
goto st8;
|
1325
|
+
st8:
|
1085
1326
|
if ( ++p == pe )
|
1086
|
-
goto
|
1087
|
-
case
|
1088
|
-
#line
|
1327
|
+
goto _test_eof8;
|
1328
|
+
case 8:
|
1329
|
+
#line 1330 "ext/fastcsv/fastcsv.c"
|
1089
1330
|
_widec = (*p);
|
1090
1331
|
_widec = (short)(1152 + ((*p) - -128));
|
1091
1332
|
if (
|
@@ -1102,14 +1343,14 @@ case 9:
|
|
1102
1343
|
goto st1;
|
1103
1344
|
} else
|
1104
1345
|
goto st1;
|
1105
|
-
goto
|
1106
|
-
|
1346
|
+
goto tr36;
|
1347
|
+
tr28:
|
1107
1348
|
#line 41 "ext/fastcsv/fastcsv.rl"
|
1108
1349
|
{
|
1109
1350
|
unclosed_line = curline;
|
1110
1351
|
}
|
1111
1352
|
goto st2;
|
1112
|
-
|
1353
|
+
tr39:
|
1113
1354
|
#line 100 "ext/fastcsv/fastcsv.rl"
|
1114
1355
|
{
|
1115
1356
|
d->start = p;
|
@@ -1134,16 +1375,12 @@ st2:
|
|
1134
1375
|
if ( ++p == pe )
|
1135
1376
|
goto _test_eof2;
|
1136
1377
|
case 2:
|
1137
|
-
#line
|
1378
|
+
#line 1379 "ext/fastcsv/fastcsv.c"
|
1138
1379
|
_widec = (*p);
|
1139
1380
|
_widec = (short)(128 + ((*p) - -128));
|
1140
1381
|
if (
|
1141
1382
|
#line 156 "ext/fastcsv/fastcsv.rl"
|
1142
1383
|
(*p) == quote_char ) _widec += 256;
|
1143
|
-
switch( _widec ) {
|
1144
|
-
case 522: goto tr12;
|
1145
|
-
case 525: goto tr12;
|
1146
|
-
}
|
1147
1384
|
if ( _widec < 257 ) {
|
1148
1385
|
if ( 128 <= _widec && _widec <= 255 )
|
1149
1386
|
goto st2;
|
@@ -1194,7 +1431,7 @@ tr11:
|
|
1194
1431
|
unclosed_line = 0;
|
1195
1432
|
}
|
1196
1433
|
goto st3;
|
1197
|
-
|
1434
|
+
tr40:
|
1198
1435
|
#line 60 "ext/fastcsv/fastcsv.rl"
|
1199
1436
|
{
|
1200
1437
|
if (p == ts) {
|
@@ -1258,7 +1495,7 @@ st3:
|
|
1258
1495
|
if ( ++p == pe )
|
1259
1496
|
goto _test_eof3;
|
1260
1497
|
case 3:
|
1261
|
-
#line
|
1498
|
+
#line 1499 "ext/fastcsv/fastcsv.c"
|
1262
1499
|
_widec = (*p);
|
1263
1500
|
_widec = (short)(1152 + ((*p) - -128));
|
1264
1501
|
if (
|
@@ -1268,29 +1505,29 @@ case 3:
|
|
1268
1505
|
#line 157 "ext/fastcsv/fastcsv.rl"
|
1269
1506
|
(*p) == col_sep ) _widec += 512;
|
1270
1507
|
switch( _widec ) {
|
1271
|
-
case 1280: goto
|
1272
|
-
case 1290: goto
|
1273
|
-
case 1293: goto
|
1274
|
-
case 1536: goto
|
1275
|
-
case 1546: goto
|
1276
|
-
case 1549: goto
|
1277
|
-
case 1792: goto
|
1278
|
-
case 1802: goto
|
1279
|
-
case 1805: goto
|
1280
|
-
case 2048: goto
|
1281
|
-
case 2058: goto
|
1282
|
-
case 2061: goto
|
1508
|
+
case 1280: goto tr12;
|
1509
|
+
case 1290: goto tr13;
|
1510
|
+
case 1293: goto tr14;
|
1511
|
+
case 1536: goto tr15;
|
1512
|
+
case 1546: goto tr16;
|
1513
|
+
case 1549: goto tr17;
|
1514
|
+
case 1792: goto tr19;
|
1515
|
+
case 1802: goto tr20;
|
1516
|
+
case 1805: goto tr21;
|
1517
|
+
case 2048: goto tr23;
|
1518
|
+
case 2058: goto tr24;
|
1519
|
+
case 2061: goto tr25;
|
1283
1520
|
}
|
1284
1521
|
if ( _widec < 1664 ) {
|
1285
1522
|
if ( 1408 <= _widec && _widec <= 1663 )
|
1286
1523
|
goto st2;
|
1287
1524
|
} else if ( _widec > 1919 ) {
|
1288
1525
|
if ( 1920 <= _widec && _widec <= 2175 )
|
1289
|
-
goto
|
1526
|
+
goto tr22;
|
1290
1527
|
} else
|
1291
|
-
goto
|
1528
|
+
goto tr18;
|
1292
1529
|
goto tr0;
|
1293
|
-
|
1530
|
+
tr15:
|
1294
1531
|
#line 1 "NONE"
|
1295
1532
|
{te = p+1;}
|
1296
1533
|
#line 138 "ext/fastcsv/fastcsv.rl"
|
@@ -1312,8 +1549,8 @@ tr16:
|
|
1312
1549
|
}
|
1313
1550
|
#line 170 "ext/fastcsv/fastcsv.rl"
|
1314
1551
|
{act = 3;}
|
1315
|
-
goto
|
1316
|
-
|
1552
|
+
goto st9;
|
1553
|
+
tr22:
|
1317
1554
|
#line 1 "NONE"
|
1318
1555
|
{te = p+1;}
|
1319
1556
|
#line 95 "ext/fastcsv/fastcsv.rl"
|
@@ -1323,8 +1560,8 @@ tr23:
|
|
1323
1560
|
}
|
1324
1561
|
#line 168 "ext/fastcsv/fastcsv.rl"
|
1325
1562
|
{act = 1;}
|
1326
|
-
goto
|
1327
|
-
|
1563
|
+
goto st9;
|
1564
|
+
tr23:
|
1328
1565
|
#line 1 "NONE"
|
1329
1566
|
{te = p+1;}
|
1330
1567
|
#line 95 "ext/fastcsv/fastcsv.rl"
|
@@ -1351,8 +1588,8 @@ tr24:
|
|
1351
1588
|
rb_yield(row);
|
1352
1589
|
}
|
1353
1590
|
}
|
1354
|
-
goto
|
1355
|
-
|
1591
|
+
goto st9;
|
1592
|
+
tr29:
|
1356
1593
|
#line 1 "NONE"
|
1357
1594
|
{te = p+1;}
|
1358
1595
|
#line 41 "ext/fastcsv/fastcsv.rl"
|
@@ -1389,8 +1626,8 @@ tr35:
|
|
1389
1626
|
}
|
1390
1627
|
#line 170 "ext/fastcsv/fastcsv.rl"
|
1391
1628
|
{act = 3;}
|
1392
|
-
goto
|
1393
|
-
|
1629
|
+
goto st9;
|
1630
|
+
tr32:
|
1394
1631
|
#line 1 "NONE"
|
1395
1632
|
{te = p+1;}
|
1396
1633
|
#line 49 "ext/fastcsv/fastcsv.rl"
|
@@ -1415,8 +1652,8 @@ tr38:
|
|
1415
1652
|
}
|
1416
1653
|
#line 168 "ext/fastcsv/fastcsv.rl"
|
1417
1654
|
{act = 1;}
|
1418
|
-
goto
|
1419
|
-
|
1655
|
+
goto st9;
|
1656
|
+
tr33:
|
1420
1657
|
#line 1 "NONE"
|
1421
1658
|
{te = p+1;}
|
1422
1659
|
#line 49 "ext/fastcsv/fastcsv.rl"
|
@@ -1458,7 +1695,49 @@ tr39:
|
|
1458
1695
|
rb_yield(row);
|
1459
1696
|
}
|
1460
1697
|
}
|
1461
|
-
goto
|
1698
|
+
goto st9;
|
1699
|
+
tr48:
|
1700
|
+
#line 1 "NONE"
|
1701
|
+
{te = p+1;}
|
1702
|
+
#line 100 "ext/fastcsv/fastcsv.rl"
|
1703
|
+
{
|
1704
|
+
d->start = p;
|
1705
|
+
|
1706
|
+
if (len_row_sep) {
|
1707
|
+
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
1708
|
+
FREE;
|
1709
|
+
|
1710
|
+
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
1711
|
+
}
|
1712
|
+
}
|
1713
|
+
else {
|
1714
|
+
len_row_sep = p - mark_row_sep;
|
1715
|
+
row_sep = ALLOC_N(char, len_row_sep);
|
1716
|
+
memcpy(row_sep, mark_row_sep, len_row_sep);
|
1717
|
+
}
|
1718
|
+
|
1719
|
+
curline++;
|
1720
|
+
}
|
1721
|
+
#line 138 "ext/fastcsv/fastcsv.rl"
|
1722
|
+
{
|
1723
|
+
if (d->start == 0 || p == d->start) { // same as new_row
|
1724
|
+
rb_ivar_set(self, s_row, rb_str_new2(""));
|
1725
|
+
}
|
1726
|
+
else if (p > d->start) {
|
1727
|
+
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
1728
|
+
}
|
1729
|
+
|
1730
|
+
if (!NIL_P(field) || RARRAY_LEN(row)) {
|
1731
|
+
rb_ary_push(row, field);
|
1732
|
+
}
|
1733
|
+
|
1734
|
+
if (RARRAY_LEN(row)) {
|
1735
|
+
rb_yield(row);
|
1736
|
+
}
|
1737
|
+
}
|
1738
|
+
#line 170 "ext/fastcsv/fastcsv.rl"
|
1739
|
+
{act = 3;}
|
1740
|
+
goto st9;
|
1462
1741
|
tr55:
|
1463
1742
|
#line 1 "NONE"
|
1464
1743
|
{te = p+1;}
|
@@ -1488,21 +1767,64 @@ tr55:
|
|
1488
1767
|
|
1489
1768
|
curline++;
|
1490
1769
|
}
|
1491
|
-
goto
|
1492
|
-
|
1770
|
+
goto st9;
|
1771
|
+
tr56:
|
1772
|
+
#line 1 "NONE"
|
1773
|
+
{te = p+1;}
|
1774
|
+
#line 95 "ext/fastcsv/fastcsv.rl"
|
1775
|
+
{
|
1776
|
+
rb_ary_push(row, field);
|
1777
|
+
field = Qnil;
|
1778
|
+
}
|
1779
|
+
#line 168 "ext/fastcsv/fastcsv.rl"
|
1780
|
+
{act = 1;}
|
1781
|
+
#line 100 "ext/fastcsv/fastcsv.rl"
|
1782
|
+
{
|
1783
|
+
d->start = p;
|
1784
|
+
|
1785
|
+
if (len_row_sep) {
|
1786
|
+
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
1787
|
+
FREE;
|
1788
|
+
|
1789
|
+
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
1790
|
+
}
|
1791
|
+
}
|
1792
|
+
else {
|
1793
|
+
len_row_sep = p - mark_row_sep;
|
1794
|
+
row_sep = ALLOC_N(char, len_row_sep);
|
1795
|
+
memcpy(row_sep, mark_row_sep, len_row_sep);
|
1796
|
+
}
|
1797
|
+
|
1798
|
+
curline++;
|
1799
|
+
}
|
1800
|
+
#line 138 "ext/fastcsv/fastcsv.rl"
|
1801
|
+
{
|
1802
|
+
if (d->start == 0 || p == d->start) { // same as new_row
|
1803
|
+
rb_ivar_set(self, s_row, rb_str_new2(""));
|
1804
|
+
}
|
1805
|
+
else if (p > d->start) {
|
1806
|
+
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
1807
|
+
}
|
1808
|
+
|
1809
|
+
if (!NIL_P(field) || RARRAY_LEN(row)) {
|
1810
|
+
rb_ary_push(row, field);
|
1811
|
+
}
|
1812
|
+
|
1813
|
+
if (RARRAY_LEN(row)) {
|
1814
|
+
rb_yield(row);
|
1815
|
+
}
|
1816
|
+
}
|
1817
|
+
goto st9;
|
1818
|
+
st9:
|
1493
1819
|
if ( ++p == pe )
|
1494
|
-
goto
|
1495
|
-
case
|
1496
|
-
#line
|
1820
|
+
goto _test_eof9;
|
1821
|
+
case 9:
|
1822
|
+
#line 1823 "ext/fastcsv/fastcsv.c"
|
1497
1823
|
_widec = (*p);
|
1498
1824
|
_widec = (short)(128 + ((*p) - -128));
|
1499
1825
|
if (
|
1500
1826
|
#line 156 "ext/fastcsv/fastcsv.rl"
|
1501
1827
|
(*p) == quote_char ) _widec += 256;
|
1502
|
-
switch( _widec ) {
|
1503
|
-
case 522: goto tr12;
|
1504
|
-
case 525: goto tr12;
|
1505
|
-
}
|
1506
1828
|
if ( _widec < 257 ) {
|
1507
1829
|
if ( 128 <= _widec && _widec <= 255 )
|
1508
1830
|
goto st2;
|
@@ -1512,150 +1834,10 @@ case 10:
|
|
1512
1834
|
} else
|
1513
1835
|
goto st2;
|
1514
1836
|
goto tr0;
|
1515
|
-
|
1516
|
-
#line
|
1517
|
-
{
|
1518
|
-
|
1519
|
-
field = rb_enc_str_new("", 0, encoding);
|
1520
|
-
ENCODE;
|
1521
|
-
}
|
1522
|
-
// @note If we add an action on '""', we can skip some steps if no '""' is found.
|
1523
|
-
else if (p > ts) {
|
1524
|
-
// Operating on ts in-place produces odd behavior, FYI.
|
1525
|
-
char *copy = ALLOC_N(char, p - ts);
|
1526
|
-
memcpy(copy, ts, p - ts);
|
1527
|
-
|
1528
|
-
char *reader = ts, *writer = copy;
|
1529
|
-
int escaped = 0;
|
1530
|
-
|
1531
|
-
while (p > reader) {
|
1532
|
-
if (*reader == quote_char && !escaped) {
|
1533
|
-
// Skip the escaping character.
|
1534
|
-
escaped = 1;
|
1535
|
-
}
|
1536
|
-
else {
|
1537
|
-
escaped = 0;
|
1538
|
-
*writer++ = *reader;
|
1539
|
-
}
|
1540
|
-
reader++;
|
1541
|
-
}
|
1542
|
-
|
1543
|
-
field = rb_enc_str_new(copy, writer - copy, encoding);
|
1544
|
-
ENCODE;
|
1545
|
-
|
1546
|
-
if (copy != NULL) {
|
1547
|
-
free(copy);
|
1548
|
-
}
|
1549
|
-
}
|
1550
|
-
}
|
1551
|
-
#line 45 "ext/fastcsv/fastcsv.rl"
|
1552
|
-
{
|
1553
|
-
unclosed_line = 0;
|
1554
|
-
}
|
1555
|
-
goto st4;
|
1556
|
-
tr47:
|
1557
|
-
#line 60 "ext/fastcsv/fastcsv.rl"
|
1558
|
-
{
|
1559
|
-
if (p == ts) {
|
1560
|
-
field = rb_enc_str_new("", 0, encoding);
|
1561
|
-
ENCODE;
|
1562
|
-
}
|
1563
|
-
// @note If we add an action on '""', we can skip some steps if no '""' is found.
|
1564
|
-
else if (p > ts) {
|
1565
|
-
// Operating on ts in-place produces odd behavior, FYI.
|
1566
|
-
char *copy = ALLOC_N(char, p - ts);
|
1567
|
-
memcpy(copy, ts, p - ts);
|
1568
|
-
|
1569
|
-
char *reader = ts, *writer = copy;
|
1570
|
-
int escaped = 0;
|
1571
|
-
|
1572
|
-
while (p > reader) {
|
1573
|
-
if (*reader == quote_char && !escaped) {
|
1574
|
-
// Skip the escaping character.
|
1575
|
-
escaped = 1;
|
1576
|
-
}
|
1577
|
-
else {
|
1578
|
-
escaped = 0;
|
1579
|
-
*writer++ = *reader;
|
1580
|
-
}
|
1581
|
-
reader++;
|
1582
|
-
}
|
1583
|
-
|
1584
|
-
field = rb_enc_str_new(copy, writer - copy, encoding);
|
1585
|
-
ENCODE;
|
1586
|
-
|
1587
|
-
if (copy != NULL) {
|
1588
|
-
free(copy);
|
1589
|
-
}
|
1590
|
-
}
|
1591
|
-
}
|
1592
|
-
#line 45 "ext/fastcsv/fastcsv.rl"
|
1593
|
-
{
|
1594
|
-
unclosed_line = 0;
|
1595
|
-
}
|
1596
|
-
#line 100 "ext/fastcsv/fastcsv.rl"
|
1597
|
-
{
|
1598
|
-
d->start = p;
|
1599
|
-
|
1600
|
-
if (len_row_sep) {
|
1601
|
-
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
1602
|
-
FREE;
|
1603
|
-
|
1604
|
-
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
1605
|
-
}
|
1606
|
-
}
|
1607
|
-
else {
|
1608
|
-
len_row_sep = p - mark_row_sep;
|
1609
|
-
row_sep = ALLOC_N(char, len_row_sep);
|
1610
|
-
memcpy(row_sep, mark_row_sep, len_row_sep);
|
1611
|
-
}
|
1612
|
-
|
1613
|
-
curline++;
|
1614
|
-
}
|
1615
|
-
goto st4;
|
1616
|
-
st4:
|
1617
|
-
if ( ++p == pe )
|
1618
|
-
goto _test_eof4;
|
1619
|
-
case 4:
|
1620
|
-
#line 1621 "ext/fastcsv/fastcsv.c"
|
1621
|
-
_widec = (*p);
|
1622
|
-
_widec = (short)(1152 + ((*p) - -128));
|
1623
|
-
if (
|
1624
|
-
#line 156 "ext/fastcsv/fastcsv.rl"
|
1625
|
-
(*p) == quote_char ) _widec += 256;
|
1626
|
-
if (
|
1627
|
-
#line 157 "ext/fastcsv/fastcsv.rl"
|
1628
|
-
(*p) == col_sep ) _widec += 512;
|
1629
|
-
switch( _widec ) {
|
1630
|
-
case 1280: goto tr13;
|
1631
|
-
case 1290: goto tr17;
|
1632
|
-
case 1293: goto tr18;
|
1633
|
-
case 1536: goto tr27;
|
1634
|
-
case 1546: goto tr28;
|
1635
|
-
case 1549: goto tr28;
|
1636
|
-
case 1792: goto tr20;
|
1637
|
-
case 1802: goto tr25;
|
1638
|
-
case 1805: goto tr26;
|
1639
|
-
case 2048: goto tr30;
|
1640
|
-
case 2058: goto tr31;
|
1641
|
-
case 2061: goto tr31;
|
1642
|
-
}
|
1643
|
-
if ( _widec < 1408 ) {
|
1644
|
-
if ( 1152 <= _widec && _widec <= 1407 )
|
1645
|
-
goto st2;
|
1646
|
-
} else if ( _widec > 1663 ) {
|
1647
|
-
if ( _widec > 1919 ) {
|
1648
|
-
if ( 1920 <= _widec && _widec <= 2175 )
|
1649
|
-
goto tr29;
|
1650
|
-
} else if ( _widec >= 1664 )
|
1651
|
-
goto tr23;
|
1652
|
-
} else
|
1653
|
-
goto tr12;
|
1654
|
-
goto tr0;
|
1655
|
-
tr17:
|
1656
|
-
#line 1 "NONE"
|
1657
|
-
{te = p+1;}
|
1658
|
-
#line 119 "ext/fastcsv/fastcsv.rl"
|
1837
|
+
tr16:
|
1838
|
+
#line 1 "NONE"
|
1839
|
+
{te = p+1;}
|
1840
|
+
#line 119 "ext/fastcsv/fastcsv.rl"
|
1659
1841
|
{
|
1660
1842
|
mark_row_sep = p;
|
1661
1843
|
|
@@ -1676,8 +1858,8 @@ tr17:
|
|
1676
1858
|
}
|
1677
1859
|
#line 169 "ext/fastcsv/fastcsv.rl"
|
1678
1860
|
{act = 2;}
|
1679
|
-
goto
|
1680
|
-
|
1861
|
+
goto st10;
|
1862
|
+
tr24:
|
1681
1863
|
#line 1 "NONE"
|
1682
1864
|
{te = p+1;}
|
1683
1865
|
#line 95 "ext/fastcsv/fastcsv.rl"
|
@@ -1706,8 +1888,8 @@ tr25:
|
|
1706
1888
|
rb_yield(row);
|
1707
1889
|
row = rb_ary_new();
|
1708
1890
|
}
|
1709
|
-
goto
|
1710
|
-
|
1891
|
+
goto st10;
|
1892
|
+
tr30:
|
1711
1893
|
#line 1 "NONE"
|
1712
1894
|
{te = p+1;}
|
1713
1895
|
#line 41 "ext/fastcsv/fastcsv.rl"
|
@@ -1746,8 +1928,8 @@ tr36:
|
|
1746
1928
|
}
|
1747
1929
|
#line 169 "ext/fastcsv/fastcsv.rl"
|
1748
1930
|
{act = 2;}
|
1749
|
-
goto
|
1750
|
-
|
1931
|
+
goto st10;
|
1932
|
+
tr34:
|
1751
1933
|
#line 1 "NONE"
|
1752
1934
|
{te = p+1;}
|
1753
1935
|
#line 49 "ext/fastcsv/fastcsv.rl"
|
@@ -1791,8 +1973,8 @@ tr40:
|
|
1791
1973
|
rb_yield(row);
|
1792
1974
|
row = rb_ary_new();
|
1793
1975
|
}
|
1794
|
-
goto
|
1795
|
-
|
1976
|
+
goto st10;
|
1977
|
+
tr41:
|
1796
1978
|
#line 1 "NONE"
|
1797
1979
|
{te = p+1;}
|
1798
1980
|
#line 100 "ext/fastcsv/fastcsv.rl"
|
@@ -1816,8 +1998,8 @@ tr48:
|
|
1816
1998
|
}
|
1817
1999
|
#line 169 "ext/fastcsv/fastcsv.rl"
|
1818
2000
|
{act = 2;}
|
1819
|
-
goto
|
1820
|
-
|
2001
|
+
goto st10;
|
2002
|
+
tr49:
|
1821
2003
|
#line 1 "NONE"
|
1822
2004
|
{te = p+1;}
|
1823
2005
|
#line 119 "ext/fastcsv/fastcsv.rl"
|
@@ -1860,7 +2042,7 @@ tr51:
|
|
1860
2042
|
}
|
1861
2043
|
#line 169 "ext/fastcsv/fastcsv.rl"
|
1862
2044
|
{act = 2;}
|
1863
|
-
goto
|
2045
|
+
goto st10;
|
1864
2046
|
tr57:
|
1865
2047
|
#line 1 "NONE"
|
1866
2048
|
{te = p+1;}
|
@@ -1909,29 +2091,26 @@ tr57:
|
|
1909
2091
|
|
1910
2092
|
curline++;
|
1911
2093
|
}
|
1912
|
-
goto
|
1913
|
-
|
2094
|
+
goto st10;
|
2095
|
+
st10:
|
1914
2096
|
if ( ++p == pe )
|
1915
|
-
goto
|
1916
|
-
case
|
1917
|
-
#line
|
2097
|
+
goto _test_eof10;
|
2098
|
+
case 10:
|
2099
|
+
#line 2100 "ext/fastcsv/fastcsv.c"
|
1918
2100
|
_widec = (*p);
|
1919
2101
|
_widec = (short)(128 + ((*p) - -128));
|
1920
2102
|
if (
|
1921
2103
|
#line 156 "ext/fastcsv/fastcsv.rl"
|
1922
2104
|
(*p) == quote_char ) _widec += 256;
|
1923
|
-
|
1924
|
-
|
1925
|
-
case 522: goto tr47;
|
1926
|
-
case 525: goto tr47;
|
1927
|
-
}
|
2105
|
+
if ( _widec == 256 )
|
2106
|
+
goto tr37;
|
1928
2107
|
if ( _widec > 383 ) {
|
1929
2108
|
if ( 384 <= _widec && _widec <= 639 )
|
1930
|
-
goto
|
2109
|
+
goto tr40;
|
1931
2110
|
} else if ( _widec >= 128 )
|
1932
|
-
goto
|
2111
|
+
goto tr39;
|
1933
2112
|
goto tr0;
|
1934
|
-
|
2113
|
+
tr17:
|
1935
2114
|
#line 1 "NONE"
|
1936
2115
|
{te = p+1;}
|
1937
2116
|
#line 119 "ext/fastcsv/fastcsv.rl"
|
@@ -1955,8 +2134,8 @@ tr18:
|
|
1955
2134
|
}
|
1956
2135
|
#line 169 "ext/fastcsv/fastcsv.rl"
|
1957
2136
|
{act = 2;}
|
1958
|
-
goto
|
1959
|
-
|
2137
|
+
goto st11;
|
2138
|
+
tr25:
|
1960
2139
|
#line 1 "NONE"
|
1961
2140
|
{te = p+1;}
|
1962
2141
|
#line 95 "ext/fastcsv/fastcsv.rl"
|
@@ -1985,8 +2164,8 @@ tr26:
|
|
1985
2164
|
rb_yield(row);
|
1986
2165
|
row = rb_ary_new();
|
1987
2166
|
}
|
1988
|
-
goto
|
1989
|
-
|
2167
|
+
goto st11;
|
2168
|
+
tr31:
|
1990
2169
|
#line 1 "NONE"
|
1991
2170
|
{te = p+1;}
|
1992
2171
|
#line 41 "ext/fastcsv/fastcsv.rl"
|
@@ -2025,8 +2204,8 @@ tr37:
|
|
2025
2204
|
}
|
2026
2205
|
#line 169 "ext/fastcsv/fastcsv.rl"
|
2027
2206
|
{act = 2;}
|
2028
|
-
goto
|
2029
|
-
|
2207
|
+
goto st11;
|
2208
|
+
tr35:
|
2030
2209
|
#line 1 "NONE"
|
2031
2210
|
{te = p+1;}
|
2032
2211
|
#line 49 "ext/fastcsv/fastcsv.rl"
|
@@ -2070,8 +2249,8 @@ tr41:
|
|
2070
2249
|
rb_yield(row);
|
2071
2250
|
row = rb_ary_new();
|
2072
2251
|
}
|
2073
|
-
goto
|
2074
|
-
|
2252
|
+
goto st11;
|
2253
|
+
tr50:
|
2075
2254
|
#line 1 "NONE"
|
2076
2255
|
{te = p+1;}
|
2077
2256
|
#line 119 "ext/fastcsv/fastcsv.rl"
|
@@ -2114,7 +2293,7 @@ tr52:
|
|
2114
2293
|
}
|
2115
2294
|
#line 169 "ext/fastcsv/fastcsv.rl"
|
2116
2295
|
{act = 2;}
|
2117
|
-
goto
|
2296
|
+
goto st11;
|
2118
2297
|
tr58:
|
2119
2298
|
#line 1 "NONE"
|
2120
2299
|
{te = p+1;}
|
@@ -2163,30 +2342,29 @@ tr58:
|
|
2163
2342
|
|
2164
2343
|
curline++;
|
2165
2344
|
}
|
2166
|
-
goto
|
2167
|
-
|
2345
|
+
goto st11;
|
2346
|
+
st11:
|
2168
2347
|
if ( ++p == pe )
|
2169
|
-
goto
|
2170
|
-
case
|
2171
|
-
#line
|
2348
|
+
goto _test_eof11;
|
2349
|
+
case 11:
|
2350
|
+
#line 2351 "ext/fastcsv/fastcsv.c"
|
2172
2351
|
_widec = (*p);
|
2173
2352
|
_widec = (short)(128 + ((*p) - -128));
|
2174
2353
|
if (
|
2175
2354
|
#line 156 "ext/fastcsv/fastcsv.rl"
|
2176
2355
|
(*p) == quote_char ) _widec += 256;
|
2177
2356
|
switch( _widec ) {
|
2178
|
-
case 256: goto
|
2179
|
-
case 266: goto
|
2180
|
-
case 522: goto
|
2181
|
-
case 525: goto tr47;
|
2357
|
+
case 256: goto tr37;
|
2358
|
+
case 266: goto tr41;
|
2359
|
+
case 522: goto tr42;
|
2182
2360
|
}
|
2183
2361
|
if ( _widec > 383 ) {
|
2184
2362
|
if ( 384 <= _widec && _widec <= 639 )
|
2185
|
-
goto
|
2363
|
+
goto tr40;
|
2186
2364
|
} else if ( _widec >= 128 )
|
2187
|
-
goto
|
2365
|
+
goto tr39;
|
2188
2366
|
goto tr0;
|
2189
|
-
|
2367
|
+
tr42:
|
2190
2368
|
#line 1 "NONE"
|
2191
2369
|
{te = p+1;}
|
2192
2370
|
#line 60 "ext/fastcsv/fastcsv.rl"
|
@@ -2228,791 +2406,33 @@ tr28:
|
|
2228
2406
|
{
|
2229
2407
|
unclosed_line = 0;
|
2230
2408
|
}
|
2231
|
-
#line
|
2409
|
+
#line 100 "ext/fastcsv/fastcsv.rl"
|
2232
2410
|
{
|
2233
|
-
|
2411
|
+
d->start = p;
|
2234
2412
|
|
2235
|
-
if (
|
2236
|
-
|
2237
|
-
|
2238
|
-
else if (p > d->start) {
|
2239
|
-
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
2240
|
-
}
|
2413
|
+
if (len_row_sep) {
|
2414
|
+
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
2415
|
+
FREE;
|
2241
2416
|
|
2242
|
-
|
2243
|
-
|
2244
|
-
|
2417
|
+
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
2418
|
+
}
|
2419
|
+
}
|
2420
|
+
else {
|
2421
|
+
len_row_sep = p - mark_row_sep;
|
2422
|
+
row_sep = ALLOC_N(char, len_row_sep);
|
2423
|
+
memcpy(row_sep, mark_row_sep, len_row_sep);
|
2245
2424
|
}
|
2246
2425
|
|
2247
|
-
|
2248
|
-
row = rb_ary_new();
|
2426
|
+
curline++;
|
2249
2427
|
}
|
2250
2428
|
#line 169 "ext/fastcsv/fastcsv.rl"
|
2251
2429
|
{act = 2;}
|
2252
|
-
goto
|
2253
|
-
|
2254
|
-
#line 1 "NONE"
|
2255
|
-
{te = p+1;}
|
2256
|
-
#line 60 "ext/fastcsv/fastcsv.rl"
|
2257
|
-
{
|
2258
|
-
if (p == ts) {
|
2259
|
-
field = rb_enc_str_new("", 0, encoding);
|
2260
|
-
ENCODE;
|
2261
|
-
}
|
2262
|
-
// @note If we add an action on '""', we can skip some steps if no '""' is found.
|
2263
|
-
else if (p > ts) {
|
2264
|
-
// Operating on ts in-place produces odd behavior, FYI.
|
2265
|
-
char *copy = ALLOC_N(char, p - ts);
|
2266
|
-
memcpy(copy, ts, p - ts);
|
2267
|
-
|
2268
|
-
char *reader = ts, *writer = copy;
|
2269
|
-
int escaped = 0;
|
2270
|
-
|
2271
|
-
while (p > reader) {
|
2272
|
-
if (*reader == quote_char && !escaped) {
|
2273
|
-
// Skip the escaping character.
|
2274
|
-
escaped = 1;
|
2275
|
-
}
|
2276
|
-
else {
|
2277
|
-
escaped = 0;
|
2278
|
-
*writer++ = *reader;
|
2279
|
-
}
|
2280
|
-
reader++;
|
2281
|
-
}
|
2282
|
-
|
2283
|
-
field = rb_enc_str_new(copy, writer - copy, encoding);
|
2284
|
-
ENCODE;
|
2285
|
-
|
2286
|
-
if (copy != NULL) {
|
2287
|
-
free(copy);
|
2288
|
-
}
|
2289
|
-
}
|
2290
|
-
}
|
2291
|
-
#line 45 "ext/fastcsv/fastcsv.rl"
|
2292
|
-
{
|
2293
|
-
unclosed_line = 0;
|
2294
|
-
}
|
2295
|
-
#line 95 "ext/fastcsv/fastcsv.rl"
|
2296
|
-
{
|
2297
|
-
rb_ary_push(row, field);
|
2298
|
-
field = Qnil;
|
2299
|
-
}
|
2300
|
-
#line 168 "ext/fastcsv/fastcsv.rl"
|
2301
|
-
{act = 1;}
|
2302
|
-
#line 119 "ext/fastcsv/fastcsv.rl"
|
2303
|
-
{
|
2304
|
-
mark_row_sep = p;
|
2305
|
-
|
2306
|
-
if (d->start == 0 || p == d->start) {
|
2307
|
-
rb_ivar_set(self, s_row, rb_str_new2(""));
|
2308
|
-
}
|
2309
|
-
else if (p > d->start) {
|
2310
|
-
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
2311
|
-
}
|
2312
|
-
|
2313
|
-
if (!NIL_P(field) || RARRAY_LEN(row)) { // same as new_field
|
2314
|
-
rb_ary_push(row, field);
|
2315
|
-
field = Qnil;
|
2316
|
-
}
|
2317
|
-
|
2318
|
-
rb_yield(row);
|
2319
|
-
row = rb_ary_new();
|
2320
|
-
}
|
2321
|
-
goto st13;
|
2322
|
-
tr49:
|
2323
|
-
#line 1 "NONE"
|
2324
|
-
{te = p+1;}
|
2325
|
-
#line 60 "ext/fastcsv/fastcsv.rl"
|
2326
|
-
{
|
2327
|
-
if (p == ts) {
|
2328
|
-
field = rb_enc_str_new("", 0, encoding);
|
2329
|
-
ENCODE;
|
2330
|
-
}
|
2331
|
-
// @note If we add an action on '""', we can skip some steps if no '""' is found.
|
2332
|
-
else if (p > ts) {
|
2333
|
-
// Operating on ts in-place produces odd behavior, FYI.
|
2334
|
-
char *copy = ALLOC_N(char, p - ts);
|
2335
|
-
memcpy(copy, ts, p - ts);
|
2336
|
-
|
2337
|
-
char *reader = ts, *writer = copy;
|
2338
|
-
int escaped = 0;
|
2339
|
-
|
2340
|
-
while (p > reader) {
|
2341
|
-
if (*reader == quote_char && !escaped) {
|
2342
|
-
// Skip the escaping character.
|
2343
|
-
escaped = 1;
|
2344
|
-
}
|
2345
|
-
else {
|
2346
|
-
escaped = 0;
|
2347
|
-
*writer++ = *reader;
|
2348
|
-
}
|
2349
|
-
reader++;
|
2350
|
-
}
|
2351
|
-
|
2352
|
-
field = rb_enc_str_new(copy, writer - copy, encoding);
|
2353
|
-
ENCODE;
|
2354
|
-
|
2355
|
-
if (copy != NULL) {
|
2356
|
-
free(copy);
|
2357
|
-
}
|
2358
|
-
}
|
2359
|
-
}
|
2360
|
-
#line 45 "ext/fastcsv/fastcsv.rl"
|
2361
|
-
{
|
2362
|
-
unclosed_line = 0;
|
2363
|
-
}
|
2364
|
-
#line 100 "ext/fastcsv/fastcsv.rl"
|
2365
|
-
{
|
2366
|
-
d->start = p;
|
2367
|
-
|
2368
|
-
if (len_row_sep) {
|
2369
|
-
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
2370
|
-
FREE;
|
2371
|
-
|
2372
|
-
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
2373
|
-
}
|
2374
|
-
}
|
2375
|
-
else {
|
2376
|
-
len_row_sep = p - mark_row_sep;
|
2377
|
-
row_sep = ALLOC_N(char, len_row_sep);
|
2378
|
-
memcpy(row_sep, mark_row_sep, len_row_sep);
|
2379
|
-
}
|
2380
|
-
|
2381
|
-
curline++;
|
2382
|
-
}
|
2383
|
-
#line 169 "ext/fastcsv/fastcsv.rl"
|
2384
|
-
{act = 2;}
|
2385
|
-
goto st13;
|
2386
|
-
tr54:
|
2387
|
-
#line 1 "NONE"
|
2388
|
-
{te = p+1;}
|
2389
|
-
#line 60 "ext/fastcsv/fastcsv.rl"
|
2390
|
-
{
|
2391
|
-
if (p == ts) {
|
2392
|
-
field = rb_enc_str_new("", 0, encoding);
|
2393
|
-
ENCODE;
|
2394
|
-
}
|
2395
|
-
// @note If we add an action on '""', we can skip some steps if no '""' is found.
|
2396
|
-
else if (p > ts) {
|
2397
|
-
// Operating on ts in-place produces odd behavior, FYI.
|
2398
|
-
char *copy = ALLOC_N(char, p - ts);
|
2399
|
-
memcpy(copy, ts, p - ts);
|
2400
|
-
|
2401
|
-
char *reader = ts, *writer = copy;
|
2402
|
-
int escaped = 0;
|
2403
|
-
|
2404
|
-
while (p > reader) {
|
2405
|
-
if (*reader == quote_char && !escaped) {
|
2406
|
-
// Skip the escaping character.
|
2407
|
-
escaped = 1;
|
2408
|
-
}
|
2409
|
-
else {
|
2410
|
-
escaped = 0;
|
2411
|
-
*writer++ = *reader;
|
2412
|
-
}
|
2413
|
-
reader++;
|
2414
|
-
}
|
2415
|
-
|
2416
|
-
field = rb_enc_str_new(copy, writer - copy, encoding);
|
2417
|
-
ENCODE;
|
2418
|
-
|
2419
|
-
if (copy != NULL) {
|
2420
|
-
free(copy);
|
2421
|
-
}
|
2422
|
-
}
|
2423
|
-
}
|
2424
|
-
#line 45 "ext/fastcsv/fastcsv.rl"
|
2425
|
-
{
|
2426
|
-
unclosed_line = 0;
|
2427
|
-
}
|
2428
|
-
#line 119 "ext/fastcsv/fastcsv.rl"
|
2429
|
-
{
|
2430
|
-
mark_row_sep = p;
|
2431
|
-
|
2432
|
-
if (d->start == 0 || p == d->start) {
|
2433
|
-
rb_ivar_set(self, s_row, rb_str_new2(""));
|
2434
|
-
}
|
2435
|
-
else if (p > d->start) {
|
2436
|
-
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
2437
|
-
}
|
2438
|
-
|
2439
|
-
if (!NIL_P(field) || RARRAY_LEN(row)) { // same as new_field
|
2440
|
-
rb_ary_push(row, field);
|
2441
|
-
field = Qnil;
|
2442
|
-
}
|
2443
|
-
|
2444
|
-
rb_yield(row);
|
2445
|
-
row = rb_ary_new();
|
2446
|
-
}
|
2447
|
-
#line 100 "ext/fastcsv/fastcsv.rl"
|
2448
|
-
{
|
2449
|
-
d->start = p;
|
2450
|
-
|
2451
|
-
if (len_row_sep) {
|
2452
|
-
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
2453
|
-
FREE;
|
2454
|
-
|
2455
|
-
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
2456
|
-
}
|
2457
|
-
}
|
2458
|
-
else {
|
2459
|
-
len_row_sep = p - mark_row_sep;
|
2460
|
-
row_sep = ALLOC_N(char, len_row_sep);
|
2461
|
-
memcpy(row_sep, mark_row_sep, len_row_sep);
|
2462
|
-
}
|
2463
|
-
|
2464
|
-
curline++;
|
2465
|
-
}
|
2466
|
-
#line 169 "ext/fastcsv/fastcsv.rl"
|
2467
|
-
{act = 2;}
|
2468
|
-
goto st13;
|
2469
|
-
tr61:
|
2470
|
-
#line 1 "NONE"
|
2471
|
-
{te = p+1;}
|
2472
|
-
#line 60 "ext/fastcsv/fastcsv.rl"
|
2473
|
-
{
|
2474
|
-
if (p == ts) {
|
2475
|
-
field = rb_enc_str_new("", 0, encoding);
|
2476
|
-
ENCODE;
|
2477
|
-
}
|
2478
|
-
// @note If we add an action on '""', we can skip some steps if no '""' is found.
|
2479
|
-
else if (p > ts) {
|
2480
|
-
// Operating on ts in-place produces odd behavior, FYI.
|
2481
|
-
char *copy = ALLOC_N(char, p - ts);
|
2482
|
-
memcpy(copy, ts, p - ts);
|
2483
|
-
|
2484
|
-
char *reader = ts, *writer = copy;
|
2485
|
-
int escaped = 0;
|
2486
|
-
|
2487
|
-
while (p > reader) {
|
2488
|
-
if (*reader == quote_char && !escaped) {
|
2489
|
-
// Skip the escaping character.
|
2490
|
-
escaped = 1;
|
2491
|
-
}
|
2492
|
-
else {
|
2493
|
-
escaped = 0;
|
2494
|
-
*writer++ = *reader;
|
2495
|
-
}
|
2496
|
-
reader++;
|
2497
|
-
}
|
2498
|
-
|
2499
|
-
field = rb_enc_str_new(copy, writer - copy, encoding);
|
2500
|
-
ENCODE;
|
2501
|
-
|
2502
|
-
if (copy != NULL) {
|
2503
|
-
free(copy);
|
2504
|
-
}
|
2505
|
-
}
|
2506
|
-
}
|
2507
|
-
#line 45 "ext/fastcsv/fastcsv.rl"
|
2508
|
-
{
|
2509
|
-
unclosed_line = 0;
|
2510
|
-
}
|
2511
|
-
#line 95 "ext/fastcsv/fastcsv.rl"
|
2512
|
-
{
|
2513
|
-
rb_ary_push(row, field);
|
2514
|
-
field = Qnil;
|
2515
|
-
}
|
2516
|
-
#line 168 "ext/fastcsv/fastcsv.rl"
|
2517
|
-
{act = 1;}
|
2518
|
-
#line 119 "ext/fastcsv/fastcsv.rl"
|
2519
|
-
{
|
2520
|
-
mark_row_sep = p;
|
2521
|
-
|
2522
|
-
if (d->start == 0 || p == d->start) {
|
2523
|
-
rb_ivar_set(self, s_row, rb_str_new2(""));
|
2524
|
-
}
|
2525
|
-
else if (p > d->start) {
|
2526
|
-
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
2527
|
-
}
|
2528
|
-
|
2529
|
-
if (!NIL_P(field) || RARRAY_LEN(row)) { // same as new_field
|
2530
|
-
rb_ary_push(row, field);
|
2531
|
-
field = Qnil;
|
2532
|
-
}
|
2533
|
-
|
2534
|
-
rb_yield(row);
|
2535
|
-
row = rb_ary_new();
|
2536
|
-
}
|
2537
|
-
#line 100 "ext/fastcsv/fastcsv.rl"
|
2538
|
-
{
|
2539
|
-
d->start = p;
|
2540
|
-
|
2541
|
-
if (len_row_sep) {
|
2542
|
-
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
2543
|
-
FREE;
|
2544
|
-
|
2545
|
-
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
2546
|
-
}
|
2547
|
-
}
|
2548
|
-
else {
|
2549
|
-
len_row_sep = p - mark_row_sep;
|
2550
|
-
row_sep = ALLOC_N(char, len_row_sep);
|
2551
|
-
memcpy(row_sep, mark_row_sep, len_row_sep);
|
2552
|
-
}
|
2553
|
-
|
2554
|
-
curline++;
|
2555
|
-
}
|
2556
|
-
goto st13;
|
2557
|
-
st13:
|
2558
|
-
if ( ++p == pe )
|
2559
|
-
goto _test_eof13;
|
2560
|
-
case 13:
|
2561
|
-
#line 2562 "ext/fastcsv/fastcsv.c"
|
2562
|
-
_widec = (*p);
|
2563
|
-
_widec = (short)(1152 + ((*p) - -128));
|
2564
|
-
if (
|
2565
|
-
#line 156 "ext/fastcsv/fastcsv.rl"
|
2566
|
-
(*p) == quote_char ) _widec += 256;
|
2567
|
-
if (
|
2568
|
-
#line 157 "ext/fastcsv/fastcsv.rl"
|
2569
|
-
(*p) == col_sep ) _widec += 512;
|
2570
|
-
switch( _widec ) {
|
2571
|
-
case 1280: goto tr50;
|
2572
|
-
case 1290: goto tr51;
|
2573
|
-
case 1293: goto tr52;
|
2574
|
-
case 1536: goto tr53;
|
2575
|
-
case 1546: goto tr54;
|
2576
|
-
case 1549: goto tr54;
|
2577
|
-
case 1792: goto tr56;
|
2578
|
-
case 1802: goto tr57;
|
2579
|
-
case 1805: goto tr58;
|
2580
|
-
case 2048: goto tr60;
|
2581
|
-
case 2058: goto tr61;
|
2582
|
-
case 2061: goto tr61;
|
2583
|
-
}
|
2584
|
-
if ( _widec < 1408 ) {
|
2585
|
-
if ( 1152 <= _widec && _widec <= 1407 )
|
2586
|
-
goto tr45;
|
2587
|
-
} else if ( _widec > 1663 ) {
|
2588
|
-
if ( _widec > 1919 ) {
|
2589
|
-
if ( 1920 <= _widec && _widec <= 2175 )
|
2590
|
-
goto tr59;
|
2591
|
-
} else if ( _widec >= 1664 )
|
2592
|
-
goto tr55;
|
2593
|
-
} else
|
2594
|
-
goto tr47;
|
2595
|
-
goto tr0;
|
2596
|
-
tr27:
|
2597
|
-
#line 1 "NONE"
|
2598
|
-
{te = p+1;}
|
2599
|
-
#line 60 "ext/fastcsv/fastcsv.rl"
|
2600
|
-
{
|
2601
|
-
if (p == ts) {
|
2602
|
-
field = rb_enc_str_new("", 0, encoding);
|
2603
|
-
ENCODE;
|
2604
|
-
}
|
2605
|
-
// @note If we add an action on '""', we can skip some steps if no '""' is found.
|
2606
|
-
else if (p > ts) {
|
2607
|
-
// Operating on ts in-place produces odd behavior, FYI.
|
2608
|
-
char *copy = ALLOC_N(char, p - ts);
|
2609
|
-
memcpy(copy, ts, p - ts);
|
2610
|
-
|
2611
|
-
char *reader = ts, *writer = copy;
|
2612
|
-
int escaped = 0;
|
2613
|
-
|
2614
|
-
while (p > reader) {
|
2615
|
-
if (*reader == quote_char && !escaped) {
|
2616
|
-
// Skip the escaping character.
|
2617
|
-
escaped = 1;
|
2618
|
-
}
|
2619
|
-
else {
|
2620
|
-
escaped = 0;
|
2621
|
-
*writer++ = *reader;
|
2622
|
-
}
|
2623
|
-
reader++;
|
2624
|
-
}
|
2625
|
-
|
2626
|
-
field = rb_enc_str_new(copy, writer - copy, encoding);
|
2627
|
-
ENCODE;
|
2628
|
-
|
2629
|
-
if (copy != NULL) {
|
2630
|
-
free(copy);
|
2631
|
-
}
|
2632
|
-
}
|
2633
|
-
}
|
2634
|
-
#line 45 "ext/fastcsv/fastcsv.rl"
|
2635
|
-
{
|
2636
|
-
unclosed_line = 0;
|
2637
|
-
}
|
2638
|
-
#line 138 "ext/fastcsv/fastcsv.rl"
|
2639
|
-
{
|
2640
|
-
if (d->start == 0 || p == d->start) { // same as new_row
|
2641
|
-
rb_ivar_set(self, s_row, rb_str_new2(""));
|
2642
|
-
}
|
2643
|
-
else if (p > d->start) {
|
2644
|
-
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
2645
|
-
}
|
2646
|
-
|
2647
|
-
if (!NIL_P(field) || RARRAY_LEN(row)) {
|
2648
|
-
rb_ary_push(row, field);
|
2649
|
-
}
|
2650
|
-
|
2651
|
-
if (RARRAY_LEN(row)) {
|
2652
|
-
rb_yield(row);
|
2653
|
-
}
|
2654
|
-
}
|
2655
|
-
#line 170 "ext/fastcsv/fastcsv.rl"
|
2656
|
-
{act = 3;}
|
2657
|
-
goto st14;
|
2658
|
-
tr29:
|
2659
|
-
#line 1 "NONE"
|
2660
|
-
{te = p+1;}
|
2661
|
-
#line 60 "ext/fastcsv/fastcsv.rl"
|
2662
|
-
{
|
2663
|
-
if (p == ts) {
|
2664
|
-
field = rb_enc_str_new("", 0, encoding);
|
2665
|
-
ENCODE;
|
2666
|
-
}
|
2667
|
-
// @note If we add an action on '""', we can skip some steps if no '""' is found.
|
2668
|
-
else if (p > ts) {
|
2669
|
-
// Operating on ts in-place produces odd behavior, FYI.
|
2670
|
-
char *copy = ALLOC_N(char, p - ts);
|
2671
|
-
memcpy(copy, ts, p - ts);
|
2672
|
-
|
2673
|
-
char *reader = ts, *writer = copy;
|
2674
|
-
int escaped = 0;
|
2675
|
-
|
2676
|
-
while (p > reader) {
|
2677
|
-
if (*reader == quote_char && !escaped) {
|
2678
|
-
// Skip the escaping character.
|
2679
|
-
escaped = 1;
|
2680
|
-
}
|
2681
|
-
else {
|
2682
|
-
escaped = 0;
|
2683
|
-
*writer++ = *reader;
|
2684
|
-
}
|
2685
|
-
reader++;
|
2686
|
-
}
|
2687
|
-
|
2688
|
-
field = rb_enc_str_new(copy, writer - copy, encoding);
|
2689
|
-
ENCODE;
|
2690
|
-
|
2691
|
-
if (copy != NULL) {
|
2692
|
-
free(copy);
|
2693
|
-
}
|
2694
|
-
}
|
2695
|
-
}
|
2696
|
-
#line 45 "ext/fastcsv/fastcsv.rl"
|
2697
|
-
{
|
2698
|
-
unclosed_line = 0;
|
2699
|
-
}
|
2700
|
-
#line 95 "ext/fastcsv/fastcsv.rl"
|
2701
|
-
{
|
2702
|
-
rb_ary_push(row, field);
|
2703
|
-
field = Qnil;
|
2704
|
-
}
|
2705
|
-
#line 168 "ext/fastcsv/fastcsv.rl"
|
2706
|
-
{act = 1;}
|
2707
|
-
goto st14;
|
2708
|
-
tr30:
|
2709
|
-
#line 1 "NONE"
|
2710
|
-
{te = p+1;}
|
2711
|
-
#line 60 "ext/fastcsv/fastcsv.rl"
|
2712
|
-
{
|
2713
|
-
if (p == ts) {
|
2714
|
-
field = rb_enc_str_new("", 0, encoding);
|
2715
|
-
ENCODE;
|
2716
|
-
}
|
2717
|
-
// @note If we add an action on '""', we can skip some steps if no '""' is found.
|
2718
|
-
else if (p > ts) {
|
2719
|
-
// Operating on ts in-place produces odd behavior, FYI.
|
2720
|
-
char *copy = ALLOC_N(char, p - ts);
|
2721
|
-
memcpy(copy, ts, p - ts);
|
2722
|
-
|
2723
|
-
char *reader = ts, *writer = copy;
|
2724
|
-
int escaped = 0;
|
2725
|
-
|
2726
|
-
while (p > reader) {
|
2727
|
-
if (*reader == quote_char && !escaped) {
|
2728
|
-
// Skip the escaping character.
|
2729
|
-
escaped = 1;
|
2730
|
-
}
|
2731
|
-
else {
|
2732
|
-
escaped = 0;
|
2733
|
-
*writer++ = *reader;
|
2734
|
-
}
|
2735
|
-
reader++;
|
2736
|
-
}
|
2737
|
-
|
2738
|
-
field = rb_enc_str_new(copy, writer - copy, encoding);
|
2739
|
-
ENCODE;
|
2740
|
-
|
2741
|
-
if (copy != NULL) {
|
2742
|
-
free(copy);
|
2743
|
-
}
|
2744
|
-
}
|
2745
|
-
}
|
2746
|
-
#line 45 "ext/fastcsv/fastcsv.rl"
|
2747
|
-
{
|
2748
|
-
unclosed_line = 0;
|
2749
|
-
}
|
2750
|
-
#line 95 "ext/fastcsv/fastcsv.rl"
|
2751
|
-
{
|
2752
|
-
rb_ary_push(row, field);
|
2753
|
-
field = Qnil;
|
2754
|
-
}
|
2755
|
-
#line 168 "ext/fastcsv/fastcsv.rl"
|
2756
|
-
{act = 1;}
|
2757
|
-
#line 138 "ext/fastcsv/fastcsv.rl"
|
2758
|
-
{
|
2759
|
-
if (d->start == 0 || p == d->start) { // same as new_row
|
2760
|
-
rb_ivar_set(self, s_row, rb_str_new2(""));
|
2761
|
-
}
|
2762
|
-
else if (p > d->start) {
|
2763
|
-
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
2764
|
-
}
|
2765
|
-
|
2766
|
-
if (!NIL_P(field) || RARRAY_LEN(row)) {
|
2767
|
-
rb_ary_push(row, field);
|
2768
|
-
}
|
2769
|
-
|
2770
|
-
if (RARRAY_LEN(row)) {
|
2771
|
-
rb_yield(row);
|
2772
|
-
}
|
2773
|
-
}
|
2774
|
-
goto st14;
|
2775
|
-
tr53:
|
2776
|
-
#line 1 "NONE"
|
2777
|
-
{te = p+1;}
|
2778
|
-
#line 60 "ext/fastcsv/fastcsv.rl"
|
2779
|
-
{
|
2780
|
-
if (p == ts) {
|
2781
|
-
field = rb_enc_str_new("", 0, encoding);
|
2782
|
-
ENCODE;
|
2783
|
-
}
|
2784
|
-
// @note If we add an action on '""', we can skip some steps if no '""' is found.
|
2785
|
-
else if (p > ts) {
|
2786
|
-
// Operating on ts in-place produces odd behavior, FYI.
|
2787
|
-
char *copy = ALLOC_N(char, p - ts);
|
2788
|
-
memcpy(copy, ts, p - ts);
|
2789
|
-
|
2790
|
-
char *reader = ts, *writer = copy;
|
2791
|
-
int escaped = 0;
|
2792
|
-
|
2793
|
-
while (p > reader) {
|
2794
|
-
if (*reader == quote_char && !escaped) {
|
2795
|
-
// Skip the escaping character.
|
2796
|
-
escaped = 1;
|
2797
|
-
}
|
2798
|
-
else {
|
2799
|
-
escaped = 0;
|
2800
|
-
*writer++ = *reader;
|
2801
|
-
}
|
2802
|
-
reader++;
|
2803
|
-
}
|
2804
|
-
|
2805
|
-
field = rb_enc_str_new(copy, writer - copy, encoding);
|
2806
|
-
ENCODE;
|
2807
|
-
|
2808
|
-
if (copy != NULL) {
|
2809
|
-
free(copy);
|
2810
|
-
}
|
2811
|
-
}
|
2812
|
-
}
|
2813
|
-
#line 45 "ext/fastcsv/fastcsv.rl"
|
2814
|
-
{
|
2815
|
-
unclosed_line = 0;
|
2816
|
-
}
|
2817
|
-
#line 100 "ext/fastcsv/fastcsv.rl"
|
2818
|
-
{
|
2819
|
-
d->start = p;
|
2820
|
-
|
2821
|
-
if (len_row_sep) {
|
2822
|
-
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
2823
|
-
FREE;
|
2824
|
-
|
2825
|
-
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
2826
|
-
}
|
2827
|
-
}
|
2828
|
-
else {
|
2829
|
-
len_row_sep = p - mark_row_sep;
|
2830
|
-
row_sep = ALLOC_N(char, len_row_sep);
|
2831
|
-
memcpy(row_sep, mark_row_sep, len_row_sep);
|
2832
|
-
}
|
2833
|
-
|
2834
|
-
curline++;
|
2835
|
-
}
|
2836
|
-
#line 138 "ext/fastcsv/fastcsv.rl"
|
2837
|
-
{
|
2838
|
-
if (d->start == 0 || p == d->start) { // same as new_row
|
2839
|
-
rb_ivar_set(self, s_row, rb_str_new2(""));
|
2840
|
-
}
|
2841
|
-
else if (p > d->start) {
|
2842
|
-
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
2843
|
-
}
|
2844
|
-
|
2845
|
-
if (!NIL_P(field) || RARRAY_LEN(row)) {
|
2846
|
-
rb_ary_push(row, field);
|
2847
|
-
}
|
2848
|
-
|
2849
|
-
if (RARRAY_LEN(row)) {
|
2850
|
-
rb_yield(row);
|
2851
|
-
}
|
2852
|
-
}
|
2853
|
-
#line 170 "ext/fastcsv/fastcsv.rl"
|
2854
|
-
{act = 3;}
|
2855
|
-
goto st14;
|
2856
|
-
tr59:
|
2857
|
-
#line 1 "NONE"
|
2858
|
-
{te = p+1;}
|
2859
|
-
#line 60 "ext/fastcsv/fastcsv.rl"
|
2860
|
-
{
|
2861
|
-
if (p == ts) {
|
2862
|
-
field = rb_enc_str_new("", 0, encoding);
|
2863
|
-
ENCODE;
|
2864
|
-
}
|
2865
|
-
// @note If we add an action on '""', we can skip some steps if no '""' is found.
|
2866
|
-
else if (p > ts) {
|
2867
|
-
// Operating on ts in-place produces odd behavior, FYI.
|
2868
|
-
char *copy = ALLOC_N(char, p - ts);
|
2869
|
-
memcpy(copy, ts, p - ts);
|
2870
|
-
|
2871
|
-
char *reader = ts, *writer = copy;
|
2872
|
-
int escaped = 0;
|
2873
|
-
|
2874
|
-
while (p > reader) {
|
2875
|
-
if (*reader == quote_char && !escaped) {
|
2876
|
-
// Skip the escaping character.
|
2877
|
-
escaped = 1;
|
2878
|
-
}
|
2879
|
-
else {
|
2880
|
-
escaped = 0;
|
2881
|
-
*writer++ = *reader;
|
2882
|
-
}
|
2883
|
-
reader++;
|
2884
|
-
}
|
2885
|
-
|
2886
|
-
field = rb_enc_str_new(copy, writer - copy, encoding);
|
2887
|
-
ENCODE;
|
2888
|
-
|
2889
|
-
if (copy != NULL) {
|
2890
|
-
free(copy);
|
2891
|
-
}
|
2892
|
-
}
|
2893
|
-
}
|
2894
|
-
#line 45 "ext/fastcsv/fastcsv.rl"
|
2895
|
-
{
|
2896
|
-
unclosed_line = 0;
|
2897
|
-
}
|
2898
|
-
#line 95 "ext/fastcsv/fastcsv.rl"
|
2899
|
-
{
|
2900
|
-
rb_ary_push(row, field);
|
2901
|
-
field = Qnil;
|
2902
|
-
}
|
2903
|
-
#line 168 "ext/fastcsv/fastcsv.rl"
|
2904
|
-
{act = 1;}
|
2905
|
-
#line 100 "ext/fastcsv/fastcsv.rl"
|
2906
|
-
{
|
2907
|
-
d->start = p;
|
2908
|
-
|
2909
|
-
if (len_row_sep) {
|
2910
|
-
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
2911
|
-
FREE;
|
2912
|
-
|
2913
|
-
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
2914
|
-
}
|
2915
|
-
}
|
2916
|
-
else {
|
2917
|
-
len_row_sep = p - mark_row_sep;
|
2918
|
-
row_sep = ALLOC_N(char, len_row_sep);
|
2919
|
-
memcpy(row_sep, mark_row_sep, len_row_sep);
|
2920
|
-
}
|
2921
|
-
|
2922
|
-
curline++;
|
2923
|
-
}
|
2924
|
-
goto st14;
|
2925
|
-
tr60:
|
2926
|
-
#line 1 "NONE"
|
2927
|
-
{te = p+1;}
|
2928
|
-
#line 60 "ext/fastcsv/fastcsv.rl"
|
2929
|
-
{
|
2930
|
-
if (p == ts) {
|
2931
|
-
field = rb_enc_str_new("", 0, encoding);
|
2932
|
-
ENCODE;
|
2933
|
-
}
|
2934
|
-
// @note If we add an action on '""', we can skip some steps if no '""' is found.
|
2935
|
-
else if (p > ts) {
|
2936
|
-
// Operating on ts in-place produces odd behavior, FYI.
|
2937
|
-
char *copy = ALLOC_N(char, p - ts);
|
2938
|
-
memcpy(copy, ts, p - ts);
|
2939
|
-
|
2940
|
-
char *reader = ts, *writer = copy;
|
2941
|
-
int escaped = 0;
|
2942
|
-
|
2943
|
-
while (p > reader) {
|
2944
|
-
if (*reader == quote_char && !escaped) {
|
2945
|
-
// Skip the escaping character.
|
2946
|
-
escaped = 1;
|
2947
|
-
}
|
2948
|
-
else {
|
2949
|
-
escaped = 0;
|
2950
|
-
*writer++ = *reader;
|
2951
|
-
}
|
2952
|
-
reader++;
|
2953
|
-
}
|
2954
|
-
|
2955
|
-
field = rb_enc_str_new(copy, writer - copy, encoding);
|
2956
|
-
ENCODE;
|
2957
|
-
|
2958
|
-
if (copy != NULL) {
|
2959
|
-
free(copy);
|
2960
|
-
}
|
2961
|
-
}
|
2962
|
-
}
|
2963
|
-
#line 45 "ext/fastcsv/fastcsv.rl"
|
2964
|
-
{
|
2965
|
-
unclosed_line = 0;
|
2966
|
-
}
|
2967
|
-
#line 95 "ext/fastcsv/fastcsv.rl"
|
2968
|
-
{
|
2969
|
-
rb_ary_push(row, field);
|
2970
|
-
field = Qnil;
|
2971
|
-
}
|
2972
|
-
#line 168 "ext/fastcsv/fastcsv.rl"
|
2973
|
-
{act = 1;}
|
2974
|
-
#line 100 "ext/fastcsv/fastcsv.rl"
|
2975
|
-
{
|
2976
|
-
d->start = p;
|
2977
|
-
|
2978
|
-
if (len_row_sep) {
|
2979
|
-
if (p - mark_row_sep != len_row_sep || row_sep[0] != *mark_row_sep || (len_row_sep == 2 && row_sep[1] != *(mark_row_sep + 1))) {
|
2980
|
-
FREE;
|
2981
|
-
|
2982
|
-
rb_raise(eError, "Unquoted fields do not allow \\r or \\n (line %d).", curline);
|
2983
|
-
}
|
2984
|
-
}
|
2985
|
-
else {
|
2986
|
-
len_row_sep = p - mark_row_sep;
|
2987
|
-
row_sep = ALLOC_N(char, len_row_sep);
|
2988
|
-
memcpy(row_sep, mark_row_sep, len_row_sep);
|
2989
|
-
}
|
2990
|
-
|
2991
|
-
curline++;
|
2992
|
-
}
|
2993
|
-
#line 138 "ext/fastcsv/fastcsv.rl"
|
2994
|
-
{
|
2995
|
-
if (d->start == 0 || p == d->start) { // same as new_row
|
2996
|
-
rb_ivar_set(self, s_row, rb_str_new2(""));
|
2997
|
-
}
|
2998
|
-
else if (p > d->start) {
|
2999
|
-
rb_ivar_set(self, s_row, rb_str_new(d->start, p - d->start));
|
3000
|
-
}
|
3001
|
-
|
3002
|
-
if (!NIL_P(field) || RARRAY_LEN(row)) {
|
3003
|
-
rb_ary_push(row, field);
|
3004
|
-
}
|
3005
|
-
|
3006
|
-
if (RARRAY_LEN(row)) {
|
3007
|
-
rb_yield(row);
|
3008
|
-
}
|
3009
|
-
}
|
3010
|
-
goto st14;
|
3011
|
-
st14:
|
2430
|
+
goto st12;
|
2431
|
+
st12:
|
3012
2432
|
if ( ++p == pe )
|
3013
|
-
goto
|
3014
|
-
case
|
3015
|
-
#line
|
2433
|
+
goto _test_eof12;
|
2434
|
+
case 12:
|
2435
|
+
#line 2436 "ext/fastcsv/fastcsv.c"
|
3016
2436
|
_widec = (*p);
|
3017
2437
|
_widec = (short)(1152 + ((*p) - -128));
|
3018
2438
|
if (
|
@@ -3022,64 +2442,60 @@ case 14:
|
|
3022
2442
|
#line 157 "ext/fastcsv/fastcsv.rl"
|
3023
2443
|
(*p) == col_sep ) _widec += 512;
|
3024
2444
|
switch( _widec ) {
|
3025
|
-
case 1280: goto
|
3026
|
-
case 1290: goto
|
3027
|
-
case 1293: goto
|
3028
|
-
case 1536: goto
|
3029
|
-
case 1546: goto
|
3030
|
-
case 1549: goto
|
3031
|
-
case 1792: goto
|
3032
|
-
case 1802: goto
|
3033
|
-
case 1805: goto
|
3034
|
-
case 2048: goto
|
3035
|
-
case 2058: goto
|
3036
|
-
case 2061: goto
|
2445
|
+
case 1280: goto tr45;
|
2446
|
+
case 1290: goto tr46;
|
2447
|
+
case 1293: goto tr47;
|
2448
|
+
case 1536: goto tr48;
|
2449
|
+
case 1546: goto tr49;
|
2450
|
+
case 1549: goto tr50;
|
2451
|
+
case 1792: goto tr52;
|
2452
|
+
case 1802: goto tr53;
|
2453
|
+
case 1805: goto tr54;
|
2454
|
+
case 2048: goto tr56;
|
2455
|
+
case 2058: goto tr57;
|
2456
|
+
case 2061: goto tr58;
|
3037
2457
|
}
|
3038
2458
|
if ( _widec < 1408 ) {
|
3039
2459
|
if ( 1152 <= _widec && _widec <= 1407 )
|
3040
|
-
goto
|
2460
|
+
goto tr43;
|
3041
2461
|
} else if ( _widec > 1663 ) {
|
3042
2462
|
if ( _widec > 1919 ) {
|
3043
2463
|
if ( 1920 <= _widec && _widec <= 2175 )
|
3044
|
-
goto
|
2464
|
+
goto tr55;
|
3045
2465
|
} else if ( _widec >= 1664 )
|
3046
|
-
goto
|
2466
|
+
goto tr51;
|
3047
2467
|
} else
|
3048
|
-
goto
|
3049
|
-
goto
|
2468
|
+
goto tr39;
|
2469
|
+
goto tr44;
|
3050
2470
|
}
|
3051
|
-
|
2471
|
+
_test_eof4: cs = 4; goto _test_eof;
|
3052
2472
|
_test_eof1: cs = 1; goto _test_eof;
|
2473
|
+
_test_eof5: cs = 5; goto _test_eof;
|
3053
2474
|
_test_eof6: cs = 6; goto _test_eof;
|
3054
2475
|
_test_eof7: cs = 7; goto _test_eof;
|
3055
2476
|
_test_eof8: cs = 8; goto _test_eof;
|
3056
|
-
_test_eof9: cs = 9; goto _test_eof;
|
3057
2477
|
_test_eof2: cs = 2; goto _test_eof;
|
3058
2478
|
_test_eof3: cs = 3; goto _test_eof;
|
2479
|
+
_test_eof9: cs = 9; goto _test_eof;
|
3059
2480
|
_test_eof10: cs = 10; goto _test_eof;
|
3060
|
-
_test_eof4: cs = 4; goto _test_eof;
|
3061
2481
|
_test_eof11: cs = 11; goto _test_eof;
|
3062
2482
|
_test_eof12: cs = 12; goto _test_eof;
|
3063
|
-
_test_eof13: cs = 13; goto _test_eof;
|
3064
|
-
_test_eof14: cs = 14; goto _test_eof;
|
3065
2483
|
|
3066
2484
|
_test_eof: {}
|
3067
2485
|
if ( p == eof )
|
3068
2486
|
{
|
3069
2487
|
switch ( cs ) {
|
3070
2488
|
case 1: goto tr0;
|
3071
|
-
case
|
3072
|
-
case
|
3073
|
-
case
|
3074
|
-
case
|
2489
|
+
case 5: goto tr36;
|
2490
|
+
case 6: goto tr37;
|
2491
|
+
case 7: goto tr37;
|
2492
|
+
case 8: goto tr36;
|
3075
2493
|
case 2: goto tr0;
|
3076
2494
|
case 3: goto tr0;
|
3077
|
-
case
|
3078
|
-
case
|
3079
|
-
case 11: goto
|
2495
|
+
case 9: goto tr0;
|
2496
|
+
case 10: goto tr37;
|
2497
|
+
case 11: goto tr37;
|
3080
2498
|
case 12: goto tr43;
|
3081
|
-
case 13: goto tr43;
|
3082
|
-
case 14: goto tr0;
|
3083
2499
|
}
|
3084
2500
|
}
|
3085
2501
|
|
@@ -3116,7 +2532,7 @@ case 14:
|
|
3116
2532
|
if (d->start > ts) {
|
3117
2533
|
d->start = buf + (d->start - ts);
|
3118
2534
|
}
|
3119
|
-
if (mark_row_sep
|
2535
|
+
if (mark_row_sep >= ts) {
|
3120
2536
|
mark_row_sep = buf + (mark_row_sep - ts);
|
3121
2537
|
}
|
3122
2538
|
te = buf + (te - ts);
|