regexp_parser 0.4.13 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +15 -0
- data/lib/regexp_parser/expression.rb +43 -51
- data/lib/regexp_parser/expression/classes/alternation.rb +6 -7
- data/lib/regexp_parser/expression/classes/character_class.rb +11 -0
- data/lib/regexp_parser/expression/classes/conditional.rb +10 -18
- data/lib/regexp_parser/expression/classes/free_space.rb +1 -1
- data/lib/regexp_parser/expression/classes/group.rb +9 -21
- data/lib/regexp_parser/expression/classes/property.rb +2 -2
- data/lib/regexp_parser/expression/classes/set.rb +1 -12
- data/lib/regexp_parser/expression/methods/traverse.rb +1 -1
- data/lib/regexp_parser/expression/quantifier.rb +9 -9
- data/lib/regexp_parser/expression/sequence.rb +5 -4
- data/lib/regexp_parser/expression/subexpression.rb +16 -59
- data/lib/regexp_parser/lexer.rb +31 -27
- data/lib/regexp_parser/parser.rb +179 -179
- data/lib/regexp_parser/scanner.rb +172 -166
- data/lib/regexp_parser/scanner/scanner.rl +44 -38
- data/lib/regexp_parser/syntax.rb +2 -53
- data/lib/regexp_parser/syntax/base.rb +13 -24
- data/lib/regexp_parser/syntax/tokens/character_class.rb +16 -0
- data/lib/regexp_parser/syntax/tokens/unicode_property.rb +26 -26
- data/lib/regexp_parser/syntax/version_lookup.rb +82 -0
- data/lib/regexp_parser/syntax/versions.rb +1 -5
- data/lib/regexp_parser/syntax/versions/1.8.6.rb +30 -0
- data/lib/regexp_parser/syntax/versions/1.9.1.rb +36 -0
- data/lib/regexp_parser/syntax/versions/1.9.3.rb +11 -0
- data/lib/regexp_parser/syntax/versions/2.0.0.rb +20 -0
- data/lib/regexp_parser/syntax/versions/2.2.0.rb +10 -0
- data/lib/regexp_parser/syntax/versions/2.3.0.rb +10 -0
- data/lib/regexp_parser/syntax/versions/2.4.0.rb +10 -0
- data/lib/regexp_parser/syntax/versions/2.4.1.rb +9 -0
- data/lib/regexp_parser/syntax/versions/2.5.0.rb +10 -0
- data/lib/regexp_parser/token.rb +6 -29
- data/lib/regexp_parser/version.rb +1 -1
- data/test/expression/test_strfregexp.rb +7 -0
- data/test/expression/test_to_h.rb +6 -0
- data/test/parser/test_properties.rb +12 -4
- data/test/support/warning_extractor.rb +3 -1
- data/test/syntax/test_all.rb +1 -1
- data/test/syntax/test_syntax.rb +5 -9
- data/test/syntax/{ruby → versions}/test_1.8.rb +14 -14
- data/test/syntax/{ruby → versions}/test_1.9.1.rb +7 -8
- data/test/syntax/{ruby → versions}/test_1.9.3.rb +7 -7
- data/test/syntax/versions/test_2.0.0.rb +37 -0
- data/test/syntax/{ruby → versions}/test_2.2.0.rb +7 -7
- data/test/syntax/versions/test_aliases.rb +129 -0
- data/test/syntax/{ruby → versions}/test_all.rb +1 -1
- metadata +73 -113
- data/lib/regexp_parser/syntax/ruby/1.8.6.rb +0 -37
- data/lib/regexp_parser/syntax/ruby/1.8.7.rb +0 -14
- data/lib/regexp_parser/syntax/ruby/1.8.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/1.9.1.rb +0 -45
- data/lib/regexp_parser/syntax/ruby/1.9.2.rb +0 -9
- data/lib/regexp_parser/syntax/ruby/1.9.3.rb +0 -19
- data/lib/regexp_parser/syntax/ruby/1.9.rb +0 -8
- data/lib/regexp_parser/syntax/ruby/2.0.0.rb +0 -23
- data/lib/regexp_parser/syntax/ruby/2.0.rb +0 -8
- data/lib/regexp_parser/syntax/ruby/2.1.0.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.1.10.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.1.2.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.1.3.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.1.4.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.1.5.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.1.6.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.1.7.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.1.8.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.1.9.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.1.rb +0 -8
- data/lib/regexp_parser/syntax/ruby/2.2.0.rb +0 -16
- data/lib/regexp_parser/syntax/ruby/2.2.1.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.2.10.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.2.2.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.2.3.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.2.4.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.2.5.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.2.6.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.2.7.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.2.8.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.2.9.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.2.rb +0 -8
- data/lib/regexp_parser/syntax/ruby/2.3.0.rb +0 -16
- data/lib/regexp_parser/syntax/ruby/2.3.1.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.3.2.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.3.3.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.3.4.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.3.5.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.3.6.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.3.7.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.3.rb +0 -8
- data/lib/regexp_parser/syntax/ruby/2.4.0.rb +0 -16
- data/lib/regexp_parser/syntax/ruby/2.4.1.rb +0 -15
- data/lib/regexp_parser/syntax/ruby/2.4.2.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.4.3.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.4.4.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.4.rb +0 -8
- data/lib/regexp_parser/syntax/ruby/2.5.0.rb +0 -16
- data/lib/regexp_parser/syntax/ruby/2.5.1.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.5.rb +0 -8
- data/lib/regexp_parser/syntax/ruby/2.6.0.rb +0 -13
- data/lib/regexp_parser/syntax/ruby/2.6.rb +0 -8
- data/test/syntax/ruby/test_2.0.0.rb +0 -32
- data/test/syntax/ruby/test_files.rb +0 -353
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- warn-indent:false; -*-
|
2
2
|
|
3
|
-
# line 1 "/Users/
|
3
|
+
# line 1 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4
4
|
|
5
|
-
# line 771 "/Users/
|
5
|
+
# line 771 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
6
6
|
|
7
7
|
|
8
8
|
# THIS IS A GENERATED FILE, DO NOT EDIT DIRECTLY
|
@@ -72,31 +72,33 @@ class Regexp::Scanner
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def scan(input_object, &block)
|
75
|
-
|
75
|
+
self.literal = nil
|
76
|
+
stack = []
|
76
77
|
|
77
78
|
if input_object.is_a?(Regexp)
|
78
|
-
input
|
79
|
-
|
79
|
+
input = input_object.source
|
80
|
+
self.free_spacing = (input_object.options & Regexp::EXTENDED != 0)
|
80
81
|
else
|
81
|
-
input
|
82
|
-
|
82
|
+
input = input_object
|
83
|
+
self.free_spacing = false
|
83
84
|
end
|
84
85
|
|
85
86
|
|
86
87
|
data = input.unpack("c*") if input.is_a?(String)
|
87
88
|
eof = data.length
|
88
89
|
|
89
|
-
|
90
|
-
|
90
|
+
self.tokens = []
|
91
|
+
self.block = block_given? ? block : nil
|
91
92
|
|
92
|
-
|
93
|
-
|
93
|
+
self.in_group = false
|
94
|
+
self.group_depth = 0
|
95
|
+
self.spacing_stack = [{:free_spacing => free_spacing, :depth => 0}]
|
94
96
|
|
95
|
-
in_set,
|
97
|
+
in_set, set_depth, set_type = false, 0, :set
|
96
98
|
in_conditional, conditional_depth, conditional_stack = false, 0, []
|
97
99
|
|
98
100
|
|
99
|
-
# line
|
101
|
+
# line 101 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb"
|
100
102
|
class << self
|
101
103
|
attr_accessor :_re_scanner_trans_keys
|
102
104
|
private :_re_scanner_trans_keys, :_re_scanner_trans_keys=
|
@@ -1672,9 +1674,9 @@ end
|
|
1672
1674
|
self.re_scanner_en_main = 142;
|
1673
1675
|
|
1674
1676
|
|
1675
|
-
# line
|
1677
|
+
# line 866 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
1676
1678
|
|
1677
|
-
# line
|
1679
|
+
# line 1679 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb"
|
1678
1680
|
begin
|
1679
1681
|
p ||= 0
|
1680
1682
|
pe ||= data.length
|
@@ -1685,9 +1687,9 @@ begin
|
|
1685
1687
|
act = 0
|
1686
1688
|
end
|
1687
1689
|
|
1688
|
-
# line
|
1690
|
+
# line 867 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
1689
1691
|
|
1690
|
-
# line
|
1692
|
+
# line 1692 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb"
|
1691
1693
|
begin
|
1692
1694
|
testEof = false
|
1693
1695
|
_slen, _trans, _keys, _inds, _acts, _nacts = nil
|
@@ -1715,7 +1717,7 @@ begin
|
|
1715
1717
|
begin
|
1716
1718
|
ts = p
|
1717
1719
|
end
|
1718
|
-
# line
|
1720
|
+
# line 1720 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb"
|
1719
1721
|
end
|
1720
1722
|
_keys = cs << 1
|
1721
1723
|
_inds = _re_scanner_index_offsets[cs]
|
@@ -1735,23 +1737,23 @@ ts = p
|
|
1735
1737
|
if _re_scanner_trans_actions[_trans] != 0
|
1736
1738
|
case _re_scanner_trans_actions[_trans]
|
1737
1739
|
when 14 then
|
1738
|
-
# line 134 "/Users/
|
1740
|
+
# line 134 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
1739
1741
|
begin
|
1740
1742
|
|
1741
1743
|
text = ts ? copy(data, ts-1..-1) : data.pack('c*')
|
1742
1744
|
raise PrematureEndError.new( text )
|
1743
1745
|
end
|
1744
1746
|
when 7 then
|
1745
|
-
# line 147 "/Users/
|
1747
|
+
# line 147 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
1746
1748
|
begin
|
1747
|
-
|
1749
|
+
self.group_depth = group_depth - 1; in_group = group_depth > 0 ? true : false end
|
1748
1750
|
when 18 then
|
1749
1751
|
# line 1 "NONE"
|
1750
1752
|
begin
|
1751
1753
|
te = p+1
|
1752
1754
|
end
|
1753
1755
|
when 16 then
|
1754
|
-
# line 62 "/Users/
|
1756
|
+
# line 62 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/property.rl"
|
1755
1757
|
begin
|
1756
1758
|
te = p+1
|
1757
1759
|
begin
|
@@ -2528,7 +2530,7 @@ te = p+1
|
|
2528
2530
|
end
|
2529
2531
|
end
|
2530
2532
|
when 69 then
|
2531
|
-
# line 153 "/Users/
|
2533
|
+
# line 153 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2532
2534
|
begin
|
2533
2535
|
te = p+1
|
2534
2536
|
begin
|
@@ -2556,7 +2558,7 @@ te = p+1
|
|
2556
2558
|
end
|
2557
2559
|
end
|
2558
2560
|
when 73 then
|
2559
|
-
# line 166 "/Users/
|
2561
|
+
# line 166 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2560
2562
|
begin
|
2561
2563
|
te = p+1
|
2562
2564
|
begin # special case, emits two tokens
|
@@ -2585,12 +2587,12 @@ te = p+1
|
|
2585
2587
|
end
|
2586
2588
|
end
|
2587
2589
|
when 70 then
|
2588
|
-
# line 180 "/Users/
|
2590
|
+
# line 180 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2589
2591
|
begin
|
2590
2592
|
te = p+1
|
2591
2593
|
begin
|
2592
2594
|
text = text(data, ts, te).first
|
2593
|
-
if
|
2595
|
+
if tokens.last[1] == :open
|
2594
2596
|
emit(set_type, :negate, text, ts, te)
|
2595
2597
|
else
|
2596
2598
|
emit(set_type, :member, text, ts, te)
|
@@ -2598,7 +2600,7 @@ te = p+1
|
|
2598
2600
|
end
|
2599
2601
|
end
|
2600
2602
|
when 19 then
|
2601
|
-
# line 189 "/Users/
|
2603
|
+
# line 189 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2602
2604
|
begin
|
2603
2605
|
te = p+1
|
2604
2606
|
begin
|
@@ -2606,7 +2608,7 @@ te = p+1
|
|
2606
2608
|
end
|
2607
2609
|
end
|
2608
2610
|
when 72 then
|
2609
|
-
# line 193 "/Users/
|
2611
|
+
# line 193 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2610
2612
|
begin
|
2611
2613
|
te = p+1
|
2612
2614
|
begin
|
@@ -2614,7 +2616,7 @@ te = p+1
|
|
2614
2616
|
end
|
2615
2617
|
end
|
2616
2618
|
when 68 then
|
2617
|
-
# line 197 "/Users/
|
2619
|
+
# line 197 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2618
2620
|
begin
|
2619
2621
|
te = p+1
|
2620
2622
|
begin
|
@@ -2629,7 +2631,7 @@ te = p+1
|
|
2629
2631
|
end
|
2630
2632
|
end
|
2631
2633
|
when 23 then
|
2632
|
-
# line 209 "/Users/
|
2634
|
+
# line 209 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2633
2635
|
begin
|
2634
2636
|
te = p+1
|
2635
2637
|
begin
|
@@ -2645,7 +2647,7 @@ te = p+1
|
|
2645
2647
|
end
|
2646
2648
|
end
|
2647
2649
|
when 22 then
|
2648
|
-
# line 221 "/Users/
|
2650
|
+
# line 221 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2649
2651
|
begin
|
2650
2652
|
te = p+1
|
2651
2653
|
begin
|
@@ -2653,7 +2655,7 @@ te = p+1
|
|
2653
2655
|
end
|
2654
2656
|
end
|
2655
2657
|
when 24 then
|
2656
|
-
# line 225 "/Users/
|
2658
|
+
# line 225 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2657
2659
|
begin
|
2658
2660
|
te = p+1
|
2659
2661
|
begin
|
@@ -2661,7 +2663,7 @@ te = p+1
|
|
2661
2663
|
end
|
2662
2664
|
end
|
2663
2665
|
when 67 then
|
2664
|
-
# line 231 "/Users/
|
2666
|
+
# line 231 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2665
2667
|
begin
|
2666
2668
|
te = p+1
|
2667
2669
|
begin
|
@@ -2669,7 +2671,7 @@ te = p+1
|
|
2669
2671
|
end
|
2670
2672
|
end
|
2671
2673
|
when 66 then
|
2672
|
-
# line 239 "/Users/
|
2674
|
+
# line 239 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2673
2675
|
begin
|
2674
2676
|
te = p+1
|
2675
2677
|
begin
|
@@ -2677,7 +2679,7 @@ te = p+1
|
|
2677
2679
|
end
|
2678
2680
|
end
|
2679
2681
|
when 75 then
|
2680
|
-
# line 201 "/Users/
|
2682
|
+
# line 201 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2681
2683
|
begin
|
2682
2684
|
te = p
|
2683
2685
|
p = p - 1; begin
|
@@ -2696,7 +2698,7 @@ p = p - 1; begin
|
|
2696
2698
|
end
|
2697
2699
|
end
|
2698
2700
|
when 71 then
|
2699
|
-
# line 239 "/Users/
|
2701
|
+
# line 239 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2700
2702
|
begin
|
2701
2703
|
te = p
|
2702
2704
|
p = p - 1; begin
|
@@ -2704,7 +2706,7 @@ p = p - 1; begin
|
|
2704
2706
|
end
|
2705
2707
|
end
|
2706
2708
|
when 21 then
|
2707
|
-
# line 201 "/Users/
|
2709
|
+
# line 201 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2708
2710
|
begin
|
2709
2711
|
begin p = ((te))-1; end
|
2710
2712
|
begin
|
@@ -2723,7 +2725,7 @@ p = p - 1; begin
|
|
2723
2725
|
end
|
2724
2726
|
end
|
2725
2727
|
when 17 then
|
2726
|
-
# line 239 "/Users/
|
2728
|
+
# line 239 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2727
2729
|
begin
|
2728
2730
|
begin p = ((te))-1; end
|
2729
2731
|
begin
|
@@ -2731,7 +2733,7 @@ p = p - 1; begin
|
|
2731
2733
|
end
|
2732
2734
|
end
|
2733
2735
|
when 80 then
|
2734
|
-
# line 247 "/Users/
|
2736
|
+
# line 247 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2735
2737
|
begin
|
2736
2738
|
te = p+1
|
2737
2739
|
begin
|
@@ -2746,7 +2748,7 @@ te = p+1
|
|
2746
2748
|
end
|
2747
2749
|
end
|
2748
2750
|
when 78 then
|
2749
|
-
# line 252 "/Users/
|
2751
|
+
# line 252 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2750
2752
|
begin
|
2751
2753
|
te = p+1
|
2752
2754
|
begin
|
@@ -2772,7 +2774,7 @@ te = p+1
|
|
2772
2774
|
end
|
2773
2775
|
end
|
2774
2776
|
when 84 then
|
2775
|
-
# line 268 "/Users/
|
2777
|
+
# line 268 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2776
2778
|
begin
|
2777
2779
|
te = p+1
|
2778
2780
|
begin
|
@@ -2787,7 +2789,7 @@ te = p+1
|
|
2787
2789
|
end
|
2788
2790
|
end
|
2789
2791
|
when 76 then
|
2790
|
-
# line 278 "/Users/
|
2792
|
+
# line 278 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2791
2793
|
begin
|
2792
2794
|
te = p+1
|
2793
2795
|
begin
|
@@ -2802,7 +2804,7 @@ te = p+1
|
|
2802
2804
|
end
|
2803
2805
|
end
|
2804
2806
|
when 79 then
|
2805
|
-
# line 283 "/Users/
|
2807
|
+
# line 283 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2806
2808
|
begin
|
2807
2809
|
te = p+1
|
2808
2810
|
begin
|
@@ -2819,7 +2821,7 @@ te = p+1
|
|
2819
2821
|
end
|
2820
2822
|
end
|
2821
2823
|
when 83 then
|
2822
|
-
# line 268 "/Users/
|
2824
|
+
# line 268 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2823
2825
|
begin
|
2824
2826
|
te = p
|
2825
2827
|
p = p - 1; begin
|
@@ -2834,7 +2836,7 @@ p = p - 1; begin
|
|
2834
2836
|
end
|
2835
2837
|
end
|
2836
2838
|
when 82 then
|
2837
|
-
# line 273 "/Users/
|
2839
|
+
# line 273 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2838
2840
|
begin
|
2839
2841
|
te = p
|
2840
2842
|
p = p - 1; begin
|
@@ -2849,7 +2851,7 @@ p = p - 1; begin
|
|
2849
2851
|
end
|
2850
2852
|
end
|
2851
2853
|
when 81 then
|
2852
|
-
# line 294 "/Users/
|
2854
|
+
# line 294 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2853
2855
|
begin
|
2854
2856
|
te = p
|
2855
2857
|
p = p - 1; begin
|
@@ -2864,7 +2866,7 @@ p = p - 1; begin
|
|
2864
2866
|
end
|
2865
2867
|
end
|
2866
2868
|
when 27 then
|
2867
|
-
# line 273 "/Users/
|
2869
|
+
# line 273 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2868
2870
|
begin
|
2869
2871
|
begin p = ((te))-1; end
|
2870
2872
|
begin
|
@@ -2916,7 +2918,7 @@ end
|
|
2916
2918
|
end
|
2917
2919
|
end
|
2918
2920
|
when 89 then
|
2919
|
-
# line 304 "/Users/
|
2921
|
+
# line 304 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2920
2922
|
begin
|
2921
2923
|
te = p+1
|
2922
2924
|
begin
|
@@ -2932,7 +2934,7 @@ te = p+1
|
|
2932
2934
|
end
|
2933
2935
|
end
|
2934
2936
|
when 94 then
|
2935
|
-
# line 310 "/Users/
|
2937
|
+
# line 310 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2936
2938
|
begin
|
2937
2939
|
te = p+1
|
2938
2940
|
begin
|
@@ -2947,7 +2949,7 @@ te = p+1
|
|
2947
2949
|
end
|
2948
2950
|
end
|
2949
2951
|
when 86 then
|
2950
|
-
# line 315 "/Users/
|
2952
|
+
# line 315 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2951
2953
|
begin
|
2952
2954
|
te = p+1
|
2953
2955
|
begin
|
@@ -2978,7 +2980,7 @@ te = p+1
|
|
2978
2980
|
end
|
2979
2981
|
end
|
2980
2982
|
when 91 then
|
2981
|
-
# line 336 "/Users/
|
2983
|
+
# line 336 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
2982
2984
|
begin
|
2983
2985
|
te = p+1
|
2984
2986
|
begin
|
@@ -3004,7 +3006,7 @@ te = p+1
|
|
3004
3006
|
end
|
3005
3007
|
end
|
3006
3008
|
when 34 then
|
3007
|
-
# line 352 "/Users/
|
3009
|
+
# line 352 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3008
3010
|
begin
|
3009
3011
|
te = p+1
|
3010
3012
|
begin
|
@@ -3024,7 +3026,7 @@ te = p+1
|
|
3024
3026
|
end
|
3025
3027
|
end
|
3026
3028
|
when 101 then
|
3027
|
-
# line 362 "/Users/
|
3029
|
+
# line 362 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3028
3030
|
begin
|
3029
3031
|
te = p+1
|
3030
3032
|
begin
|
@@ -3039,7 +3041,7 @@ te = p+1
|
|
3039
3041
|
end
|
3040
3042
|
end
|
3041
3043
|
when 104 then
|
3042
|
-
# line 367 "/Users/
|
3044
|
+
# line 367 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3043
3045
|
begin
|
3044
3046
|
te = p+1
|
3045
3047
|
begin
|
@@ -3054,7 +3056,7 @@ te = p+1
|
|
3054
3056
|
end
|
3055
3057
|
end
|
3056
3058
|
when 36 then
|
3057
|
-
# line 376 "/Users/
|
3059
|
+
# line 376 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3058
3060
|
begin
|
3059
3061
|
te = p+1
|
3060
3062
|
begin
|
@@ -3069,7 +3071,7 @@ te = p+1
|
|
3069
3071
|
end
|
3070
3072
|
end
|
3071
3073
|
when 30 then
|
3072
|
-
# line 381 "/Users/
|
3074
|
+
# line 381 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3073
3075
|
begin
|
3074
3076
|
te = p+1
|
3075
3077
|
begin
|
@@ -3094,7 +3096,7 @@ te = p+1
|
|
3094
3096
|
end
|
3095
3097
|
end
|
3096
3098
|
when 33 then
|
3097
|
-
# line 396 "/Users/
|
3099
|
+
# line 396 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3098
3100
|
begin
|
3099
3101
|
te = p+1
|
3100
3102
|
begin
|
@@ -3119,7 +3121,7 @@ te = p+1
|
|
3119
3121
|
end
|
3120
3122
|
end
|
3121
3123
|
when 90 then
|
3122
|
-
# line 411 "/Users/
|
3124
|
+
# line 411 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3123
3125
|
begin
|
3124
3126
|
te = p+1
|
3125
3127
|
begin
|
@@ -3136,7 +3138,7 @@ te = p+1
|
|
3136
3138
|
end
|
3137
3139
|
end
|
3138
3140
|
when 85 then
|
3139
|
-
# line 417 "/Users/
|
3141
|
+
# line 417 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3140
3142
|
begin
|
3141
3143
|
te = p+1
|
3142
3144
|
begin
|
@@ -3151,7 +3153,7 @@ te = p+1
|
|
3151
3153
|
end
|
3152
3154
|
end
|
3153
3155
|
when 93 then
|
3154
|
-
# line 310 "/Users/
|
3156
|
+
# line 310 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3155
3157
|
begin
|
3156
3158
|
te = p
|
3157
3159
|
p = p - 1; begin
|
@@ -3166,7 +3168,7 @@ p = p - 1; begin
|
|
3166
3168
|
end
|
3167
3169
|
end
|
3168
3170
|
when 100 then
|
3169
|
-
# line 362 "/Users/
|
3171
|
+
# line 362 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3170
3172
|
begin
|
3171
3173
|
te = p
|
3172
3174
|
p = p - 1; begin
|
@@ -3181,7 +3183,7 @@ p = p - 1; begin
|
|
3181
3183
|
end
|
3182
3184
|
end
|
3183
3185
|
when 102 then
|
3184
|
-
# line 376 "/Users/
|
3186
|
+
# line 376 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3185
3187
|
begin
|
3186
3188
|
te = p
|
3187
3189
|
p = p - 1; begin
|
@@ -3196,7 +3198,7 @@ p = p - 1; begin
|
|
3196
3198
|
end
|
3197
3199
|
end
|
3198
3200
|
when 96 then
|
3199
|
-
# line 381 "/Users/
|
3201
|
+
# line 381 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3200
3202
|
begin
|
3201
3203
|
te = p
|
3202
3204
|
p = p - 1; begin
|
@@ -3221,7 +3223,7 @@ p = p - 1; begin
|
|
3221
3223
|
end
|
3222
3224
|
end
|
3223
3225
|
when 98 then
|
3224
|
-
# line 396 "/Users/
|
3226
|
+
# line 396 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3225
3227
|
begin
|
3226
3228
|
te = p
|
3227
3229
|
p = p - 1; begin
|
@@ -3246,7 +3248,7 @@ p = p - 1; begin
|
|
3246
3248
|
end
|
3247
3249
|
end
|
3248
3250
|
when 37 then
|
3249
|
-
# line 376 "/Users/
|
3251
|
+
# line 376 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3250
3252
|
begin
|
3251
3253
|
begin p = ((te))-1; end
|
3252
3254
|
begin
|
@@ -3261,7 +3263,7 @@ p = p - 1; begin
|
|
3261
3263
|
end
|
3262
3264
|
end
|
3263
3265
|
when 29 then
|
3264
|
-
# line 381 "/Users/
|
3266
|
+
# line 381 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3265
3267
|
begin
|
3266
3268
|
begin p = ((te))-1; end
|
3267
3269
|
begin
|
@@ -3286,7 +3288,7 @@ p = p - 1; begin
|
|
3286
3288
|
end
|
3287
3289
|
end
|
3288
3290
|
when 32 then
|
3289
|
-
# line 396 "/Users/
|
3291
|
+
# line 396 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3290
3292
|
begin
|
3291
3293
|
begin p = ((te))-1; end
|
3292
3294
|
begin
|
@@ -3342,7 +3344,7 @@ p = p - 1; begin
|
|
3342
3344
|
end
|
3343
3345
|
end
|
3344
3346
|
when 39 then
|
3345
|
-
# line 427 "/Users/
|
3347
|
+
# line 427 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3346
3348
|
begin
|
3347
3349
|
te = p+1
|
3348
3350
|
begin
|
@@ -3352,7 +3354,7 @@ te = p+1
|
|
3352
3354
|
end
|
3353
3355
|
end
|
3354
3356
|
when 105 then
|
3355
|
-
# line 433 "/Users/
|
3357
|
+
# line 433 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3356
3358
|
begin
|
3357
3359
|
te = p+1
|
3358
3360
|
begin
|
@@ -3368,7 +3370,7 @@ te = p+1
|
|
3368
3370
|
end
|
3369
3371
|
end
|
3370
3372
|
when 106 then
|
3371
|
-
# line 433 "/Users/
|
3373
|
+
# line 433 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3372
3374
|
begin
|
3373
3375
|
te = p
|
3374
3376
|
p = p - 1; begin
|
@@ -3384,7 +3386,7 @@ p = p - 1; begin
|
|
3384
3386
|
end
|
3385
3387
|
end
|
3386
3388
|
when 38 then
|
3387
|
-
# line 433 "/Users/
|
3389
|
+
# line 433 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3388
3390
|
begin
|
3389
3391
|
begin p = ((te))-1; end
|
3390
3392
|
begin
|
@@ -3400,7 +3402,7 @@ p = p - 1; begin
|
|
3400
3402
|
end
|
3401
3403
|
end
|
3402
3404
|
when 45 then
|
3403
|
-
# line 446 "/Users/
|
3405
|
+
# line 446 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3404
3406
|
begin
|
3405
3407
|
te = p+1
|
3406
3408
|
begin
|
@@ -3408,12 +3410,12 @@ te = p+1
|
|
3408
3410
|
end
|
3409
3411
|
end
|
3410
3412
|
when 48 then
|
3411
|
-
# line 450 "/Users/
|
3413
|
+
# line 450 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3412
3414
|
begin
|
3413
3415
|
te = p+1
|
3414
3416
|
begin
|
3415
3417
|
if in_conditional and conditional_stack.length > 0 and
|
3416
|
-
conditional_stack.last[1] ==
|
3418
|
+
conditional_stack.last[1] == group_depth
|
3417
3419
|
emit(:conditional, :separator, *text(data, ts, te))
|
3418
3420
|
else
|
3419
3421
|
emit(:meta, :alternation, *text(data, ts, te))
|
@@ -3421,7 +3423,7 @@ te = p+1
|
|
3421
3423
|
end
|
3422
3424
|
end
|
3423
3425
|
when 47 then
|
3424
|
-
# line 461 "/Users/
|
3426
|
+
# line 461 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3425
3427
|
begin
|
3426
3428
|
te = p+1
|
3427
3429
|
begin
|
@@ -3429,7 +3431,7 @@ te = p+1
|
|
3429
3431
|
end
|
3430
3432
|
end
|
3431
3433
|
when 42 then
|
3432
|
-
# line 465 "/Users/
|
3434
|
+
# line 465 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3433
3435
|
begin
|
3434
3436
|
te = p+1
|
3435
3437
|
begin
|
@@ -3437,7 +3439,7 @@ te = p+1
|
|
3437
3439
|
end
|
3438
3440
|
end
|
3439
3441
|
when 62 then
|
3440
|
-
# line 469 "/Users/
|
3442
|
+
# line 469 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3441
3443
|
begin
|
3442
3444
|
te = p+1
|
3443
3445
|
begin
|
@@ -3445,7 +3447,7 @@ te = p+1
|
|
3445
3447
|
end
|
3446
3448
|
end
|
3447
3449
|
when 60 then
|
3448
|
-
# line 473 "/Users/
|
3450
|
+
# line 473 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3449
3451
|
begin
|
3450
3452
|
te = p+1
|
3451
3453
|
begin
|
@@ -3463,7 +3465,7 @@ te = p+1
|
|
3463
3465
|
end
|
3464
3466
|
end
|
3465
3467
|
when 61 then
|
3466
|
-
# line 493 "/Users/
|
3468
|
+
# line 493 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3467
3469
|
begin
|
3468
3470
|
te = p+1
|
3469
3471
|
begin
|
@@ -3485,7 +3487,7 @@ te = p+1
|
|
3485
3487
|
end
|
3486
3488
|
end
|
3487
3489
|
when 46 then
|
3488
|
-
# line 514 "/Users/
|
3490
|
+
# line 514 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3489
3491
|
begin
|
3490
3492
|
te = p+1
|
3491
3493
|
begin
|
@@ -3504,7 +3506,7 @@ te = p+1
|
|
3504
3506
|
end
|
3505
3507
|
end
|
3506
3508
|
when 8 then
|
3507
|
-
# line 526 "/Users/
|
3509
|
+
# line 526 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3508
3510
|
begin
|
3509
3511
|
te = p+1
|
3510
3512
|
begin
|
@@ -3512,7 +3514,7 @@ te = p+1
|
|
3512
3514
|
|
3513
3515
|
in_conditional = true unless in_conditional
|
3514
3516
|
conditional_depth += 1
|
3515
|
-
conditional_stack << [conditional_depth,
|
3517
|
+
conditional_stack << [conditional_depth, group_depth]
|
3516
3518
|
|
3517
3519
|
emit(:conditional, :open, text[0..-2], ts, te-1)
|
3518
3520
|
emit(:conditional, :condition_open, '(', te-1, te)
|
@@ -3527,7 +3529,7 @@ te = p+1
|
|
3527
3529
|
end
|
3528
3530
|
end
|
3529
3531
|
when 9 then
|
3530
|
-
# line 559 "/Users/
|
3532
|
+
# line 559 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3531
3533
|
begin
|
3532
3534
|
te = p+1
|
3533
3535
|
begin
|
@@ -3535,7 +3537,7 @@ te = p+1
|
|
3535
3537
|
end
|
3536
3538
|
end
|
3537
3539
|
when 6 then
|
3538
|
-
# line 569 "/Users/
|
3540
|
+
# line 569 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3539
3541
|
begin
|
3540
3542
|
te = p+1
|
3541
3543
|
begin
|
@@ -3548,7 +3550,7 @@ te = p+1
|
|
3548
3550
|
end
|
3549
3551
|
end
|
3550
3552
|
when 10 then
|
3551
|
-
# line 586 "/Users/
|
3553
|
+
# line 586 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3552
3554
|
begin
|
3553
3555
|
te = p+1
|
3554
3556
|
begin
|
@@ -3574,7 +3576,7 @@ te = p+1
|
|
3574
3576
|
end
|
3575
3577
|
end
|
3576
3578
|
when 13 then
|
3577
|
-
# line 638 "/Users/
|
3579
|
+
# line 638 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3578
3580
|
begin
|
3579
3581
|
te = p+1
|
3580
3582
|
begin
|
@@ -3646,7 +3648,7 @@ te = p+1
|
|
3646
3648
|
end
|
3647
3649
|
end
|
3648
3650
|
when 58 then
|
3649
|
-
# line 709 "/Users/
|
3651
|
+
# line 709 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3650
3652
|
begin
|
3651
3653
|
te = p+1
|
3652
3654
|
begin
|
@@ -3658,7 +3660,7 @@ te = p+1
|
|
3658
3660
|
end
|
3659
3661
|
end
|
3660
3662
|
when 54 then
|
3661
|
-
# line 717 "/Users/
|
3663
|
+
# line 717 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3662
3664
|
begin
|
3663
3665
|
te = p+1
|
3664
3666
|
begin
|
@@ -3670,7 +3672,7 @@ te = p+1
|
|
3670
3672
|
end
|
3671
3673
|
end
|
3672
3674
|
when 56 then
|
3673
|
-
# line 725 "/Users/
|
3675
|
+
# line 725 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3674
3676
|
begin
|
3675
3677
|
te = p+1
|
3676
3678
|
begin
|
@@ -3682,7 +3684,7 @@ te = p+1
|
|
3682
3684
|
end
|
3683
3685
|
end
|
3684
3686
|
when 64 then
|
3685
|
-
# line 733 "/Users/
|
3687
|
+
# line 733 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3686
3688
|
begin
|
3687
3689
|
te = p+1
|
3688
3690
|
begin
|
@@ -3690,11 +3692,11 @@ te = p+1
|
|
3690
3692
|
end
|
3691
3693
|
end
|
3692
3694
|
when 4 then
|
3693
|
-
# line 743 "/Users/
|
3695
|
+
# line 743 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3694
3696
|
begin
|
3695
3697
|
te = p+1
|
3696
3698
|
begin
|
3697
|
-
if
|
3699
|
+
if free_spacing
|
3698
3700
|
emit(:free_space, :comment, *text(data, ts, te))
|
3699
3701
|
else
|
3700
3702
|
append_literal(data, ts, te)
|
@@ -3702,7 +3704,7 @@ te = p+1
|
|
3702
3704
|
end
|
3703
3705
|
end
|
3704
3706
|
when 51 then
|
3705
|
-
# line 608 "/Users/
|
3707
|
+
# line 608 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3706
3708
|
begin
|
3707
3709
|
te = p
|
3708
3710
|
p = p - 1; begin
|
@@ -3711,7 +3713,7 @@ p = p - 1; begin
|
|
3711
3713
|
end
|
3712
3714
|
end
|
3713
3715
|
when 57 then
|
3714
|
-
# line 709 "/Users/
|
3716
|
+
# line 709 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3715
3717
|
begin
|
3716
3718
|
te = p
|
3717
3719
|
p = p - 1; begin
|
@@ -3723,7 +3725,7 @@ p = p - 1; begin
|
|
3723
3725
|
end
|
3724
3726
|
end
|
3725
3727
|
when 53 then
|
3726
|
-
# line 717 "/Users/
|
3728
|
+
# line 717 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3727
3729
|
begin
|
3728
3730
|
te = p
|
3729
3731
|
p = p - 1; begin
|
@@ -3735,7 +3737,7 @@ p = p - 1; begin
|
|
3735
3737
|
end
|
3736
3738
|
end
|
3737
3739
|
when 55 then
|
3738
|
-
# line 725 "/Users/
|
3740
|
+
# line 725 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3739
3741
|
begin
|
3740
3742
|
te = p
|
3741
3743
|
p = p - 1; begin
|
@@ -3747,7 +3749,7 @@ p = p - 1; begin
|
|
3747
3749
|
end
|
3748
3750
|
end
|
3749
3751
|
when 63 then
|
3750
|
-
# line 733 "/Users/
|
3752
|
+
# line 733 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3751
3753
|
begin
|
3752
3754
|
te = p
|
3753
3755
|
p = p - 1; begin
|
@@ -3755,7 +3757,7 @@ p = p - 1; begin
|
|
3755
3757
|
end
|
3756
3758
|
end
|
3757
3759
|
when 59 then
|
3758
|
-
# line 739 "/Users/
|
3760
|
+
# line 739 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3759
3761
|
begin
|
3760
3762
|
te = p
|
3761
3763
|
p = p - 1; begin
|
@@ -3770,11 +3772,11 @@ p = p - 1; begin
|
|
3770
3772
|
end
|
3771
3773
|
end
|
3772
3774
|
when 50 then
|
3773
|
-
# line 751 "/Users/
|
3775
|
+
# line 751 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3774
3776
|
begin
|
3775
3777
|
te = p
|
3776
3778
|
p = p - 1; begin
|
3777
|
-
if
|
3779
|
+
if free_spacing
|
3778
3780
|
emit(:free_space, :whitespace, *text(data, ts, te))
|
3779
3781
|
else
|
3780
3782
|
append_literal(data, ts, te)
|
@@ -3782,7 +3784,7 @@ p = p - 1; begin
|
|
3782
3784
|
end
|
3783
3785
|
end
|
3784
3786
|
when 49 then
|
3785
|
-
# line 766 "/Users/
|
3787
|
+
# line 766 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3786
3788
|
begin
|
3787
3789
|
te = p
|
3788
3790
|
p = p - 1; begin
|
@@ -3790,7 +3792,7 @@ p = p - 1; begin
|
|
3790
3792
|
end
|
3791
3793
|
end
|
3792
3794
|
when 5 then
|
3793
|
-
# line 608 "/Users/
|
3795
|
+
# line 608 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3794
3796
|
begin
|
3795
3797
|
begin p = ((te))-1; end
|
3796
3798
|
begin
|
@@ -3799,7 +3801,7 @@ p = p - 1; begin
|
|
3799
3801
|
end
|
3800
3802
|
end
|
3801
3803
|
when 12 then
|
3802
|
-
# line 739 "/Users/
|
3804
|
+
# line 739 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3803
3805
|
begin
|
3804
3806
|
begin p = ((te))-1; end
|
3805
3807
|
begin
|
@@ -3814,7 +3816,7 @@ p = p - 1; begin
|
|
3814
3816
|
end
|
3815
3817
|
end
|
3816
3818
|
when 3 then
|
3817
|
-
# line 766 "/Users/
|
3819
|
+
# line 766 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3818
3820
|
begin
|
3819
3821
|
begin p = ((te))-1; end
|
3820
3822
|
begin
|
@@ -3840,13 +3842,13 @@ end
|
|
3840
3842
|
end
|
3841
3843
|
end
|
3842
3844
|
when 74 then
|
3843
|
-
# line 134 "/Users/
|
3845
|
+
# line 134 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3844
3846
|
begin
|
3845
3847
|
|
3846
3848
|
text = ts ? copy(data, ts-1..-1) : data.pack('c*')
|
3847
3849
|
raise PrematureEndError.new( text )
|
3848
3850
|
end
|
3849
|
-
# line 201 "/Users/
|
3851
|
+
# line 201 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3850
3852
|
begin
|
3851
3853
|
te = p
|
3852
3854
|
p = p - 1; begin
|
@@ -3865,13 +3867,13 @@ p = p - 1; begin
|
|
3865
3867
|
end
|
3866
3868
|
end
|
3867
3869
|
when 20 then
|
3868
|
-
# line 134 "/Users/
|
3870
|
+
# line 134 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3869
3871
|
begin
|
3870
3872
|
|
3871
3873
|
text = ts ? copy(data, ts-1..-1) : data.pack('c*')
|
3872
3874
|
raise PrematureEndError.new( text )
|
3873
3875
|
end
|
3874
|
-
# line 201 "/Users/
|
3876
|
+
# line 201 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3875
3877
|
begin
|
3876
3878
|
begin p = ((te))-1; end
|
3877
3879
|
begin
|
@@ -3890,13 +3892,13 @@ p = p - 1; begin
|
|
3890
3892
|
end
|
3891
3893
|
end
|
3892
3894
|
when 99 then
|
3893
|
-
# line 134 "/Users/
|
3895
|
+
# line 134 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3894
3896
|
begin
|
3895
3897
|
|
3896
3898
|
text = ts ? copy(data, ts-1..-1) : data.pack('c*')
|
3897
3899
|
raise PrematureEndError.new( text )
|
3898
3900
|
end
|
3899
|
-
# line 362 "/Users/
|
3901
|
+
# line 362 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3900
3902
|
begin
|
3901
3903
|
te = p
|
3902
3904
|
p = p - 1; begin
|
@@ -3911,13 +3913,13 @@ p = p - 1; begin
|
|
3911
3913
|
end
|
3912
3914
|
end
|
3913
3915
|
when 103 then
|
3914
|
-
# line 134 "/Users/
|
3916
|
+
# line 134 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3915
3917
|
begin
|
3916
3918
|
|
3917
3919
|
text = ts ? copy(data, ts-1..-1) : data.pack('c*')
|
3918
3920
|
raise PrematureEndError.new( text )
|
3919
3921
|
end
|
3920
|
-
# line 376 "/Users/
|
3922
|
+
# line 376 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3921
3923
|
begin
|
3922
3924
|
te = p
|
3923
3925
|
p = p - 1; begin
|
@@ -3932,13 +3934,13 @@ p = p - 1; begin
|
|
3932
3934
|
end
|
3933
3935
|
end
|
3934
3936
|
when 95 then
|
3935
|
-
# line 134 "/Users/
|
3937
|
+
# line 134 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3936
3938
|
begin
|
3937
3939
|
|
3938
3940
|
text = ts ? copy(data, ts-1..-1) : data.pack('c*')
|
3939
3941
|
raise PrematureEndError.new( text )
|
3940
3942
|
end
|
3941
|
-
# line 381 "/Users/
|
3943
|
+
# line 381 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3942
3944
|
begin
|
3943
3945
|
te = p
|
3944
3946
|
p = p - 1; begin
|
@@ -3963,13 +3965,13 @@ p = p - 1; begin
|
|
3963
3965
|
end
|
3964
3966
|
end
|
3965
3967
|
when 97 then
|
3966
|
-
# line 134 "/Users/
|
3968
|
+
# line 134 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3967
3969
|
begin
|
3968
3970
|
|
3969
3971
|
text = ts ? copy(data, ts-1..-1) : data.pack('c*')
|
3970
3972
|
raise PrematureEndError.new( text )
|
3971
3973
|
end
|
3972
|
-
# line 396 "/Users/
|
3974
|
+
# line 396 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3973
3975
|
begin
|
3974
3976
|
te = p
|
3975
3977
|
p = p - 1; begin
|
@@ -3994,13 +3996,13 @@ p = p - 1; begin
|
|
3994
3996
|
end
|
3995
3997
|
end
|
3996
3998
|
when 28 then
|
3997
|
-
# line 134 "/Users/
|
3999
|
+
# line 134 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
3998
4000
|
begin
|
3999
4001
|
|
4000
4002
|
text = ts ? copy(data, ts-1..-1) : data.pack('c*')
|
4001
4003
|
raise PrematureEndError.new( text )
|
4002
4004
|
end
|
4003
|
-
# line 381 "/Users/
|
4005
|
+
# line 381 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4004
4006
|
begin
|
4005
4007
|
begin p = ((te))-1; end
|
4006
4008
|
begin
|
@@ -4025,13 +4027,13 @@ p = p - 1; begin
|
|
4025
4027
|
end
|
4026
4028
|
end
|
4027
4029
|
when 31 then
|
4028
|
-
# line 134 "/Users/
|
4030
|
+
# line 134 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4029
4031
|
begin
|
4030
4032
|
|
4031
4033
|
text = ts ? copy(data, ts-1..-1) : data.pack('c*')
|
4032
4034
|
raise PrematureEndError.new( text )
|
4033
4035
|
end
|
4034
|
-
# line 396 "/Users/
|
4036
|
+
# line 396 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4035
4037
|
begin
|
4036
4038
|
begin p = ((te))-1; end
|
4037
4039
|
begin
|
@@ -4056,13 +4058,13 @@ p = p - 1; begin
|
|
4056
4058
|
end
|
4057
4059
|
end
|
4058
4060
|
when 35 then
|
4059
|
-
# line 140 "/Users/
|
4061
|
+
# line 140 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4060
4062
|
begin
|
4061
4063
|
|
4062
4064
|
text = ts ? copy(data, ts-1..-1) : data.pack('c*')
|
4063
4065
|
raise InvalidSequenceError.new('sequence', text)
|
4064
4066
|
end
|
4065
|
-
# line 372 "/Users/
|
4067
|
+
# line 372 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4066
4068
|
begin
|
4067
4069
|
te = p+1
|
4068
4070
|
begin
|
@@ -4076,17 +4078,17 @@ te = p+1
|
|
4076
4078
|
end
|
4077
4079
|
end
|
4078
4080
|
when 52 then
|
4079
|
-
# line 147 "/Users/
|
4081
|
+
# line 147 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4080
4082
|
begin
|
4081
|
-
|
4082
|
-
# line 146 "/Users/
|
4083
|
+
self.group_depth = group_depth - 1; in_group = group_depth > 0 ? true : false end
|
4084
|
+
# line 146 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4083
4085
|
begin
|
4084
|
-
|
4086
|
+
self.group_depth = group_depth + 1; in_group = true end
|
4085
4087
|
when 11 then
|
4086
|
-
# line 147 "/Users/
|
4088
|
+
# line 147 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4087
4089
|
begin
|
4088
|
-
|
4089
|
-
# line 544 "/Users/
|
4090
|
+
self.group_depth = group_depth - 1; in_group = group_depth > 0 ? true : false end
|
4091
|
+
# line 544 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4090
4092
|
begin
|
4091
4093
|
te = p+1
|
4092
4094
|
begin
|
@@ -4094,15 +4096,15 @@ te = p+1
|
|
4094
4096
|
end
|
4095
4097
|
end
|
4096
4098
|
when 44 then
|
4097
|
-
# line 147 "/Users/
|
4099
|
+
# line 147 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4098
4100
|
begin
|
4099
|
-
|
4100
|
-
# line 613 "/Users/
|
4101
|
+
self.group_depth = group_depth - 1; in_group = group_depth > 0 ? true : false end
|
4102
|
+
# line 613 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4101
4103
|
begin
|
4102
4104
|
te = p+1
|
4103
4105
|
begin
|
4104
4106
|
if in_conditional and conditional_stack.last and
|
4105
|
-
conditional_stack.last[1] == (
|
4107
|
+
conditional_stack.last[1] == (group_depth + 1)
|
4106
4108
|
|
4107
4109
|
emit(:conditional, :close, *text(data, ts, te))
|
4108
4110
|
conditional_stack.pop
|
@@ -4111,11 +4113,11 @@ te = p+1
|
|
4111
4113
|
in_conditional = false
|
4112
4114
|
end
|
4113
4115
|
else
|
4114
|
-
if
|
4115
|
-
|
4116
|
-
|
4116
|
+
if spacing_stack.length > 1 and
|
4117
|
+
spacing_stack.last[:depth] == (group_depth + 1)
|
4118
|
+
spacing_stack.pop
|
4117
4119
|
|
4118
|
-
|
4120
|
+
self.free_spacing = spacing_stack.last[:free_spacing]
|
4119
4121
|
end
|
4120
4122
|
|
4121
4123
|
emit(:group, :close, *text(data, ts, te))
|
@@ -4127,15 +4129,15 @@ te = p+1
|
|
4127
4129
|
begin
|
4128
4130
|
te = p+1
|
4129
4131
|
end
|
4130
|
-
# line 146 "/Users/
|
4132
|
+
# line 146 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4131
4133
|
begin
|
4132
|
-
|
4134
|
+
self.group_depth = group_depth + 1; in_group = true end
|
4133
4135
|
when 77 then
|
4134
4136
|
# line 1 "NONE"
|
4135
4137
|
begin
|
4136
4138
|
te = p+1
|
4137
4139
|
end
|
4138
|
-
# line 278 "/Users/
|
4140
|
+
# line 278 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4139
4141
|
begin
|
4140
4142
|
act = 18; end
|
4141
4143
|
when 26 then
|
@@ -4143,7 +4145,7 @@ act = 18; end
|
|
4143
4145
|
begin
|
4144
4146
|
te = p+1
|
4145
4147
|
end
|
4146
|
-
# line 294 "/Users/
|
4148
|
+
# line 294 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4147
4149
|
begin
|
4148
4150
|
act = 20; end
|
4149
4151
|
when 88 then
|
@@ -4151,7 +4153,7 @@ act = 20; end
|
|
4151
4153
|
begin
|
4152
4154
|
te = p+1
|
4153
4155
|
end
|
4154
|
-
# line 304 "/Users/
|
4156
|
+
# line 304 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4155
4157
|
begin
|
4156
4158
|
act = 21; end
|
4157
4159
|
when 87 then
|
@@ -4159,7 +4161,7 @@ act = 21; end
|
|
4159
4161
|
begin
|
4160
4162
|
te = p+1
|
4161
4163
|
end
|
4162
|
-
# line 310 "/Users/
|
4164
|
+
# line 310 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4163
4165
|
begin
|
4164
4166
|
act = 22; end
|
4165
4167
|
when 2 then
|
@@ -4167,10 +4169,10 @@ act = 22; end
|
|
4167
4169
|
begin
|
4168
4170
|
te = p+1
|
4169
4171
|
end
|
4170
|
-
# line 766 "/Users/
|
4172
|
+
# line 766 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4171
4173
|
begin
|
4172
4174
|
act = 59; end
|
4173
|
-
# line
|
4175
|
+
# line 4175 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb"
|
4174
4176
|
end
|
4175
4177
|
end
|
4176
4178
|
end
|
@@ -4188,7 +4190,7 @@ ts = nil; end
|
|
4188
4190
|
begin
|
4189
4191
|
act = 0
|
4190
4192
|
end
|
4191
|
-
# line
|
4193
|
+
# line 4193 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb"
|
4192
4194
|
end
|
4193
4195
|
|
4194
4196
|
if cs == 0
|
@@ -4210,19 +4212,19 @@ act = 0
|
|
4210
4212
|
end
|
4211
4213
|
case _re_scanner_eof_actions[cs]
|
4212
4214
|
when 15 then
|
4213
|
-
# line 54 "/Users/
|
4215
|
+
# line 54 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/property.rl"
|
4214
4216
|
begin
|
4215
4217
|
|
4216
4218
|
raise PrematureEndError.new('unicode property')
|
4217
4219
|
end
|
4218
4220
|
when 14 then
|
4219
|
-
# line 134 "/Users/
|
4221
|
+
# line 134 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4220
4222
|
begin
|
4221
4223
|
|
4222
4224
|
text = ts ? copy(data, ts-1..-1) : data.pack('c*')
|
4223
4225
|
raise PrematureEndError.new( text )
|
4224
4226
|
end
|
4225
|
-
# line
|
4227
|
+
# line 4227 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb"
|
4226
4228
|
end
|
4227
4229
|
end
|
4228
4230
|
|
@@ -4233,7 +4235,7 @@ act = 0
|
|
4233
4235
|
end
|
4234
4236
|
end
|
4235
4237
|
|
4236
|
-
# line
|
4238
|
+
# line 868 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
|
4237
4239
|
|
4238
4240
|
if cs == re_scanner_error
|
4239
4241
|
text = ts ? copy(data, ts-1..-1) : data.pack('c*')
|
@@ -4241,31 +4243,35 @@ end
|
|
4241
4243
|
end
|
4242
4244
|
|
4243
4245
|
raise PrematureEndError.new("(missing group closing paranthesis) "+
|
4244
|
-
"[#{
|
4246
|
+
"[#{in_group}:#{group_depth}]") if in_group
|
4245
4247
|
raise PrematureEndError.new("(missing set closing bracket) "+
|
4246
4248
|
"[#{in_set}:#{set_depth}]") if in_set
|
4247
4249
|
|
4248
4250
|
# when the entire expression is a literal run
|
4249
|
-
emit_literal if
|
4251
|
+
emit_literal if literal
|
4250
4252
|
|
4251
|
-
|
4253
|
+
tokens
|
4252
4254
|
end
|
4253
4255
|
|
4254
4256
|
# Emits an array with the details of the scanned pattern
|
4255
4257
|
def emit(type, token, text, ts, te)
|
4256
4258
|
#puts "EMIT: type: #{type}, token: #{token}, text: #{text}, ts: #{ts}, te: #{te}"
|
4257
4259
|
|
4258
|
-
emit_literal if
|
4260
|
+
emit_literal if literal
|
4259
4261
|
|
4260
|
-
if
|
4261
|
-
|
4262
|
+
if block
|
4263
|
+
block.call type, token, text, ts, te
|
4262
4264
|
end
|
4263
4265
|
|
4264
|
-
|
4266
|
+
tokens << [type, token, text, ts, te]
|
4265
4267
|
end
|
4266
4268
|
|
4267
4269
|
private
|
4268
4270
|
|
4271
|
+
attr_accessor :tokens, :literal, :block,
|
4272
|
+
:in_group, :group_depth,
|
4273
|
+
:free_spacing, :spacing_stack
|
4274
|
+
|
4269
4275
|
# Ragel's regex-based scan of the group options introduced a lot of
|
4270
4276
|
# ambiguity, so we just ask it to find the beginning of what looks
|
4271
4277
|
# like an options run and handle the rest in here.
|
@@ -4334,19 +4340,19 @@ end
|
|
4334
4340
|
# Appends one or more characters to the literal buffer, to be emitted later
|
4335
4341
|
# by a call to emit_literal. Contents can be a mix of ASCII and UTF-8.
|
4336
4342
|
def append_literal(data, ts, te)
|
4337
|
-
|
4338
|
-
|
4343
|
+
self.literal = literal || []
|
4344
|
+
literal << text(data, ts, te)
|
4339
4345
|
end
|
4340
4346
|
|
4341
4347
|
# Emits the literal run collected by calls to the append_literal method,
|
4342
4348
|
# using the total start (ts) and end (te) offsets of the run.
|
4343
4349
|
def emit_literal
|
4344
|
-
ts, te =
|
4345
|
-
text =
|
4350
|
+
ts, te = literal.first[1], literal.last[2]
|
4351
|
+
text = literal.map {|t| t[0]}.join
|
4346
4352
|
|
4347
4353
|
text.force_encoding('utf-8') if text.respond_to?(:force_encoding)
|
4348
4354
|
|
4349
|
-
|
4355
|
+
self.literal = nil
|
4350
4356
|
emit(:literal, :literal, text, ts, te)
|
4351
4357
|
end
|
4352
4358
|
|
@@ -4355,20 +4361,20 @@ end
|
|
4355
4361
|
positive, negative, group_local = $1, $2, $3
|
4356
4362
|
|
4357
4363
|
if positive.include?('x')
|
4358
|
-
|
4364
|
+
self.free_spacing = true
|
4359
4365
|
end
|
4360
4366
|
|
4361
4367
|
# If the x appears in both, treat it like ruby does, the second cancels
|
4362
4368
|
# the first.
|
4363
4369
|
if negative.include?('x')
|
4364
|
-
|
4370
|
+
self.free_spacing = false
|
4365
4371
|
end
|
4366
4372
|
|
4367
4373
|
if group_local
|
4368
|
-
|
4374
|
+
spacing_stack << {:free_spacing => free_spacing, :depth => group_depth}
|
4369
4375
|
else
|
4370
4376
|
# switch for parent group level
|
4371
|
-
|
4377
|
+
spacing_stack.last[:free_spacing] = free_spacing
|
4372
4378
|
end
|
4373
4379
|
end
|
4374
4380
|
|