regexp_parser 2.6.2 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -1
- data/lib/regexp_parser/expression/classes/backreference.rb +4 -0
- data/lib/regexp_parser/expression/classes/conditional.rb +8 -0
- data/lib/regexp_parser/expression/methods/traverse.rb +6 -3
- data/lib/regexp_parser/expression/sequence.rb +0 -1
- data/lib/regexp_parser/expression/shared.rb +5 -1
- data/lib/regexp_parser/expression/subexpression.rb +4 -1
- data/lib/regexp_parser/lexer.rb +61 -29
- data/lib/regexp_parser/parser.rb +12 -11
- data/lib/regexp_parser/scanner/property.rl +1 -1
- data/lib/regexp_parser/scanner/scanner.rl +55 -40
- data/lib/regexp_parser/scanner.rb +344 -298
- data/lib/regexp_parser/syntax/version_lookup.rb +0 -8
- data/lib/regexp_parser/syntax/versions.rb +2 -0
- data/lib/regexp_parser/version.rb +1 -1
- metadata +3 -3
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- warn-indent:false; -*-
|
2
2
|
|
3
|
-
# line 1 "/Users/
|
3
|
+
# line 1 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
4
4
|
|
5
|
-
# line
|
5
|
+
# line 650 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
6
6
|
|
7
7
|
|
8
8
|
# THIS IS A GENERATED FILE, DO NOT EDIT DIRECTLY
|
@@ -77,23 +77,24 @@ class Regexp::Scanner
|
|
77
77
|
#
|
78
78
|
# This method may raise errors if a syntax error is encountered.
|
79
79
|
# --------------------------------------------------------------------------
|
80
|
-
def self.scan(input_object, options: nil, &block)
|
81
|
-
new.scan(input_object, options: options, &block)
|
80
|
+
def self.scan(input_object, options: nil, collect_tokens: true, &block)
|
81
|
+
new.scan(input_object, options: options, collect_tokens: collect_tokens, &block)
|
82
82
|
end
|
83
83
|
|
84
|
-
def scan(input_object, options: nil, &block)
|
85
|
-
self.
|
84
|
+
def scan(input_object, options: nil, collect_tokens: true, &block)
|
85
|
+
self.collect_tokens = collect_tokens
|
86
|
+
self.literal_run = nil
|
86
87
|
stack = []
|
87
88
|
|
88
89
|
input = input_object.is_a?(Regexp) ? input_object.source : input_object
|
89
90
|
self.free_spacing = free_spacing?(input_object, options)
|
90
91
|
self.spacing_stack = [{:free_spacing => free_spacing, :depth => 0}]
|
91
92
|
|
92
|
-
data = input.unpack("c*")
|
93
|
+
data = input.unpack("c*")
|
93
94
|
eof = data.length
|
94
95
|
|
95
96
|
self.tokens = []
|
96
|
-
self.block =
|
97
|
+
self.block = block
|
97
98
|
|
98
99
|
self.set_depth = 0
|
99
100
|
self.group_depth = 0
|
@@ -101,7 +102,7 @@ class Regexp::Scanner
|
|
101
102
|
self.char_pos = 0
|
102
103
|
|
103
104
|
|
104
|
-
# line
|
105
|
+
# line 105 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner.rb"
|
105
106
|
class << self
|
106
107
|
attr_accessor :_re_scanner_trans_keys
|
107
108
|
private :_re_scanner_trans_keys, :_re_scanner_trans_keys=
|
@@ -143,15 +144,16 @@ self._re_scanner_trans_keys = [
|
|
143
144
|
44, 57, 68, 119, 80, 112,
|
144
145
|
-62, 125, -128, -65, -128,
|
145
146
|
-65, -128, -65, 38, 38,
|
146
|
-
38, 93, 58, 58,
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
62,
|
147
|
+
38, 93, 58, 58, 48, 120,
|
148
|
+
48, 55, 48, 55, -62,
|
149
|
+
125, -128, -65, -128, -65,
|
150
|
+
-128, -65, 48, 55, 48, 55,
|
151
|
+
77, 77, 45, 45, 0,
|
152
|
+
0, 67, 99, 45, 45,
|
153
|
+
0, 0, 92, 92, 48, 102,
|
154
|
+
39, 60, 39, 57, 49,
|
155
|
+
57, 41, 57, 33, 62,
|
156
|
+
0
|
155
157
|
]
|
156
158
|
|
157
159
|
class << self
|
@@ -171,9 +173,9 @@ self._re_scanner_key_spans = [
|
|
171
173
|
1, 256, 51, 127, 127, 24, 94, 1,
|
172
174
|
1, 94, 94, 1, 21, 21, 21, 58,
|
173
175
|
14, 52, 33, 188, 64, 64, 64, 1,
|
174
|
-
56, 1,
|
175
|
-
8, 1, 1, 0, 33, 1,
|
176
|
-
55, 22, 19, 9, 17, 30
|
176
|
+
56, 1, 73, 8, 8, 188, 64, 64,
|
177
|
+
64, 8, 8, 1, 1, 0, 33, 1,
|
178
|
+
0, 1, 55, 22, 19, 9, 17, 30
|
177
179
|
]
|
178
180
|
|
179
181
|
class << self
|
@@ -193,9 +195,9 @@ self._re_scanner_index_offsets = [
|
|
193
195
|
2633, 2635, 2892, 2944, 3072, 3200, 3225, 3320,
|
194
196
|
3322, 3324, 3419, 3514, 3516, 3538, 3560, 3582,
|
195
197
|
3641, 3656, 3709, 3743, 3932, 3997, 4062, 4127,
|
196
|
-
4129, 4186, 4188,
|
197
|
-
|
198
|
-
|
198
|
+
4129, 4186, 4188, 4262, 4271, 4280, 4469, 4534,
|
199
|
+
4599, 4664, 4673, 4682, 4684, 4686, 4687, 4721,
|
200
|
+
4723, 4724, 4726, 4782, 4805, 4825, 4835, 4853
|
199
201
|
]
|
200
202
|
|
201
203
|
class << self
|
@@ -726,38 +728,42 @@ self._re_scanner_indicies = [
|
|
726
728
|
152, 152, 152, 152, 152, 152, 152, 152,
|
727
729
|
152, 152, 152, 152, 152, 152, 152, 152,
|
728
730
|
152, 152, 152, 152, 152, 152, 152, 152,
|
729
|
-
154, 152, 56, 156, 158, 158,
|
730
|
-
|
731
|
-
157,
|
732
|
-
|
733
|
-
157,
|
734
|
-
157,
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
159, 159, 159, 159, 159,
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
731
|
+
154, 152, 56, 156, 158, 158, 158, 158,
|
732
|
+
158, 158, 158, 158, 157, 157, 157, 157,
|
733
|
+
157, 157, 157, 157, 157, 157, 157, 159,
|
734
|
+
159, 157, 157, 157, 159, 157, 157, 157,
|
735
|
+
157, 159, 157, 157, 159, 157, 157, 159,
|
736
|
+
157, 157, 157, 159, 157, 157, 157, 159,
|
737
|
+
159, 159, 157, 157, 157, 159, 159, 159,
|
738
|
+
159, 159, 159, 157, 159, 157, 157, 157,
|
739
|
+
157, 157, 159, 157, 159, 157, 159, 159,
|
740
|
+
159, 159, 159, 159, 159, 157, 161, 161,
|
741
|
+
161, 161, 161, 161, 161, 161, 160, 162,
|
742
|
+
162, 162, 162, 162, 162, 162, 162, 160,
|
743
|
+
163, 163, 163, 163, 163, 163, 163, 163,
|
744
|
+
163, 163, 163, 163, 163, 163, 163, 163,
|
745
|
+
163, 163, 163, 163, 163, 163, 163, 163,
|
746
|
+
163, 163, 163, 163, 163, 163, 164, 164,
|
747
|
+
164, 164, 164, 164, 164, 164, 164, 164,
|
748
|
+
164, 164, 164, 164, 164, 164, 165, 165,
|
749
|
+
165, 165, 165, 61, 61, 61, 61, 61,
|
744
750
|
61, 61, 61, 61, 61, 61, 61, 61,
|
745
751
|
61, 61, 61, 61, 61, 61, 61, 61,
|
746
752
|
61, 61, 61, 61, 61, 61, 61, 61,
|
747
753
|
61, 61, 61, 61, 61, 61, 61, 61,
|
748
|
-
61, 61, 61, 61, 61, 162, 61, 61,
|
749
|
-
61, 162, 162, 162, 162, 61, 61, 162,
|
750
|
-
61, 163, 164, 164, 164, 164, 164, 164,
|
751
|
-
164, 165, 165, 61, 61, 61, 61, 61,
|
752
|
-
162, 61, 46, 46, 166, 167, 61, 61,
|
753
|
-
46, 167, 61, 61, 46, 61, 168, 61,
|
754
|
-
61, 169, 61, 167, 167, 61, 61, 61,
|
755
|
-
167, 167, 61, 46, 162, 162, 162, 162,
|
756
|
-
61, 61, 170, 170, 63, 167, 170, 170,
|
757
|
-
61, 167, 61, 61, 61, 61, 61, 170,
|
758
|
-
61, 169, 61, 170, 167, 170, 171, 170,
|
759
|
-
167, 172, 61, 46, 162, 162, 162, 61,
|
760
754
|
61, 61, 61, 61, 61, 61, 61, 61,
|
755
|
+
61, 61, 166, 61, 61, 61, 166, 166,
|
756
|
+
166, 166, 61, 61, 166, 61, 167, 168,
|
757
|
+
168, 168, 168, 168, 168, 168, 169, 169,
|
758
|
+
61, 61, 61, 61, 61, 166, 61, 46,
|
759
|
+
46, 170, 171, 61, 61, 46, 171, 61,
|
760
|
+
61, 46, 61, 172, 61, 61, 173, 61,
|
761
|
+
171, 171, 61, 61, 61, 171, 171, 61,
|
762
|
+
46, 166, 166, 166, 166, 61, 61, 174,
|
763
|
+
174, 63, 171, 174, 174, 61, 171, 61,
|
764
|
+
61, 61, 61, 61, 174, 61, 173, 61,
|
765
|
+
174, 171, 174, 175, 174, 171, 176, 61,
|
766
|
+
46, 166, 166, 166, 61, 61, 61, 61,
|
761
767
|
61, 61, 61, 61, 61, 61, 61, 61,
|
762
768
|
61, 61, 61, 61, 61, 61, 61, 61,
|
763
769
|
61, 61, 61, 61, 61, 61, 61, 61,
|
@@ -765,7 +771,7 @@ self._re_scanner_indicies = [
|
|
765
771
|
61, 61, 61, 61, 61, 61, 61, 61,
|
766
772
|
61, 61, 61, 61, 61, 61, 61, 61,
|
767
773
|
61, 61, 61, 61, 61, 61, 61, 61,
|
768
|
-
|
774
|
+
61, 61, 61, 61, 61, 177, 62, 62,
|
769
775
|
62, 62, 62, 62, 62, 62, 62, 62,
|
770
776
|
62, 62, 62, 62, 62, 62, 62, 62,
|
771
777
|
62, 62, 62, 62, 62, 62, 62, 62,
|
@@ -773,42 +779,43 @@ self._re_scanner_indicies = [
|
|
773
779
|
62, 62, 62, 62, 62, 62, 62, 62,
|
774
780
|
62, 62, 62, 62, 62, 62, 62, 62,
|
775
781
|
62, 62, 62, 62, 62, 62, 62, 62,
|
776
|
-
62,
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
782
|
+
62, 62, 62, 62, 62, 62, 177, 178,
|
783
|
+
178, 178, 178, 178, 178, 178, 178, 178,
|
784
|
+
178, 178, 178, 178, 178, 178, 178, 178,
|
785
|
+
178, 178, 178, 178, 178, 178, 178, 178,
|
786
|
+
178, 178, 178, 178, 178, 178, 178, 178,
|
787
|
+
178, 178, 178, 178, 178, 178, 178, 178,
|
788
|
+
178, 178, 178, 178, 178, 178, 178, 178,
|
789
|
+
178, 178, 178, 178, 178, 178, 178, 178,
|
790
|
+
178, 178, 178, 178, 178, 178, 178, 177,
|
791
|
+
180, 180, 180, 180, 180, 180, 180, 180,
|
792
|
+
179, 182, 182, 182, 182, 182, 182, 182,
|
793
|
+
182, 181, 184, 64, 186, 185, 64, 188,
|
788
794
|
69, 69, 69, 69, 69, 69, 69, 69,
|
789
795
|
69, 69, 69, 69, 69, 69, 69, 69,
|
790
796
|
69, 69, 69, 69, 69, 69, 69, 69,
|
791
|
-
69, 69,
|
792
|
-
69,
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
87,
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
91, 91, 91, 91,
|
810
|
-
|
811
|
-
|
797
|
+
69, 69, 69, 69, 69, 69, 69, 189,
|
798
|
+
69, 191, 190, 69, 72, 69, 193, 193,
|
799
|
+
193, 193, 193, 193, 193, 193, 193, 193,
|
800
|
+
192, 192, 192, 192, 192, 192, 192, 193,
|
801
|
+
193, 193, 193, 193, 193, 192, 192, 192,
|
802
|
+
192, 192, 192, 192, 192, 192, 192, 192,
|
803
|
+
192, 192, 192, 192, 192, 192, 192, 192,
|
804
|
+
192, 192, 192, 192, 192, 192, 192, 193,
|
805
|
+
193, 193, 193, 193, 193, 192, 195, 194,
|
806
|
+
194, 194, 194, 194, 196, 194, 194, 194,
|
807
|
+
197, 197, 197, 197, 197, 197, 197, 197,
|
808
|
+
197, 194, 194, 198, 194, 88, 87, 87,
|
809
|
+
87, 87, 87, 199, 87, 87, 199, 199,
|
810
|
+
199, 199, 199, 199, 199, 199, 199, 199,
|
811
|
+
87, 90, 90, 90, 90, 90, 90, 90,
|
812
|
+
90, 90, 199, 89, 199, 199, 199, 199,
|
813
|
+
199, 199, 90, 90, 90, 90, 90, 90,
|
814
|
+
90, 90, 90, 90, 199, 199, 91, 91,
|
815
|
+
91, 91, 91, 91, 91, 91, 91, 91,
|
816
|
+
91, 199, 91, 91, 199, 199, 199, 199,
|
817
|
+
199, 199, 199, 199, 199, 199, 91, 91,
|
818
|
+
91, 91, 88, 91, 0
|
812
819
|
]
|
813
820
|
|
814
821
|
class << self
|
@@ -823,11 +830,11 @@ self._re_scanner_trans_targs = [
|
|
823
830
|
27, 29, 28, 30, 32, 33, 35, 34,
|
824
831
|
36, 73, 38, 73, 39, 41, 0, 42,
|
825
832
|
43, 90, 91, 91, 44, 91, 91, 91,
|
826
|
-
47, 48, 91, 91,
|
827
|
-
|
828
|
-
|
829
|
-
64, 65, 66, 67,
|
830
|
-
70,
|
833
|
+
47, 48, 91, 91, 101, 101, 49, 52,
|
834
|
+
101, 107, 101, 109, 55, 101, 110, 101,
|
835
|
+
112, 58, 61, 59, 60, 101, 62, 63,
|
836
|
+
64, 65, 66, 67, 101, 114, 115, 69,
|
837
|
+
70, 115, 71, 72, 3, 75, 76, 77,
|
831
838
|
78, 79, 73, 80, 73, 84, 85, 73,
|
832
839
|
86, 73, 87, 73, 73, 88, 73, 73,
|
833
840
|
73, 73, 73, 73, 81, 73, 82, 5,
|
@@ -835,12 +842,12 @@ self._re_scanner_trans_targs = [
|
|
835
842
|
73, 73, 73, 73, 73, 9, 24, 73,
|
836
843
|
37, 89, 40, 92, 93, 94, 91, 95,
|
837
844
|
96, 97, 91, 91, 91, 91, 45, 91,
|
838
|
-
91, 46, 91, 91, 91, 98,
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
115, 116, 117,
|
845
|
+
91, 46, 91, 91, 91, 98, 99, 98,
|
846
|
+
98, 100, 98, 102, 103, 104, 101, 105,
|
847
|
+
105, 101, 51, 101, 54, 101, 101, 57,
|
848
|
+
68, 101, 50, 101, 106, 101, 101, 101,
|
849
|
+
108, 101, 53, 101, 111, 113, 101, 56,
|
850
|
+
101, 101, 115, 116, 117, 118, 119, 115
|
844
851
|
]
|
845
852
|
|
846
853
|
class << self
|
@@ -867,12 +874,12 @@ self._re_scanner_trans_actions = [
|
|
867
874
|
59, 60, 61, 62, 63, 0, 0, 64,
|
868
875
|
0, 66, 0, 0, 41, 41, 67, 0,
|
869
876
|
41, 68, 69, 70, 71, 72, 0, 73,
|
870
|
-
74, 0, 75, 76, 77, 78,
|
871
|
-
|
872
|
-
|
873
|
-
0, 89, 90,
|
874
|
-
41,
|
875
|
-
41, 41, 41,
|
877
|
+
74, 0, 75, 76, 77, 78, 0, 79,
|
878
|
+
80, 0, 81, 0, 41, 41, 82, 83,
|
879
|
+
84, 85, 0, 86, 0, 87, 88, 0,
|
880
|
+
0, 89, 0, 90, 0, 91, 92, 93,
|
881
|
+
41, 94, 0, 95, 41, 0, 96, 0,
|
882
|
+
97, 98, 99, 41, 41, 41, 41, 100
|
876
883
|
]
|
877
884
|
|
878
885
|
class << self
|
@@ -892,9 +899,9 @@ self._re_scanner_to_state_actions = [
|
|
892
899
|
0, 34, 0, 0, 0, 0, 0, 0,
|
893
900
|
0, 0, 0, 0, 0, 0, 0, 0,
|
894
901
|
0, 65, 65, 65, 0, 0, 0, 0,
|
895
|
-
0, 0, 65,
|
902
|
+
0, 0, 65, 0, 0, 65, 0, 0,
|
896
903
|
0, 0, 0, 0, 0, 0, 0, 0,
|
897
|
-
0, 65, 0, 0, 0, 0
|
904
|
+
0, 0, 0, 65, 0, 0, 0, 0
|
898
905
|
]
|
899
906
|
|
900
907
|
class << self
|
@@ -914,9 +921,9 @@ self._re_scanner_from_state_actions = [
|
|
914
921
|
0, 35, 0, 0, 0, 0, 0, 0,
|
915
922
|
0, 0, 0, 0, 0, 0, 0, 0,
|
916
923
|
0, 35, 35, 35, 0, 0, 0, 0,
|
917
|
-
0, 0, 35,
|
924
|
+
0, 0, 35, 0, 0, 35, 0, 0,
|
918
925
|
0, 0, 0, 0, 0, 0, 0, 0,
|
919
|
-
0, 35, 0, 0, 0, 0
|
926
|
+
0, 0, 0, 35, 0, 0, 0, 0
|
920
927
|
]
|
921
928
|
|
922
929
|
class << self
|
@@ -936,9 +943,9 @@ self._re_scanner_eof_actions = [
|
|
936
943
|
0, 0, 0, 0, 0, 0, 0, 0,
|
937
944
|
0, 0, 0, 0, 0, 0, 0, 0,
|
938
945
|
0, 0, 0, 25, 0, 0, 0, 0,
|
939
|
-
0, 0, 0,
|
946
|
+
0, 0, 0, 0, 0, 25, 0, 0,
|
940
947
|
0, 0, 0, 0, 0, 0, 0, 0,
|
941
|
-
0, 0, 0, 0, 0, 0
|
948
|
+
0, 0, 0, 0, 0, 0, 0, 0
|
942
949
|
]
|
943
950
|
|
944
951
|
class << self
|
@@ -958,9 +965,9 @@ self._re_scanner_eof_trans = [
|
|
958
965
|
87, 0, 112, 112, 113, 113, 112, 114,
|
959
966
|
116, 118, 118, 124, 125, 127, 129, 131,
|
960
967
|
136, 0, 0, 0, 150, 150, 150, 150,
|
961
|
-
153, 156, 0,
|
962
|
-
178, 180,
|
963
|
-
|
968
|
+
153, 156, 0, 161, 161, 0, 178, 178,
|
969
|
+
178, 180, 182, 184, 184, 184, 188, 188,
|
970
|
+
188, 188, 193, 0, 200, 200, 200, 200
|
964
971
|
]
|
965
972
|
|
966
973
|
class << self
|
@@ -995,20 +1002,20 @@ self.re_scanner_en_set_escape_sequence = 98;
|
|
995
1002
|
class << self
|
996
1003
|
attr_accessor :re_scanner_en_escape_sequence
|
997
1004
|
end
|
998
|
-
self.re_scanner_en_escape_sequence =
|
1005
|
+
self.re_scanner_en_escape_sequence = 101;
|
999
1006
|
class << self
|
1000
1007
|
attr_accessor :re_scanner_en_conditional_expression
|
1001
1008
|
end
|
1002
|
-
self.re_scanner_en_conditional_expression =
|
1009
|
+
self.re_scanner_en_conditional_expression = 115;
|
1003
1010
|
class << self
|
1004
1011
|
attr_accessor :re_scanner_en_main
|
1005
1012
|
end
|
1006
1013
|
self.re_scanner_en_main = 73;
|
1007
1014
|
|
1008
1015
|
|
1009
|
-
# line
|
1016
|
+
# line 749 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1010
1017
|
|
1011
|
-
# line
|
1018
|
+
# line 1018 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner.rb"
|
1012
1019
|
begin
|
1013
1020
|
p ||= 0
|
1014
1021
|
pe ||= data.length
|
@@ -1019,9 +1026,9 @@ begin
|
|
1019
1026
|
act = 0
|
1020
1027
|
end
|
1021
1028
|
|
1022
|
-
# line
|
1029
|
+
# line 750 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1023
1030
|
|
1024
|
-
# line
|
1031
|
+
# line 1031 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner.rb"
|
1025
1032
|
begin
|
1026
1033
|
testEof = false
|
1027
1034
|
_slen, _trans, _keys, _inds, _acts, _nacts = nil
|
@@ -1049,7 +1056,7 @@ begin
|
|
1049
1056
|
begin
|
1050
1057
|
ts = p
|
1051
1058
|
end
|
1052
|
-
# line
|
1059
|
+
# line 1059 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner.rb"
|
1053
1060
|
end
|
1054
1061
|
_keys = cs << 1
|
1055
1062
|
_inds = _re_scanner_index_offsets[cs]
|
@@ -1069,11 +1076,11 @@ ts = p
|
|
1069
1076
|
if _re_scanner_trans_actions[_trans] != 0
|
1070
1077
|
case _re_scanner_trans_actions[_trans]
|
1071
1078
|
when 37 then
|
1072
|
-
# line
|
1079
|
+
# line 147 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1073
1080
|
begin
|
1074
1081
|
self.group_depth = group_depth + 1 end
|
1075
1082
|
when 4 then
|
1076
|
-
# line
|
1083
|
+
# line 148 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1077
1084
|
begin
|
1078
1085
|
self.group_depth = group_depth - 1 end
|
1079
1086
|
when 41 then
|
@@ -1082,7 +1089,7 @@ ts = p
|
|
1082
1089
|
te = p+1
|
1083
1090
|
end
|
1084
1091
|
when 66 then
|
1085
|
-
# line 12 "/Users/
|
1092
|
+
# line 12 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/char_type.rl"
|
1086
1093
|
begin
|
1087
1094
|
te = p+1
|
1088
1095
|
begin
|
@@ -1108,14 +1115,14 @@ te = p+1
|
|
1108
1115
|
end
|
1109
1116
|
end
|
1110
1117
|
when 15 then
|
1111
|
-
# line 16 "/Users/
|
1118
|
+
# line 16 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/property.rl"
|
1112
1119
|
begin
|
1113
1120
|
te = p+1
|
1114
1121
|
begin
|
1115
1122
|
text = copy(data, ts-1, te)
|
1116
1123
|
type = (text[1] == 'P') ^ (text[3] == '^') ? :nonproperty : :property
|
1117
1124
|
|
1118
|
-
name =
|
1125
|
+
name = text[3..-2].gsub(/[\^\s_\-]/, '').downcase
|
1119
1126
|
|
1120
1127
|
token = self.class.short_prop_map[name] || self.class.long_prop_map[name]
|
1121
1128
|
validation_error(:property, name) unless token
|
@@ -1132,7 +1139,7 @@ te = p+1
|
|
1132
1139
|
end
|
1133
1140
|
end
|
1134
1141
|
when 19 then
|
1135
|
-
# line
|
1142
|
+
# line 175 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1136
1143
|
begin
|
1137
1144
|
te = p+1
|
1138
1145
|
begin # special case, emits two tokens
|
@@ -1141,28 +1148,27 @@ te = p+1
|
|
1141
1148
|
end
|
1142
1149
|
end
|
1143
1150
|
when 71 then
|
1144
|
-
# line
|
1151
|
+
# line 180 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1145
1152
|
begin
|
1146
1153
|
te = p+1
|
1147
1154
|
begin
|
1148
|
-
|
1149
|
-
|
1150
|
-
emit(:set, :negate, text)
|
1155
|
+
if prev_token[1] == :open
|
1156
|
+
emit(:set, :negate, '^')
|
1151
1157
|
else
|
1152
|
-
emit(:literal, :literal,
|
1158
|
+
emit(:literal, :literal, '^')
|
1153
1159
|
end
|
1154
1160
|
end
|
1155
1161
|
end
|
1156
1162
|
when 73 then
|
1157
|
-
# line
|
1163
|
+
# line 200 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1158
1164
|
begin
|
1159
1165
|
te = p+1
|
1160
1166
|
begin
|
1161
|
-
emit(:set, :intersection,
|
1167
|
+
emit(:set, :intersection, '&&')
|
1162
1168
|
end
|
1163
1169
|
end
|
1164
1170
|
when 69 then
|
1165
|
-
# line
|
1171
|
+
# line 204 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1166
1172
|
begin
|
1167
1173
|
te = p+1
|
1168
1174
|
begin
|
@@ -1177,7 +1183,7 @@ te = p+1
|
|
1177
1183
|
end
|
1178
1184
|
end
|
1179
1185
|
when 67 then
|
1180
|
-
# line
|
1186
|
+
# line 238 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1181
1187
|
begin
|
1182
1188
|
te = p+1
|
1183
1189
|
begin
|
@@ -1185,7 +1191,7 @@ te = p+1
|
|
1185
1191
|
end
|
1186
1192
|
end
|
1187
1193
|
when 17 then
|
1188
|
-
# line
|
1194
|
+
# line 242 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1189
1195
|
begin
|
1190
1196
|
te = p+1
|
1191
1197
|
begin
|
@@ -1194,25 +1200,25 @@ te = p+1
|
|
1194
1200
|
end
|
1195
1201
|
end
|
1196
1202
|
when 74 then
|
1197
|
-
# line
|
1203
|
+
# line 188 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1198
1204
|
begin
|
1199
1205
|
te = p
|
1200
1206
|
p = p - 1; begin
|
1201
|
-
|
1202
|
-
#
|
1203
|
-
if
|
1204
|
-
emit(:literal, :literal,
|
1207
|
+
# ranges cant start with the opening bracket, a subset, or
|
1208
|
+
# intersection/negation/range operators
|
1209
|
+
if prev_token[0] == :set
|
1210
|
+
emit(:literal, :literal, '-')
|
1205
1211
|
else
|
1206
|
-
emit(:set, :range,
|
1212
|
+
emit(:set, :range, '-')
|
1207
1213
|
end
|
1208
1214
|
end
|
1209
1215
|
end
|
1210
1216
|
when 77 then
|
1211
|
-
# line
|
1217
|
+
# line 208 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1212
1218
|
begin
|
1213
1219
|
te = p
|
1214
1220
|
p = p - 1; begin
|
1215
|
-
emit(:set, :open,
|
1221
|
+
emit(:set, :open, '[')
|
1216
1222
|
begin
|
1217
1223
|
stack[top] = cs
|
1218
1224
|
top+= 1
|
@@ -1224,7 +1230,7 @@ p = p - 1; begin
|
|
1224
1230
|
end
|
1225
1231
|
end
|
1226
1232
|
when 72 then
|
1227
|
-
# line
|
1233
|
+
# line 242 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1228
1234
|
begin
|
1229
1235
|
te = p
|
1230
1236
|
p = p - 1; begin
|
@@ -1233,25 +1239,25 @@ p = p - 1; begin
|
|
1233
1239
|
end
|
1234
1240
|
end
|
1235
1241
|
when 18 then
|
1236
|
-
# line
|
1242
|
+
# line 188 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1237
1243
|
begin
|
1238
1244
|
begin p = ((te))-1; end
|
1239
1245
|
begin
|
1240
|
-
|
1241
|
-
#
|
1242
|
-
if
|
1243
|
-
emit(:literal, :literal,
|
1246
|
+
# ranges cant start with the opening bracket, a subset, or
|
1247
|
+
# intersection/negation/range operators
|
1248
|
+
if prev_token[0] == :set
|
1249
|
+
emit(:literal, :literal, '-')
|
1244
1250
|
else
|
1245
|
-
emit(:set, :range,
|
1251
|
+
emit(:set, :range, '-')
|
1246
1252
|
end
|
1247
1253
|
end
|
1248
1254
|
end
|
1249
1255
|
when 21 then
|
1250
|
-
# line
|
1256
|
+
# line 208 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1251
1257
|
begin
|
1252
1258
|
begin p = ((te))-1; end
|
1253
1259
|
begin
|
1254
|
-
emit(:set, :open,
|
1260
|
+
emit(:set, :open, '[')
|
1255
1261
|
begin
|
1256
1262
|
stack[top] = cs
|
1257
1263
|
top+= 1
|
@@ -1263,16 +1269,31 @@ p = p - 1; begin
|
|
1263
1269
|
end
|
1264
1270
|
end
|
1265
1271
|
when 16 then
|
1266
|
-
# line
|
1272
|
+
# line 242 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1267
1273
|
begin
|
1268
1274
|
begin p = ((te))-1; end
|
1269
1275
|
begin
|
1270
1276
|
text = copy(data, ts, te)
|
1271
1277
|
emit(:literal, :literal, text)
|
1278
|
+
end
|
1279
|
+
end
|
1280
|
+
when 81 then
|
1281
|
+
# line 252 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1282
|
+
begin
|
1283
|
+
te = p+1
|
1284
|
+
begin
|
1285
|
+
emit(:escape, :octal, copy(data, ts-1, te))
|
1286
|
+
begin
|
1287
|
+
top -= 1
|
1288
|
+
cs = stack[top]
|
1289
|
+
_goto_level = _again
|
1290
|
+
next
|
1291
|
+
end
|
1292
|
+
|
1272
1293
|
end
|
1273
1294
|
end
|
1274
1295
|
when 79 then
|
1275
|
-
# line
|
1296
|
+
# line 258 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1276
1297
|
begin
|
1277
1298
|
te = p+1
|
1278
1299
|
begin
|
@@ -1281,7 +1302,7 @@ te = p+1
|
|
1281
1302
|
begin
|
1282
1303
|
stack[top] = cs
|
1283
1304
|
top+= 1
|
1284
|
-
cs =
|
1305
|
+
cs = 101
|
1285
1306
|
_goto_level = _again
|
1286
1307
|
next
|
1287
1308
|
end
|
@@ -1289,7 +1310,7 @@ te = p+1
|
|
1289
1310
|
end
|
1290
1311
|
end
|
1291
1312
|
when 78 then
|
1292
|
-
# line
|
1313
|
+
# line 267 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1293
1314
|
begin
|
1294
1315
|
te = p+1
|
1295
1316
|
begin
|
@@ -1303,8 +1324,23 @@ te = p+1
|
|
1303
1324
|
|
1304
1325
|
end
|
1305
1326
|
end
|
1306
|
-
when
|
1307
|
-
# line
|
1327
|
+
when 80 then
|
1328
|
+
# line 252 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1329
|
+
begin
|
1330
|
+
te = p
|
1331
|
+
p = p - 1; begin
|
1332
|
+
emit(:escape, :octal, copy(data, ts-1, te))
|
1333
|
+
begin
|
1334
|
+
top -= 1
|
1335
|
+
cs = stack[top]
|
1336
|
+
_goto_level = _again
|
1337
|
+
next
|
1338
|
+
end
|
1339
|
+
|
1340
|
+
end
|
1341
|
+
end
|
1342
|
+
when 85 then
|
1343
|
+
# line 277 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1308
1344
|
begin
|
1309
1345
|
te = p+1
|
1310
1346
|
begin
|
@@ -1319,8 +1355,8 @@ te = p+1
|
|
1319
1355
|
|
1320
1356
|
end
|
1321
1357
|
end
|
1322
|
-
when
|
1323
|
-
# line
|
1358
|
+
when 92 then
|
1359
|
+
# line 283 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1324
1360
|
begin
|
1325
1361
|
te = p+1
|
1326
1362
|
begin
|
@@ -1334,8 +1370,8 @@ te = p+1
|
|
1334
1370
|
|
1335
1371
|
end
|
1336
1372
|
end
|
1337
|
-
when
|
1338
|
-
# line
|
1373
|
+
when 82 then
|
1374
|
+
# line 288 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1339
1375
|
begin
|
1340
1376
|
te = p+1
|
1341
1377
|
begin
|
@@ -1365,8 +1401,8 @@ te = p+1
|
|
1365
1401
|
|
1366
1402
|
end
|
1367
1403
|
end
|
1368
|
-
when
|
1369
|
-
# line
|
1404
|
+
when 88 then
|
1405
|
+
# line 309 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1370
1406
|
begin
|
1371
1407
|
te = p+1
|
1372
1408
|
begin
|
@@ -1392,7 +1428,7 @@ te = p+1
|
|
1392
1428
|
end
|
1393
1429
|
end
|
1394
1430
|
when 30 then
|
1395
|
-
# line
|
1431
|
+
# line 325 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1396
1432
|
begin
|
1397
1433
|
te = p+1
|
1398
1434
|
begin
|
@@ -1411,8 +1447,8 @@ te = p+1
|
|
1411
1447
|
|
1412
1448
|
end
|
1413
1449
|
end
|
1414
|
-
when
|
1415
|
-
# line
|
1450
|
+
when 98 then
|
1451
|
+
# line 335 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1416
1452
|
begin
|
1417
1453
|
te = p+1
|
1418
1454
|
begin
|
@@ -1427,7 +1463,7 @@ te = p+1
|
|
1427
1463
|
end
|
1428
1464
|
end
|
1429
1465
|
when 26 then
|
1430
|
-
# line
|
1466
|
+
# line 344 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1431
1467
|
begin
|
1432
1468
|
te = p+1
|
1433
1469
|
begin
|
@@ -1442,7 +1478,7 @@ te = p+1
|
|
1442
1478
|
end
|
1443
1479
|
end
|
1444
1480
|
when 28 then
|
1445
|
-
# line
|
1481
|
+
# line 349 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1446
1482
|
begin
|
1447
1483
|
te = p+1
|
1448
1484
|
begin
|
@@ -1456,8 +1492,8 @@ te = p+1
|
|
1456
1492
|
|
1457
1493
|
end
|
1458
1494
|
end
|
1459
|
-
when
|
1460
|
-
# line
|
1495
|
+
when 86 then
|
1496
|
+
# line 354 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1461
1497
|
begin
|
1462
1498
|
te = p+1
|
1463
1499
|
begin
|
@@ -1473,8 +1509,8 @@ te = p+1
|
|
1473
1509
|
|
1474
1510
|
end
|
1475
1511
|
end
|
1476
|
-
when
|
1477
|
-
# line
|
1512
|
+
when 87 then
|
1513
|
+
# line 360 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1478
1514
|
begin
|
1479
1515
|
te = p+1
|
1480
1516
|
begin
|
@@ -1491,7 +1527,7 @@ te = p+1
|
|
1491
1527
|
end
|
1492
1528
|
end
|
1493
1529
|
when 24 then
|
1494
|
-
# line
|
1530
|
+
# line 366 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1495
1531
|
begin
|
1496
1532
|
te = p+1
|
1497
1533
|
begin
|
@@ -1505,8 +1541,8 @@ te = p+1
|
|
1505
1541
|
|
1506
1542
|
end
|
1507
1543
|
end
|
1508
|
-
when
|
1509
|
-
# line
|
1544
|
+
when 91 then
|
1545
|
+
# line 283 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1510
1546
|
begin
|
1511
1547
|
te = p
|
1512
1548
|
p = p - 1; begin
|
@@ -1520,8 +1556,8 @@ p = p - 1; begin
|
|
1520
1556
|
|
1521
1557
|
end
|
1522
1558
|
end
|
1523
|
-
when
|
1524
|
-
# line
|
1559
|
+
when 97 then
|
1560
|
+
# line 335 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1525
1561
|
begin
|
1526
1562
|
te = p
|
1527
1563
|
p = p - 1; begin
|
@@ -1535,8 +1571,8 @@ p = p - 1; begin
|
|
1535
1571
|
|
1536
1572
|
end
|
1537
1573
|
end
|
1538
|
-
when
|
1539
|
-
# line
|
1574
|
+
when 94 then
|
1575
|
+
# line 344 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1540
1576
|
begin
|
1541
1577
|
te = p
|
1542
1578
|
p = p - 1; begin
|
@@ -1550,8 +1586,8 @@ p = p - 1; begin
|
|
1550
1586
|
|
1551
1587
|
end
|
1552
1588
|
end
|
1553
|
-
when
|
1554
|
-
# line
|
1589
|
+
when 96 then
|
1590
|
+
# line 349 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1555
1591
|
begin
|
1556
1592
|
te = p
|
1557
1593
|
p = p - 1; begin
|
@@ -1565,8 +1601,8 @@ p = p - 1; begin
|
|
1565
1601
|
|
1566
1602
|
end
|
1567
1603
|
end
|
1568
|
-
when
|
1569
|
-
# line
|
1604
|
+
when 89 then
|
1605
|
+
# line 366 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1570
1606
|
begin
|
1571
1607
|
te = p
|
1572
1608
|
p = p - 1; begin
|
@@ -1581,7 +1617,7 @@ p = p - 1; begin
|
|
1581
1617
|
end
|
1582
1618
|
end
|
1583
1619
|
when 23 then
|
1584
|
-
# line
|
1620
|
+
# line 366 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1585
1621
|
begin
|
1586
1622
|
begin p = ((te))-1; end
|
1587
1623
|
begin
|
@@ -1595,11 +1631,11 @@ p = p - 1; begin
|
|
1595
1631
|
|
1596
1632
|
end
|
1597
1633
|
end
|
1598
|
-
when
|
1634
|
+
when 90 then
|
1599
1635
|
# line 1 "NONE"
|
1600
1636
|
begin
|
1601
1637
|
case act
|
1602
|
-
when
|
1638
|
+
when 17 then
|
1603
1639
|
begin begin p = ((te))-1; end
|
1604
1640
|
|
1605
1641
|
text = copy(data, ts-1, te)
|
@@ -1612,7 +1648,7 @@ p = p - 1; begin
|
|
1612
1648
|
end
|
1613
1649
|
|
1614
1650
|
end
|
1615
|
-
when
|
1651
|
+
when 18 then
|
1616
1652
|
begin begin p = ((te))-1; end
|
1617
1653
|
|
1618
1654
|
emit(:escape, :octal, copy(data, ts-1, te))
|
@@ -1627,7 +1663,7 @@ p = p - 1; begin
|
|
1627
1663
|
end
|
1628
1664
|
end
|
1629
1665
|
when 33 then
|
1630
|
-
# line
|
1666
|
+
# line 376 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1631
1667
|
begin
|
1632
1668
|
te = p+1
|
1633
1669
|
begin
|
@@ -1636,8 +1672,8 @@ te = p+1
|
|
1636
1672
|
emit(:conditional, :condition_close, ')')
|
1637
1673
|
end
|
1638
1674
|
end
|
1639
|
-
when
|
1640
|
-
# line
|
1675
|
+
when 99 then
|
1676
|
+
# line 382 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1641
1677
|
begin
|
1642
1678
|
te = p+1
|
1643
1679
|
begin
|
@@ -1652,8 +1688,8 @@ te = p+1
|
|
1652
1688
|
|
1653
1689
|
end
|
1654
1690
|
end
|
1655
|
-
when
|
1656
|
-
# line
|
1691
|
+
when 100 then
|
1692
|
+
# line 382 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1657
1693
|
begin
|
1658
1694
|
te = p
|
1659
1695
|
p = p - 1; begin
|
@@ -1669,7 +1705,7 @@ p = p - 1; begin
|
|
1669
1705
|
end
|
1670
1706
|
end
|
1671
1707
|
when 32 then
|
1672
|
-
# line
|
1708
|
+
# line 382 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1673
1709
|
begin
|
1674
1710
|
begin p = ((te))-1; end
|
1675
1711
|
begin
|
@@ -1685,7 +1721,7 @@ p = p - 1; begin
|
|
1685
1721
|
end
|
1686
1722
|
end
|
1687
1723
|
when 39 then
|
1688
|
-
# line
|
1724
|
+
# line 395 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1689
1725
|
begin
|
1690
1726
|
te = p+1
|
1691
1727
|
begin
|
@@ -1693,7 +1729,7 @@ te = p+1
|
|
1693
1729
|
end
|
1694
1730
|
end
|
1695
1731
|
when 44 then
|
1696
|
-
# line
|
1732
|
+
# line 399 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1697
1733
|
begin
|
1698
1734
|
te = p+1
|
1699
1735
|
begin
|
@@ -1705,7 +1741,7 @@ te = p+1
|
|
1705
1741
|
end
|
1706
1742
|
end
|
1707
1743
|
when 43 then
|
1708
|
-
# line
|
1744
|
+
# line 409 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1709
1745
|
begin
|
1710
1746
|
te = p+1
|
1711
1747
|
begin
|
@@ -1713,7 +1749,7 @@ te = p+1
|
|
1713
1749
|
end
|
1714
1750
|
end
|
1715
1751
|
when 36 then
|
1716
|
-
# line
|
1752
|
+
# line 413 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1717
1753
|
begin
|
1718
1754
|
te = p+1
|
1719
1755
|
begin
|
@@ -1721,7 +1757,7 @@ te = p+1
|
|
1721
1757
|
end
|
1722
1758
|
end
|
1723
1759
|
when 63 then
|
1724
|
-
# line
|
1760
|
+
# line 417 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1725
1761
|
begin
|
1726
1762
|
te = p+1
|
1727
1763
|
begin
|
@@ -1729,7 +1765,7 @@ te = p+1
|
|
1729
1765
|
end
|
1730
1766
|
end
|
1731
1767
|
when 62 then
|
1732
|
-
# line
|
1768
|
+
# line 421 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1733
1769
|
begin
|
1734
1770
|
te = p+1
|
1735
1771
|
begin
|
@@ -1744,7 +1780,7 @@ te = p+1
|
|
1744
1780
|
end
|
1745
1781
|
end
|
1746
1782
|
when 42 then
|
1747
|
-
# line
|
1783
|
+
# line 432 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1748
1784
|
begin
|
1749
1785
|
te = p+1
|
1750
1786
|
begin
|
@@ -1752,7 +1788,7 @@ te = p+1
|
|
1752
1788
|
end
|
1753
1789
|
end
|
1754
1790
|
when 52 then
|
1755
|
-
# line
|
1791
|
+
# line 447 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1756
1792
|
begin
|
1757
1793
|
te = p+1
|
1758
1794
|
begin
|
@@ -1765,7 +1801,7 @@ te = p+1
|
|
1765
1801
|
begin
|
1766
1802
|
stack[top] = cs
|
1767
1803
|
top+= 1
|
1768
|
-
cs =
|
1804
|
+
cs = 115
|
1769
1805
|
_goto_level = _again
|
1770
1806
|
next
|
1771
1807
|
end
|
@@ -1773,7 +1809,7 @@ te = p+1
|
|
1773
1809
|
end
|
1774
1810
|
end
|
1775
1811
|
when 53 then
|
1776
|
-
# line
|
1812
|
+
# line 478 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1777
1813
|
begin
|
1778
1814
|
te = p+1
|
1779
1815
|
begin
|
@@ -1785,7 +1821,7 @@ te = p+1
|
|
1785
1821
|
end
|
1786
1822
|
end
|
1787
1823
|
when 7 then
|
1788
|
-
# line
|
1824
|
+
# line 492 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1789
1825
|
begin
|
1790
1826
|
te = p+1
|
1791
1827
|
begin
|
@@ -1798,7 +1834,7 @@ te = p+1
|
|
1798
1834
|
end
|
1799
1835
|
end
|
1800
1836
|
when 6 then
|
1801
|
-
# line
|
1837
|
+
# line 509 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1802
1838
|
begin
|
1803
1839
|
te = p+1
|
1804
1840
|
begin
|
@@ -1820,7 +1856,7 @@ te = p+1
|
|
1820
1856
|
end
|
1821
1857
|
end
|
1822
1858
|
when 11 then
|
1823
|
-
# line
|
1859
|
+
# line 550 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1824
1860
|
begin
|
1825
1861
|
te = p+1
|
1826
1862
|
begin
|
@@ -1841,7 +1877,7 @@ te = p+1
|
|
1841
1877
|
end
|
1842
1878
|
end
|
1843
1879
|
when 10 then
|
1844
|
-
# line
|
1880
|
+
# line 569 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1845
1881
|
begin
|
1846
1882
|
te = p+1
|
1847
1883
|
begin
|
@@ -1858,7 +1894,7 @@ te = p+1
|
|
1858
1894
|
end
|
1859
1895
|
end
|
1860
1896
|
when 60 then
|
1861
|
-
# line
|
1897
|
+
# line 585 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1862
1898
|
begin
|
1863
1899
|
te = p+1
|
1864
1900
|
begin
|
@@ -1870,7 +1906,7 @@ te = p+1
|
|
1870
1906
|
end
|
1871
1907
|
end
|
1872
1908
|
when 56 then
|
1873
|
-
# line
|
1909
|
+
# line 593 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1874
1910
|
begin
|
1875
1911
|
te = p+1
|
1876
1912
|
begin
|
@@ -1882,7 +1918,7 @@ te = p+1
|
|
1882
1918
|
end
|
1883
1919
|
end
|
1884
1920
|
when 58 then
|
1885
|
-
# line
|
1921
|
+
# line 601 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1886
1922
|
begin
|
1887
1923
|
te = p+1
|
1888
1924
|
begin
|
@@ -1894,7 +1930,7 @@ te = p+1
|
|
1894
1930
|
end
|
1895
1931
|
end
|
1896
1932
|
when 13 then
|
1897
|
-
# line
|
1933
|
+
# line 609 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1898
1934
|
begin
|
1899
1935
|
te = p+1
|
1900
1936
|
begin
|
@@ -1902,7 +1938,7 @@ te = p+1
|
|
1902
1938
|
end
|
1903
1939
|
end
|
1904
1940
|
when 48 then
|
1905
|
-
# line
|
1941
|
+
# line 624 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1906
1942
|
begin
|
1907
1943
|
te = p+1
|
1908
1944
|
begin
|
@@ -1917,7 +1953,7 @@ te = p+1
|
|
1917
1953
|
end
|
1918
1954
|
end
|
1919
1955
|
when 51 then
|
1920
|
-
# line
|
1956
|
+
# line 478 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1921
1957
|
begin
|
1922
1958
|
te = p
|
1923
1959
|
p = p - 1; begin
|
@@ -1929,7 +1965,7 @@ p = p - 1; begin
|
|
1929
1965
|
end
|
1930
1966
|
end
|
1931
1967
|
when 54 then
|
1932
|
-
# line
|
1968
|
+
# line 492 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1933
1969
|
begin
|
1934
1970
|
te = p
|
1935
1971
|
p = p - 1; begin
|
@@ -1942,7 +1978,7 @@ p = p - 1; begin
|
|
1942
1978
|
end
|
1943
1979
|
end
|
1944
1980
|
when 49 then
|
1945
|
-
# line
|
1981
|
+
# line 527 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1946
1982
|
begin
|
1947
1983
|
te = p
|
1948
1984
|
p = p - 1; begin
|
@@ -1951,7 +1987,7 @@ p = p - 1; begin
|
|
1951
1987
|
end
|
1952
1988
|
end
|
1953
1989
|
when 59 then
|
1954
|
-
# line
|
1990
|
+
# line 585 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1955
1991
|
begin
|
1956
1992
|
te = p
|
1957
1993
|
p = p - 1; begin
|
@@ -1963,7 +1999,7 @@ p = p - 1; begin
|
|
1963
1999
|
end
|
1964
2000
|
end
|
1965
2001
|
when 55 then
|
1966
|
-
# line
|
2002
|
+
# line 593 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1967
2003
|
begin
|
1968
2004
|
te = p
|
1969
2005
|
p = p - 1; begin
|
@@ -1975,7 +2011,7 @@ p = p - 1; begin
|
|
1975
2011
|
end
|
1976
2012
|
end
|
1977
2013
|
when 57 then
|
1978
|
-
# line
|
2014
|
+
# line 601 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1979
2015
|
begin
|
1980
2016
|
te = p
|
1981
2017
|
p = p - 1; begin
|
@@ -1987,7 +2023,7 @@ p = p - 1; begin
|
|
1987
2023
|
end
|
1988
2024
|
end
|
1989
2025
|
when 64 then
|
1990
|
-
# line
|
2026
|
+
# line 614 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1991
2027
|
begin
|
1992
2028
|
te = p
|
1993
2029
|
p = p - 1; begin
|
@@ -1995,14 +2031,14 @@ p = p - 1; begin
|
|
1995
2031
|
end
|
1996
2032
|
end
|
1997
2033
|
when 61 then
|
1998
|
-
# line
|
2034
|
+
# line 620 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
1999
2035
|
begin
|
2000
2036
|
te = p
|
2001
2037
|
p = p - 1; begin
|
2002
2038
|
begin
|
2003
2039
|
stack[top] = cs
|
2004
2040
|
top+= 1
|
2005
|
-
cs =
|
2041
|
+
cs = 101
|
2006
2042
|
_goto_level = _again
|
2007
2043
|
next
|
2008
2044
|
end
|
@@ -2010,7 +2046,7 @@ p = p - 1; begin
|
|
2010
2046
|
end
|
2011
2047
|
end
|
2012
2048
|
when 47 then
|
2013
|
-
# line
|
2049
|
+
# line 624 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2014
2050
|
begin
|
2015
2051
|
te = p
|
2016
2052
|
p = p - 1; begin
|
@@ -2025,7 +2061,7 @@ p = p - 1; begin
|
|
2025
2061
|
end
|
2026
2062
|
end
|
2027
2063
|
when 46 then
|
2028
|
-
# line
|
2064
|
+
# line 634 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2029
2065
|
begin
|
2030
2066
|
te = p
|
2031
2067
|
p = p - 1; begin
|
@@ -2037,7 +2073,7 @@ p = p - 1; begin
|
|
2037
2073
|
end
|
2038
2074
|
end
|
2039
2075
|
when 45 then
|
2040
|
-
# line
|
2076
|
+
# line 645 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2041
2077
|
begin
|
2042
2078
|
te = p
|
2043
2079
|
p = p - 1; begin
|
@@ -2045,7 +2081,7 @@ p = p - 1; begin
|
|
2045
2081
|
end
|
2046
2082
|
end
|
2047
2083
|
when 3 then
|
2048
|
-
# line
|
2084
|
+
# line 478 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2049
2085
|
begin
|
2050
2086
|
begin p = ((te))-1; end
|
2051
2087
|
begin
|
@@ -2057,7 +2093,7 @@ p = p - 1; begin
|
|
2057
2093
|
end
|
2058
2094
|
end
|
2059
2095
|
when 12 then
|
2060
|
-
# line
|
2096
|
+
# line 614 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2061
2097
|
begin
|
2062
2098
|
begin p = ((te))-1; end
|
2063
2099
|
begin
|
@@ -2065,14 +2101,14 @@ p = p - 1; begin
|
|
2065
2101
|
end
|
2066
2102
|
end
|
2067
2103
|
when 9 then
|
2068
|
-
# line
|
2104
|
+
# line 620 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2069
2105
|
begin
|
2070
2106
|
begin p = ((te))-1; end
|
2071
2107
|
begin
|
2072
2108
|
begin
|
2073
2109
|
stack[top] = cs
|
2074
2110
|
top+= 1
|
2075
|
-
cs =
|
2111
|
+
cs = 101
|
2076
2112
|
_goto_level = _again
|
2077
2113
|
next
|
2078
2114
|
end
|
@@ -2090,7 +2126,7 @@ p = p - 1; begin
|
|
2090
2126
|
next
|
2091
2127
|
end
|
2092
2128
|
end
|
2093
|
-
when
|
2129
|
+
when 41 then
|
2094
2130
|
begin begin p = ((te))-1; end
|
2095
2131
|
|
2096
2132
|
text = copy(data, ts, te)
|
@@ -2099,7 +2135,7 @@ end
|
|
2099
2135
|
end
|
2100
2136
|
emit_options(text)
|
2101
2137
|
end
|
2102
|
-
when
|
2138
|
+
when 42 then
|
2103
2139
|
begin begin p = ((te))-1; end
|
2104
2140
|
|
2105
2141
|
case text = copy(data, ts, te)
|
@@ -2109,7 +2145,7 @@ end
|
|
2109
2145
|
when '(?<!'; emit(:assertion, :nlookbehind, text)
|
2110
2146
|
end
|
2111
2147
|
end
|
2112
|
-
when
|
2148
|
+
when 56 then
|
2113
2149
|
begin begin p = ((te))-1; end
|
2114
2150
|
|
2115
2151
|
append_literal(data, ts, te)
|
@@ -2117,17 +2153,17 @@ end
|
|
2117
2153
|
end
|
2118
2154
|
end
|
2119
2155
|
when 76 then
|
2120
|
-
# line
|
2156
|
+
# line 135 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2121
2157
|
begin
|
2122
2158
|
|
2123
2159
|
text = copy(data, ts ? ts-1 : 0, -1)
|
2124
2160
|
raise PrematureEndError.new( text )
|
2125
2161
|
end
|
2126
|
-
# line
|
2162
|
+
# line 208 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2127
2163
|
begin
|
2128
2164
|
te = p
|
2129
2165
|
p = p - 1; begin
|
2130
|
-
emit(:set, :open,
|
2166
|
+
emit(:set, :open, '[')
|
2131
2167
|
begin
|
2132
2168
|
stack[top] = cs
|
2133
2169
|
top+= 1
|
@@ -2139,17 +2175,17 @@ p = p - 1; begin
|
|
2139
2175
|
end
|
2140
2176
|
end
|
2141
2177
|
when 20 then
|
2142
|
-
# line
|
2178
|
+
# line 135 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2143
2179
|
begin
|
2144
2180
|
|
2145
2181
|
text = copy(data, ts ? ts-1 : 0, -1)
|
2146
2182
|
raise PrematureEndError.new( text )
|
2147
2183
|
end
|
2148
|
-
# line
|
2184
|
+
# line 208 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2149
2185
|
begin
|
2150
2186
|
begin p = ((te))-1; end
|
2151
2187
|
begin
|
2152
|
-
emit(:set, :open,
|
2188
|
+
emit(:set, :open, '[')
|
2153
2189
|
begin
|
2154
2190
|
stack[top] = cs
|
2155
2191
|
top+= 1
|
@@ -2160,14 +2196,14 @@ p = p - 1; begin
|
|
2160
2196
|
|
2161
2197
|
end
|
2162
2198
|
end
|
2163
|
-
when
|
2164
|
-
# line
|
2199
|
+
when 93 then
|
2200
|
+
# line 135 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2165
2201
|
begin
|
2166
2202
|
|
2167
2203
|
text = copy(data, ts ? ts-1 : 0, -1)
|
2168
2204
|
raise PrematureEndError.new( text )
|
2169
2205
|
end
|
2170
|
-
# line
|
2206
|
+
# line 344 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2171
2207
|
begin
|
2172
2208
|
te = p
|
2173
2209
|
p = p - 1; begin
|
@@ -2181,14 +2217,14 @@ p = p - 1; begin
|
|
2181
2217
|
|
2182
2218
|
end
|
2183
2219
|
end
|
2184
|
-
when
|
2185
|
-
# line
|
2220
|
+
when 95 then
|
2221
|
+
# line 135 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2186
2222
|
begin
|
2187
2223
|
|
2188
2224
|
text = copy(data, ts ? ts-1 : 0, -1)
|
2189
2225
|
raise PrematureEndError.new( text )
|
2190
2226
|
end
|
2191
|
-
# line
|
2227
|
+
# line 349 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2192
2228
|
begin
|
2193
2229
|
te = p
|
2194
2230
|
p = p - 1; begin
|
@@ -2203,13 +2239,13 @@ p = p - 1; begin
|
|
2203
2239
|
end
|
2204
2240
|
end
|
2205
2241
|
when 27 then
|
2206
|
-
# line
|
2242
|
+
# line 135 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2207
2243
|
begin
|
2208
2244
|
|
2209
2245
|
text = copy(data, ts ? ts-1 : 0, -1)
|
2210
2246
|
raise PrematureEndError.new( text )
|
2211
2247
|
end
|
2212
|
-
# line
|
2248
|
+
# line 344 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2213
2249
|
begin
|
2214
2250
|
begin p = ((te))-1; end
|
2215
2251
|
begin
|
@@ -2224,13 +2260,13 @@ p = p - 1; begin
|
|
2224
2260
|
end
|
2225
2261
|
end
|
2226
2262
|
when 29 then
|
2227
|
-
# line
|
2263
|
+
# line 135 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2228
2264
|
begin
|
2229
2265
|
|
2230
2266
|
text = copy(data, ts ? ts-1 : 0, -1)
|
2231
2267
|
raise PrematureEndError.new( text )
|
2232
2268
|
end
|
2233
|
-
# line
|
2269
|
+
# line 349 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2234
2270
|
begin
|
2235
2271
|
begin p = ((te))-1; end
|
2236
2272
|
begin
|
@@ -2245,13 +2281,13 @@ p = p - 1; begin
|
|
2245
2281
|
end
|
2246
2282
|
end
|
2247
2283
|
when 31 then
|
2248
|
-
# line
|
2284
|
+
# line 141 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2249
2285
|
begin
|
2250
2286
|
|
2251
2287
|
text = copy(data, ts ? ts-1 : 0, -1)
|
2252
2288
|
validation_error(:sequence, 'sequence', text)
|
2253
2289
|
end
|
2254
|
-
# line
|
2290
|
+
# line 340 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2255
2291
|
begin
|
2256
2292
|
te = p+1
|
2257
2293
|
begin
|
@@ -2265,10 +2301,10 @@ te = p+1
|
|
2265
2301
|
end
|
2266
2302
|
end
|
2267
2303
|
when 5 then
|
2268
|
-
# line
|
2304
|
+
# line 148 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2269
2305
|
begin
|
2270
2306
|
self.group_depth = group_depth - 1 end
|
2271
|
-
# line
|
2307
|
+
# line 463 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2272
2308
|
begin
|
2273
2309
|
te = p+1
|
2274
2310
|
begin
|
@@ -2276,16 +2312,16 @@ te = p+1
|
|
2276
2312
|
end
|
2277
2313
|
end
|
2278
2314
|
when 38 then
|
2279
|
-
# line
|
2315
|
+
# line 148 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2280
2316
|
begin
|
2281
2317
|
self.group_depth = group_depth - 1 end
|
2282
|
-
# line
|
2318
|
+
# line 532 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2283
2319
|
begin
|
2284
2320
|
te = p+1
|
2285
2321
|
begin
|
2286
2322
|
if conditional_stack.last == group_depth + 1
|
2287
2323
|
conditional_stack.pop
|
2288
|
-
emit(:conditional, :close,
|
2324
|
+
emit(:conditional, :close, ')')
|
2289
2325
|
else
|
2290
2326
|
if spacing_stack.length > 1 &&
|
2291
2327
|
spacing_stack.last[:depth] == group_depth + 1
|
@@ -2293,15 +2329,15 @@ te = p+1
|
|
2293
2329
|
self.free_spacing = spacing_stack.last[:free_spacing]
|
2294
2330
|
end
|
2295
2331
|
|
2296
|
-
emit(:group, :close,
|
2332
|
+
emit(:group, :close, ')')
|
2297
2333
|
end
|
2298
2334
|
end
|
2299
2335
|
end
|
2300
2336
|
when 40 then
|
2301
|
-
# line
|
2337
|
+
# line 149 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2302
2338
|
begin
|
2303
2339
|
self.set_depth = set_depth + 1 end
|
2304
|
-
# line
|
2340
|
+
# line 438 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2305
2341
|
begin
|
2306
2342
|
te = p+1
|
2307
2343
|
begin
|
@@ -2317,10 +2353,10 @@ te = p+1
|
|
2317
2353
|
end
|
2318
2354
|
end
|
2319
2355
|
when 70 then
|
2320
|
-
# line
|
2356
|
+
# line 150 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2321
2357
|
begin
|
2322
2358
|
self.set_depth = set_depth - 1 end
|
2323
|
-
# line
|
2359
|
+
# line 156 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2324
2360
|
begin
|
2325
2361
|
te = p+1
|
2326
2362
|
begin
|
@@ -2344,15 +2380,15 @@ te = p+1
|
|
2344
2380
|
end
|
2345
2381
|
end
|
2346
2382
|
when 75 then
|
2347
|
-
# line
|
2383
|
+
# line 150 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2348
2384
|
begin
|
2349
2385
|
self.set_depth = set_depth - 1 end
|
2350
|
-
# line
|
2386
|
+
# line 165 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2351
2387
|
begin
|
2352
2388
|
te = p+1
|
2353
2389
|
begin # special case, emits two tokens
|
2354
|
-
emit(:literal, :literal,
|
2355
|
-
emit(:set, :close,
|
2390
|
+
emit(:literal, :literal, '-')
|
2391
|
+
emit(:set, :close, ']')
|
2356
2392
|
if in_set?
|
2357
2393
|
begin
|
2358
2394
|
top -= 1
|
@@ -2372,10 +2408,10 @@ te = p+1
|
|
2372
2408
|
end
|
2373
2409
|
end
|
2374
2410
|
when 22 then
|
2375
|
-
# line
|
2411
|
+
# line 150 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2376
2412
|
begin
|
2377
2413
|
self.set_depth = set_depth - 1 end
|
2378
|
-
# line
|
2414
|
+
# line 213 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2379
2415
|
begin
|
2380
2416
|
te = p+1
|
2381
2417
|
begin
|
@@ -2400,56 +2436,56 @@ te = p+1
|
|
2400
2436
|
begin
|
2401
2437
|
te = p+1
|
2402
2438
|
end
|
2403
|
-
# line
|
2439
|
+
# line 149 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2404
2440
|
begin
|
2405
2441
|
self.set_depth = set_depth + 1 end
|
2406
|
-
when
|
2442
|
+
when 84 then
|
2407
2443
|
# line 1 "NONE"
|
2408
2444
|
begin
|
2409
2445
|
te = p+1
|
2410
2446
|
end
|
2411
|
-
# line
|
2447
|
+
# line 277 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2412
2448
|
begin
|
2413
|
-
act =
|
2414
|
-
when
|
2449
|
+
act = 17; end
|
2450
|
+
when 83 then
|
2415
2451
|
# line 1 "NONE"
|
2416
2452
|
begin
|
2417
2453
|
te = p+1
|
2418
2454
|
end
|
2419
|
-
# line
|
2455
|
+
# line 283 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2420
2456
|
begin
|
2421
|
-
act =
|
2457
|
+
act = 18; end
|
2422
2458
|
when 8 then
|
2423
2459
|
# line 1 "NONE"
|
2424
2460
|
begin
|
2425
2461
|
te = p+1
|
2426
2462
|
end
|
2427
|
-
# line
|
2463
|
+
# line 492 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2428
2464
|
begin
|
2429
|
-
act =
|
2465
|
+
act = 42; end
|
2430
2466
|
when 2 then
|
2431
2467
|
# line 1 "NONE"
|
2432
2468
|
begin
|
2433
2469
|
te = p+1
|
2434
2470
|
end
|
2435
|
-
# line
|
2471
|
+
# line 645 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2436
2472
|
begin
|
2437
|
-
act =
|
2473
|
+
act = 56; end
|
2438
2474
|
when 50 then
|
2439
2475
|
# line 1 "NONE"
|
2440
2476
|
begin
|
2441
2477
|
te = p+1
|
2442
2478
|
end
|
2443
|
-
# line
|
2479
|
+
# line 148 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2444
2480
|
begin
|
2445
2481
|
self.group_depth = group_depth - 1 end
|
2446
|
-
# line
|
2482
|
+
# line 147 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2447
2483
|
begin
|
2448
2484
|
self.group_depth = group_depth + 1 end
|
2449
|
-
# line
|
2485
|
+
# line 478 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2450
2486
|
begin
|
2451
|
-
act =
|
2452
|
-
# line
|
2487
|
+
act = 41; end
|
2488
|
+
# line 2488 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner.rb"
|
2453
2489
|
end
|
2454
2490
|
end
|
2455
2491
|
end
|
@@ -2467,7 +2503,7 @@ ts = nil; end
|
|
2467
2503
|
begin
|
2468
2504
|
act = 0
|
2469
2505
|
end
|
2470
|
-
# line
|
2506
|
+
# line 2506 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner.rb"
|
2471
2507
|
end
|
2472
2508
|
|
2473
2509
|
if cs == 0
|
@@ -2489,19 +2525,19 @@ act = 0
|
|
2489
2525
|
end
|
2490
2526
|
case _re_scanner_eof_actions[cs]
|
2491
2527
|
when 14 then
|
2492
|
-
# line 8 "/Users/
|
2528
|
+
# line 8 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/property.rl"
|
2493
2529
|
begin
|
2494
2530
|
|
2495
2531
|
raise PrematureEndError.new('unicode property')
|
2496
2532
|
end
|
2497
2533
|
when 25 then
|
2498
|
-
# line
|
2534
|
+
# line 135 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2499
2535
|
begin
|
2500
2536
|
|
2501
2537
|
text = copy(data, ts ? ts-1 : 0, -1)
|
2502
2538
|
raise PrematureEndError.new( text )
|
2503
2539
|
end
|
2504
|
-
# line
|
2540
|
+
# line 2540 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner.rb"
|
2505
2541
|
end
|
2506
2542
|
end
|
2507
2543
|
|
@@ -2512,7 +2548,7 @@ act = 0
|
|
2512
2548
|
end
|
2513
2549
|
end
|
2514
2550
|
|
2515
|
-
# line
|
2551
|
+
# line 751 "/Users/janosch/code/regexp_parser/tasks/../lib/regexp_parser/scanner/scanner.rl"
|
2516
2552
|
|
2517
2553
|
# to avoid "warning: assigned but unused variable - testEof"
|
2518
2554
|
testEof = testEof
|
@@ -2528,7 +2564,7 @@ end
|
|
2528
2564
|
"[#{set_depth}]") if in_set?
|
2529
2565
|
|
2530
2566
|
# when the entire expression is a literal run
|
2531
|
-
emit_literal if
|
2567
|
+
emit_literal if literal_run
|
2532
2568
|
|
2533
2569
|
tokens
|
2534
2570
|
end
|
@@ -2555,26 +2591,37 @@ end
|
|
2555
2591
|
def emit(type, token, text)
|
2556
2592
|
#puts "EMIT: type: #{type}, token: #{token}, text: #{text}, ts: #{ts}, te: #{te}"
|
2557
2593
|
|
2558
|
-
emit_literal if
|
2594
|
+
emit_literal if literal_run
|
2559
2595
|
|
2560
2596
|
# Ragel runs with byte-based indices (ts, te). These are of little value to
|
2561
2597
|
# end-users, so we keep track of char-based indices and emit those instead.
|
2562
2598
|
ts_char_pos = char_pos
|
2563
2599
|
te_char_pos = char_pos + text.length
|
2564
2600
|
|
2565
|
-
|
2566
|
-
block.call type, token, text, ts_char_pos, te_char_pos
|
2567
|
-
end
|
2601
|
+
tok = [type, token, text, ts_char_pos, te_char_pos]
|
2568
2602
|
|
2569
|
-
|
2603
|
+
self.prev_token = tok
|
2570
2604
|
|
2571
2605
|
self.char_pos = te_char_pos
|
2606
|
+
|
2607
|
+
if block
|
2608
|
+
block.call type, token, text, ts_char_pos, te_char_pos
|
2609
|
+
# TODO: in v3.0.0, remove `collect_tokens:` kwarg and only collect if no block given
|
2610
|
+
tokens << tok if collect_tokens
|
2611
|
+
elsif collect_tokens
|
2612
|
+
tokens << tok
|
2613
|
+
end
|
2572
2614
|
end
|
2573
2615
|
|
2616
|
+
attr_accessor :literal_run # only public for #||= to work on ruby <= 2.5
|
2617
|
+
|
2574
2618
|
private
|
2575
2619
|
|
2576
|
-
attr_accessor :
|
2577
|
-
:
|
2620
|
+
attr_accessor :block,
|
2621
|
+
:collect_tokens, :tokens, :prev_token,
|
2622
|
+
:free_spacing, :spacing_stack,
|
2623
|
+
:group_depth, :set_depth, :conditional_stack,
|
2624
|
+
:char_pos
|
2578
2625
|
|
2579
2626
|
def free_spacing?(input_object, options)
|
2580
2627
|
if options && !input_object.is_a?(String)
|
@@ -2604,14 +2651,13 @@ end
|
|
2604
2651
|
# Appends one or more characters to the literal buffer, to be emitted later
|
2605
2652
|
# by a call to emit_literal.
|
2606
2653
|
def append_literal(data, ts, te)
|
2607
|
-
self.
|
2608
|
-
literal << copy(data, ts, te)
|
2654
|
+
(self.literal_run ||= []) << copy(data, ts, te)
|
2609
2655
|
end
|
2610
2656
|
|
2611
2657
|
# Emits the literal run collected by calls to the append_literal method.
|
2612
2658
|
def emit_literal
|
2613
|
-
text =
|
2614
|
-
self.
|
2659
|
+
text = literal_run.join
|
2660
|
+
self.literal_run = nil
|
2615
2661
|
emit(:literal, :literal, text)
|
2616
2662
|
end
|
2617
2663
|
|