vorax 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vorax.rb +1 -0
- data/lib/vorax/parser/grammars/alias.rb +29 -38
- data/lib/vorax/parser/grammars/alias.rl +0 -9
- data/lib/vorax/parser/grammars/column.rb +1 -1
- data/lib/vorax/parser/grammars/column.rl +1 -1
- data/lib/vorax/parser/grammars/common.rl +3 -0
- data/lib/vorax/parser/grammars/for_block.rb +413 -0
- data/lib/vorax/parser/grammars/for_block.rl +67 -0
- data/lib/vorax/parser/grammars/plsql_def.rb +272 -202
- data/lib/vorax/parser/grammars/plsql_def.rl +15 -1
- data/lib/vorax/parser/plsql_structure.rb +71 -12
- data/lib/vorax/version.rb +1 -1
- data/spec/parser_spec.rb +27 -2
- data/spec/plsql_structure_spec.rb +5 -2
- data/spec/sql/test.pkg +15 -0
- metadata +3 -1
data/lib/vorax.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
# line 1 "lib/vorax/parser/grammars/alias.rl"
|
3
3
|
|
4
|
-
# line
|
4
|
+
# line 72 "lib/vorax/parser/grammars/alias.rl"
|
5
5
|
|
6
6
|
|
7
7
|
module Vorax
|
@@ -544,7 +544,7 @@ end
|
|
544
544
|
self.alias_en_main = 131;
|
545
545
|
|
546
546
|
|
547
|
-
# line
|
547
|
+
# line 95 "lib/vorax/parser/grammars/alias.rl"
|
548
548
|
|
549
549
|
# line 550 "lib/vorax/parser/grammars/alias.rb"
|
550
550
|
begin
|
@@ -556,7 +556,7 @@ begin
|
|
556
556
|
act = 0
|
557
557
|
end
|
558
558
|
|
559
|
-
# line
|
559
|
+
# line 96 "lib/vorax/parser/grammars/alias.rl"
|
560
560
|
|
561
561
|
# line 562 "lib/vorax/parser/grammars/alias.rb"
|
562
562
|
begin
|
@@ -658,68 +658,59 @@ when 0 then
|
|
658
658
|
# line 5 "lib/vorax/parser/grammars/alias.rl"
|
659
659
|
begin
|
660
660
|
|
661
|
-
#puts "tableref_start: p=#{p}"
|
662
661
|
@t_start = p
|
663
662
|
end
|
664
663
|
when 1 then
|
665
|
-
# line
|
664
|
+
# line 9 "lib/vorax/parser/grammars/alias.rl"
|
666
665
|
begin
|
667
666
|
|
668
667
|
@table_ref = data[(@t_start..p-1)]
|
669
|
-
#puts "tableref_end: @table_ref=#@table_ref"
|
670
668
|
end
|
671
669
|
when 2 then
|
672
|
-
# line
|
670
|
+
# line 13 "lib/vorax/parser/grammars/alias.rl"
|
673
671
|
begin
|
674
672
|
|
675
|
-
#puts "alias_start: p=#{p}"
|
676
673
|
@a_start = p
|
677
674
|
@alias_value = nil
|
678
675
|
end
|
679
676
|
when 3 then
|
680
|
-
# line
|
677
|
+
# line 18 "lib/vorax/parser/grammars/alias.rl"
|
681
678
|
begin
|
682
679
|
|
683
680
|
text = data[(@a_start..p-1)]
|
684
681
|
@alias_value = text unless @not_alias.include?(text.upcase)
|
685
|
-
#puts "alias_end: @alias_value=#@alias_value"
|
686
682
|
end
|
687
683
|
when 4 then
|
688
|
-
# line
|
684
|
+
# line 23 "lib/vorax/parser/grammars/alias.rl"
|
689
685
|
begin
|
690
686
|
|
691
|
-
#puts "subquery_start: p=#{p}"
|
692
687
|
@subquery_text = Parser.walk_balanced_paren(data[(p..-1)]).gsub(/^\(|\)$/, '')
|
693
688
|
p += 1
|
694
689
|
@subquery_range = (p..p+@subquery_text.length-1)
|
695
690
|
p += @subquery_text.length
|
696
691
|
te = p
|
697
|
-
#puts "subquery_end: p=#{p} @subquery_text=#@subquery_text @subquery_range=#@subquery_range"
|
698
692
|
end
|
699
693
|
when 5 then
|
700
|
-
# line
|
694
|
+
# line 31 "lib/vorax/parser/grammars/alias.rl"
|
701
695
|
begin
|
702
696
|
|
703
|
-
#puts "before_with: p=#{p}"
|
704
697
|
@alias_value = nil
|
705
698
|
@subquery_range = nil
|
706
699
|
@subquery_text = nil
|
707
700
|
end
|
708
701
|
when 6 then
|
709
|
-
# line
|
702
|
+
# line 37 "lib/vorax/parser/grammars/alias.rl"
|
710
703
|
begin
|
711
704
|
|
712
705
|
@refs << ExprRef.new(@subquery_text, @subquery_range, @alias_value)
|
713
706
|
@alias_value = nil
|
714
707
|
@subquery_range = nil
|
715
708
|
@subquery_text = nil
|
716
|
-
#puts "after_with"
|
717
709
|
end
|
718
710
|
when 7 then
|
719
|
-
# line
|
711
|
+
# line 44 "lib/vorax/parser/grammars/alias.rl"
|
720
712
|
begin
|
721
713
|
|
722
|
-
#puts "before_tref: p=#{p} @alias_value=#@alias_value @subquery_text=#@subquery_text @subquery_range=#@subquery_range"
|
723
714
|
add_tableref
|
724
715
|
end
|
725
716
|
when 10 then
|
@@ -728,81 +719,81 @@ when 10 then
|
|
728
719
|
te = p+1
|
729
720
|
end
|
730
721
|
when 11 then
|
731
|
-
# line
|
722
|
+
# line 62 "lib/vorax/parser/grammars/alias.rl"
|
732
723
|
begin
|
733
724
|
act = 1; end
|
734
725
|
when 12 then
|
735
|
-
# line
|
726
|
+
# line 64 "lib/vorax/parser/grammars/alias.rl"
|
736
727
|
begin
|
737
728
|
act = 3; end
|
738
729
|
when 13 then
|
739
|
-
# line
|
730
|
+
# line 65 "lib/vorax/parser/grammars/alias.rl"
|
740
731
|
begin
|
741
732
|
act = 4; end
|
742
733
|
when 14 then
|
743
|
-
# line
|
734
|
+
# line 69 "lib/vorax/parser/grammars/alias.rl"
|
744
735
|
begin
|
745
736
|
act = 8; end
|
746
737
|
when 15 then
|
747
|
-
# line
|
738
|
+
# line 63 "lib/vorax/parser/grammars/alias.rl"
|
748
739
|
begin
|
749
740
|
te = p+1
|
750
741
|
end
|
751
742
|
when 16 then
|
752
|
-
# line
|
743
|
+
# line 69 "lib/vorax/parser/grammars/alias.rl"
|
753
744
|
begin
|
754
745
|
te = p+1
|
755
746
|
end
|
756
747
|
when 17 then
|
757
|
-
# line
|
748
|
+
# line 62 "lib/vorax/parser/grammars/alias.rl"
|
758
749
|
begin
|
759
750
|
te = p
|
760
751
|
p = p - 1; end
|
761
752
|
when 18 then
|
762
|
-
# line
|
753
|
+
# line 65 "lib/vorax/parser/grammars/alias.rl"
|
763
754
|
begin
|
764
755
|
te = p
|
765
756
|
p = p - 1; begin @start_columns = te end
|
766
757
|
end
|
767
758
|
when 19 then
|
768
|
-
# line
|
759
|
+
# line 66 "lib/vorax/parser/grammars/alias.rl"
|
769
760
|
begin
|
770
761
|
te = p
|
771
762
|
p = p - 1; begin @columns = data[(@start_columns..ts)] unless @columns end
|
772
763
|
end
|
773
764
|
when 20 then
|
774
|
-
# line
|
765
|
+
# line 67 "lib/vorax/parser/grammars/alias.rl"
|
775
766
|
begin
|
776
767
|
te = p
|
777
768
|
p = p - 1; end
|
778
769
|
when 21 then
|
779
|
-
# line
|
770
|
+
# line 68 "lib/vorax/parser/grammars/alias.rl"
|
780
771
|
begin
|
781
772
|
te = p
|
782
773
|
p = p - 1; end
|
783
774
|
when 22 then
|
784
|
-
# line
|
775
|
+
# line 69 "lib/vorax/parser/grammars/alias.rl"
|
785
776
|
begin
|
786
777
|
te = p
|
787
778
|
p = p - 1; end
|
788
779
|
when 23 then
|
789
|
-
# line
|
780
|
+
# line 66 "lib/vorax/parser/grammars/alias.rl"
|
790
781
|
begin
|
791
782
|
begin p = ((te))-1; end
|
792
783
|
begin @columns = data[(@start_columns..ts)] unless @columns end
|
793
784
|
end
|
794
785
|
when 24 then
|
795
|
-
# line
|
786
|
+
# line 67 "lib/vorax/parser/grammars/alias.rl"
|
796
787
|
begin
|
797
788
|
begin p = ((te))-1; end
|
798
789
|
end
|
799
790
|
when 25 then
|
800
|
-
# line
|
791
|
+
# line 68 "lib/vorax/parser/grammars/alias.rl"
|
801
792
|
begin
|
802
793
|
begin p = ((te))-1; end
|
803
794
|
end
|
804
795
|
when 26 then
|
805
|
-
# line
|
796
|
+
# line 69 "lib/vorax/parser/grammars/alias.rl"
|
806
797
|
begin
|
807
798
|
begin p = ((te))-1; end
|
808
799
|
end
|
@@ -821,7 +812,7 @@ end
|
|
821
812
|
end
|
822
813
|
end
|
823
814
|
end
|
824
|
-
# line
|
815
|
+
# line 816 "lib/vorax/parser/grammars/alias.rb"
|
825
816
|
end # action switch
|
826
817
|
end
|
827
818
|
end
|
@@ -841,7 +832,7 @@ when 8 then
|
|
841
832
|
# line 1 "NONE"
|
842
833
|
begin
|
843
834
|
ts = nil; end
|
844
|
-
# line
|
835
|
+
# line 836 "lib/vorax/parser/grammars/alias.rb"
|
845
836
|
end # to state action switch
|
846
837
|
end
|
847
838
|
if _trigger_goto
|
@@ -868,7 +859,7 @@ end
|
|
868
859
|
end
|
869
860
|
end
|
870
861
|
|
871
|
-
# line
|
862
|
+
# line 97 "lib/vorax/parser/grammars/alias.rl"
|
872
863
|
data.chop!
|
873
864
|
|
874
865
|
# needed to finalize the last pending tableref
|
@@ -3,17 +3,14 @@
|
|
3
3
|
machine alias;
|
4
4
|
|
5
5
|
action tableref_start {
|
6
|
-
#puts "tableref_start: p=#{p}"
|
7
6
|
@t_start = p
|
8
7
|
}
|
9
8
|
|
10
9
|
action tableref_end {
|
11
10
|
@table_ref = data[(@t_start..p-1)]
|
12
|
-
#puts "tableref_end: @table_ref=#@table_ref"
|
13
11
|
}
|
14
12
|
|
15
13
|
action alias_start {
|
16
|
-
#puts "alias_start: p=#{p}"
|
17
14
|
@a_start = p
|
18
15
|
@alias_value = nil
|
19
16
|
}
|
@@ -21,21 +18,17 @@ action alias_start {
|
|
21
18
|
action alias_end {
|
22
19
|
text = data[(@a_start..p-1)]
|
23
20
|
@alias_value = text unless @not_alias.include?(text.upcase)
|
24
|
-
#puts "alias_end: @alias_value=#@alias_value"
|
25
21
|
}
|
26
22
|
|
27
23
|
action subquery_start {
|
28
|
-
#puts "subquery_start: p=#{p}"
|
29
24
|
@subquery_text = Parser.walk_balanced_paren(data[(p..-1)]).gsub(/^\(|\)$/, '')
|
30
25
|
p += 1
|
31
26
|
@subquery_range = (p..p+@subquery_text.length-1)
|
32
27
|
p += @subquery_text.length
|
33
28
|
te = p
|
34
|
-
#puts "subquery_end: p=#{p} @subquery_text=#@subquery_text @subquery_range=#@subquery_range"
|
35
29
|
}
|
36
30
|
|
37
31
|
action before_with {
|
38
|
-
#puts "before_with: p=#{p}"
|
39
32
|
@alias_value = nil
|
40
33
|
@subquery_range = nil
|
41
34
|
@subquery_text = nil
|
@@ -46,11 +39,9 @@ action after_with {
|
|
46
39
|
@alias_value = nil
|
47
40
|
@subquery_range = nil
|
48
41
|
@subquery_text = nil
|
49
|
-
#puts "after_with"
|
50
42
|
}
|
51
43
|
|
52
44
|
action before_tref {
|
53
|
-
#puts "before_tref: p=#{p} @alias_value=#@alias_value @subquery_text=#@subquery_text @subquery_range=#@subquery_range"
|
54
45
|
add_tableref
|
55
46
|
}
|
56
47
|
|
@@ -0,0 +1,413 @@
|
|
1
|
+
|
2
|
+
# line 1 "lib/vorax/parser/grammars/for_block.rl"
|
3
|
+
|
4
|
+
# line 41 "lib/vorax/parser/grammars/for_block.rl"
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
module Vorax
|
9
|
+
|
10
|
+
module Parser
|
11
|
+
|
12
|
+
def self.describe_for(data)
|
13
|
+
@cursor_var = nil
|
14
|
+
@for_var = nil
|
15
|
+
@expr = nil
|
16
|
+
@end_pos = -1
|
17
|
+
if data
|
18
|
+
eof = data.length
|
19
|
+
|
20
|
+
# line 21 "lib/vorax/parser/grammars/for_block.rb"
|
21
|
+
class << self
|
22
|
+
attr_accessor :_for_block_actions
|
23
|
+
private :_for_block_actions, :_for_block_actions=
|
24
|
+
end
|
25
|
+
self._for_block_actions = [
|
26
|
+
0, 1, 0, 1, 1, 1, 4, 2,
|
27
|
+
5, 2, 2, 5, 3
|
28
|
+
]
|
29
|
+
|
30
|
+
class << self
|
31
|
+
attr_accessor :_for_block_key_offsets
|
32
|
+
private :_for_block_key_offsets, :_for_block_key_offsets=
|
33
|
+
end
|
34
|
+
self._for_block_key_offsets = [
|
35
|
+
0, 0, 2, 4, 6, 11, 24, 25,
|
36
|
+
30, 37, 38, 39, 40, 41, 43, 45,
|
37
|
+
51, 69, 70, 75, 82, 83, 84, 85,
|
38
|
+
86, 88, 90, 92, 94, 99, 100, 101,
|
39
|
+
102, 103, 105, 119, 120, 121, 122, 123,
|
40
|
+
125, 133, 139, 140, 141, 142, 149, 150,
|
41
|
+
151, 152, 153, 155, 162, 163, 164, 166,
|
42
|
+
182, 198, 214, 230, 246, 262, 276, 283,
|
43
|
+
284, 285, 286, 287, 289, 303, 304, 305,
|
44
|
+
306, 307, 309
|
45
|
+
]
|
46
|
+
|
47
|
+
class << self
|
48
|
+
attr_accessor :_for_block_trans_keys
|
49
|
+
private :_for_block_trans_keys, :_for_block_trans_keys=
|
50
|
+
end
|
51
|
+
self._for_block_trans_keys = [
|
52
|
+
70, 102, 79, 111, 82, 114, 32, 45,
|
53
|
+
47, 9, 13, 32, 34, 45, 47, 95,
|
54
|
+
9, 13, 35, 36, 65, 90, 97, 122,
|
55
|
+
34, 32, 45, 47, 9, 13, 32, 45,
|
56
|
+
47, 73, 105, 9, 13, 45, 10, 42,
|
57
|
+
42, 42, 47, 78, 110, 32, 40, 45,
|
58
|
+
47, 9, 13, 32, 34, 40, 45, 47,
|
59
|
+
82, 95, 114, 9, 13, 35, 36, 48,
|
60
|
+
57, 65, 90, 97, 122, 34, 32, 45,
|
61
|
+
47, 9, 13, 32, 45, 47, 76, 108,
|
62
|
+
9, 13, 45, 10, 42, 42, 42, 47,
|
63
|
+
79, 111, 79, 111, 80, 112, 32, 45,
|
64
|
+
47, 9, 13, 45, 10, 42, 42, 42,
|
65
|
+
47, 32, 45, 47, 95, 9, 13, 35,
|
66
|
+
36, 48, 57, 65, 90, 97, 122, 45,
|
67
|
+
10, 42, 42, 42, 47, 32, 45, 46,
|
68
|
+
47, 9, 13, 48, 57, 32, 45, 46,
|
69
|
+
47, 9, 13, 45, 10, 46, 32, 45,
|
70
|
+
47, 9, 13, 48, 57, 45, 10, 42,
|
71
|
+
42, 42, 47, 32, 45, 47, 9, 13,
|
72
|
+
48, 57, 42, 42, 42, 47, 32, 45,
|
73
|
+
47, 69, 95, 101, 9, 13, 35, 36,
|
74
|
+
48, 57, 65, 90, 97, 122, 32, 45,
|
75
|
+
47, 86, 95, 118, 9, 13, 35, 36,
|
76
|
+
48, 57, 65, 90, 97, 122, 32, 45,
|
77
|
+
47, 69, 95, 101, 9, 13, 35, 36,
|
78
|
+
48, 57, 65, 90, 97, 122, 32, 45,
|
79
|
+
47, 82, 95, 114, 9, 13, 35, 36,
|
80
|
+
48, 57, 65, 90, 97, 122, 32, 45,
|
81
|
+
47, 83, 95, 115, 9, 13, 35, 36,
|
82
|
+
48, 57, 65, 90, 97, 122, 32, 45,
|
83
|
+
47, 69, 95, 101, 9, 13, 35, 36,
|
84
|
+
48, 57, 65, 90, 97, 122, 32, 45,
|
85
|
+
47, 95, 9, 13, 35, 36, 48, 57,
|
86
|
+
65, 90, 97, 122, 32, 45, 47, 9,
|
87
|
+
13, 48, 57, 45, 10, 42, 42, 42,
|
88
|
+
47, 32, 45, 47, 95, 9, 13, 35,
|
89
|
+
36, 48, 57, 65, 90, 97, 122, 45,
|
90
|
+
10, 42, 42, 42, 47, 32, 45, 47,
|
91
|
+
9, 13, 0
|
92
|
+
]
|
93
|
+
|
94
|
+
class << self
|
95
|
+
attr_accessor :_for_block_single_lengths
|
96
|
+
private :_for_block_single_lengths, :_for_block_single_lengths=
|
97
|
+
end
|
98
|
+
self._for_block_single_lengths = [
|
99
|
+
0, 2, 2, 2, 3, 5, 1, 3,
|
100
|
+
5, 1, 1, 1, 1, 2, 2, 4,
|
101
|
+
8, 1, 3, 5, 1, 1, 1, 1,
|
102
|
+
2, 2, 2, 2, 3, 1, 1, 1,
|
103
|
+
1, 2, 4, 1, 1, 1, 1, 2,
|
104
|
+
4, 4, 1, 1, 1, 3, 1, 1,
|
105
|
+
1, 1, 2, 3, 1, 1, 2, 6,
|
106
|
+
6, 6, 6, 6, 6, 4, 3, 1,
|
107
|
+
1, 1, 1, 2, 4, 1, 1, 1,
|
108
|
+
1, 2, 3
|
109
|
+
]
|
110
|
+
|
111
|
+
class << self
|
112
|
+
attr_accessor :_for_block_range_lengths
|
113
|
+
private :_for_block_range_lengths, :_for_block_range_lengths=
|
114
|
+
end
|
115
|
+
self._for_block_range_lengths = [
|
116
|
+
0, 0, 0, 0, 1, 4, 0, 1,
|
117
|
+
1, 0, 0, 0, 0, 0, 0, 1,
|
118
|
+
5, 0, 1, 1, 0, 0, 0, 0,
|
119
|
+
0, 0, 0, 0, 1, 0, 0, 0,
|
120
|
+
0, 0, 5, 0, 0, 0, 0, 0,
|
121
|
+
2, 1, 0, 0, 0, 2, 0, 0,
|
122
|
+
0, 0, 0, 2, 0, 0, 0, 5,
|
123
|
+
5, 5, 5, 5, 5, 5, 2, 0,
|
124
|
+
0, 0, 0, 0, 5, 0, 0, 0,
|
125
|
+
0, 0, 1
|
126
|
+
]
|
127
|
+
|
128
|
+
class << self
|
129
|
+
attr_accessor :_for_block_index_offsets
|
130
|
+
private :_for_block_index_offsets, :_for_block_index_offsets=
|
131
|
+
end
|
132
|
+
self._for_block_index_offsets = [
|
133
|
+
0, 0, 3, 6, 9, 14, 24, 26,
|
134
|
+
31, 38, 40, 42, 44, 46, 49, 52,
|
135
|
+
58, 72, 74, 79, 86, 88, 90, 92,
|
136
|
+
94, 97, 100, 103, 106, 111, 113, 115,
|
137
|
+
117, 119, 122, 132, 134, 136, 138, 140,
|
138
|
+
143, 150, 156, 158, 160, 162, 168, 170,
|
139
|
+
172, 174, 176, 179, 185, 187, 189, 192,
|
140
|
+
204, 216, 228, 240, 252, 264, 274, 280,
|
141
|
+
282, 284, 286, 288, 291, 301, 303, 305,
|
142
|
+
307, 309, 312
|
143
|
+
]
|
144
|
+
|
145
|
+
class << self
|
146
|
+
attr_accessor :_for_block_indicies
|
147
|
+
private :_for_block_indicies, :_for_block_indicies=
|
148
|
+
end
|
149
|
+
self._for_block_indicies = [
|
150
|
+
0, 0, 1, 2, 2, 1, 3, 3,
|
151
|
+
1, 4, 5, 6, 4, 1, 4, 7,
|
152
|
+
5, 6, 8, 4, 8, 8, 8, 1,
|
153
|
+
10, 9, 11, 12, 13, 11, 1, 14,
|
154
|
+
15, 16, 17, 17, 14, 1, 18, 1,
|
155
|
+
14, 18, 19, 1, 20, 19, 20, 14,
|
156
|
+
19, 21, 21, 1, 22, 23, 24, 25,
|
157
|
+
22, 1, 22, 26, 23, 24, 25, 29,
|
158
|
+
27, 29, 22, 27, 28, 27, 27, 1,
|
159
|
+
31, 30, 32, 33, 34, 32, 1, 35,
|
160
|
+
36, 37, 38, 38, 35, 1, 39, 1,
|
161
|
+
35, 39, 40, 1, 41, 40, 41, 35,
|
162
|
+
40, 42, 42, 1, 43, 43, 1, 44,
|
163
|
+
44, 1, 45, 46, 47, 45, 1, 48,
|
164
|
+
1, 45, 48, 49, 1, 50, 49, 50,
|
165
|
+
45, 49, 32, 33, 34, 51, 32, 51,
|
166
|
+
51, 51, 51, 1, 52, 1, 22, 52,
|
167
|
+
53, 1, 54, 53, 54, 22, 53, 55,
|
168
|
+
56, 57, 58, 55, 28, 1, 55, 56,
|
169
|
+
57, 58, 55, 1, 59, 1, 55, 59,
|
170
|
+
60, 1, 60, 61, 62, 60, 63, 1,
|
171
|
+
64, 1, 60, 64, 65, 1, 66, 65,
|
172
|
+
66, 60, 65, 35, 36, 37, 35, 63,
|
173
|
+
1, 67, 1, 68, 67, 68, 55, 67,
|
174
|
+
32, 33, 34, 69, 51, 69, 32, 51,
|
175
|
+
51, 51, 51, 1, 32, 33, 34, 70,
|
176
|
+
51, 70, 32, 51, 51, 51, 51, 1,
|
177
|
+
32, 33, 34, 71, 51, 71, 32, 51,
|
178
|
+
51, 51, 51, 1, 32, 33, 34, 72,
|
179
|
+
51, 72, 32, 51, 51, 51, 51, 1,
|
180
|
+
32, 33, 34, 73, 51, 73, 32, 51,
|
181
|
+
51, 51, 51, 1, 32, 33, 34, 74,
|
182
|
+
51, 74, 32, 51, 51, 51, 51, 1,
|
183
|
+
75, 76, 77, 51, 75, 51, 51, 51,
|
184
|
+
51, 1, 75, 76, 77, 75, 28, 1,
|
185
|
+
78, 1, 75, 78, 79, 1, 80, 79,
|
186
|
+
80, 75, 79, 11, 12, 13, 81, 11,
|
187
|
+
81, 81, 81, 81, 1, 82, 1, 4,
|
188
|
+
82, 83, 1, 84, 83, 84, 4, 83,
|
189
|
+
45, 46, 47, 45, 1, 0
|
190
|
+
]
|
191
|
+
|
192
|
+
class << self
|
193
|
+
attr_accessor :_for_block_trans_targs
|
194
|
+
private :_for_block_trans_targs, :_for_block_trans_targs=
|
195
|
+
end
|
196
|
+
self._for_block_trans_targs = [
|
197
|
+
2, 0, 3, 4, 5, 69, 71, 6,
|
198
|
+
68, 6, 7, 8, 9, 11, 8, 9,
|
199
|
+
11, 14, 10, 12, 13, 15, 16, 19,
|
200
|
+
35, 37, 17, 34, 40, 55, 17, 18,
|
201
|
+
19, 20, 22, 19, 20, 22, 25, 21,
|
202
|
+
23, 24, 26, 27, 28, 74, 29, 31,
|
203
|
+
30, 32, 33, 34, 36, 38, 39, 41,
|
204
|
+
42, 44, 52, 43, 45, 46, 48, 51,
|
205
|
+
47, 49, 50, 53, 54, 56, 57, 58,
|
206
|
+
59, 60, 61, 62, 63, 65, 64, 66,
|
207
|
+
67, 68, 70, 72, 73
|
208
|
+
]
|
209
|
+
|
210
|
+
class << self
|
211
|
+
attr_accessor :_for_block_trans_actions
|
212
|
+
private :_for_block_trans_actions, :_for_block_trans_actions=
|
213
|
+
end
|
214
|
+
self._for_block_trans_actions = [
|
215
|
+
0, 0, 0, 0, 0, 0, 0, 5,
|
216
|
+
5, 0, 0, 7, 7, 7, 0, 0,
|
217
|
+
0, 0, 0, 0, 0, 0, 0, 1,
|
218
|
+
0, 0, 5, 5, 0, 5, 0, 0,
|
219
|
+
10, 10, 10, 0, 0, 0, 0, 0,
|
220
|
+
0, 0, 0, 0, 0, 3, 0, 0,
|
221
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
222
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
223
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
224
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
225
|
+
0, 0, 0, 0, 0
|
226
|
+
]
|
227
|
+
|
228
|
+
class << self
|
229
|
+
attr_accessor :for_block_start
|
230
|
+
end
|
231
|
+
self.for_block_start = 1;
|
232
|
+
class << self
|
233
|
+
attr_accessor :for_block_first_final
|
234
|
+
end
|
235
|
+
self.for_block_first_final = 74;
|
236
|
+
class << self
|
237
|
+
attr_accessor :for_block_error
|
238
|
+
end
|
239
|
+
self.for_block_error = 0;
|
240
|
+
|
241
|
+
class << self
|
242
|
+
attr_accessor :for_block_en_for_stmt
|
243
|
+
end
|
244
|
+
self.for_block_en_for_stmt = 1;
|
245
|
+
|
246
|
+
|
247
|
+
# line 56 "lib/vorax/parser/grammars/for_block.rl"
|
248
|
+
|
249
|
+
# line 250 "lib/vorax/parser/grammars/for_block.rb"
|
250
|
+
begin
|
251
|
+
p ||= 0
|
252
|
+
pe ||= data.length
|
253
|
+
cs = for_block_start
|
254
|
+
end
|
255
|
+
|
256
|
+
# line 57 "lib/vorax/parser/grammars/for_block.rl"
|
257
|
+
|
258
|
+
# line 259 "lib/vorax/parser/grammars/for_block.rb"
|
259
|
+
begin
|
260
|
+
_klen, _trans, _keys, _acts, _nacts = nil
|
261
|
+
_goto_level = 0
|
262
|
+
_resume = 10
|
263
|
+
_eof_trans = 15
|
264
|
+
_again = 20
|
265
|
+
_test_eof = 30
|
266
|
+
_out = 40
|
267
|
+
while true
|
268
|
+
_trigger_goto = false
|
269
|
+
if _goto_level <= 0
|
270
|
+
if p == pe
|
271
|
+
_goto_level = _test_eof
|
272
|
+
next
|
273
|
+
end
|
274
|
+
if cs == 0
|
275
|
+
_goto_level = _out
|
276
|
+
next
|
277
|
+
end
|
278
|
+
end
|
279
|
+
if _goto_level <= _resume
|
280
|
+
_keys = _for_block_key_offsets[cs]
|
281
|
+
_trans = _for_block_index_offsets[cs]
|
282
|
+
_klen = _for_block_single_lengths[cs]
|
283
|
+
_break_match = false
|
284
|
+
|
285
|
+
begin
|
286
|
+
if _klen > 0
|
287
|
+
_lower = _keys
|
288
|
+
_upper = _keys + _klen - 1
|
289
|
+
|
290
|
+
loop do
|
291
|
+
break if _upper < _lower
|
292
|
+
_mid = _lower + ( (_upper - _lower) >> 1 )
|
293
|
+
|
294
|
+
if data[p].ord < _for_block_trans_keys[_mid]
|
295
|
+
_upper = _mid - 1
|
296
|
+
elsif data[p].ord > _for_block_trans_keys[_mid]
|
297
|
+
_lower = _mid + 1
|
298
|
+
else
|
299
|
+
_trans += (_mid - _keys)
|
300
|
+
_break_match = true
|
301
|
+
break
|
302
|
+
end
|
303
|
+
end # loop
|
304
|
+
break if _break_match
|
305
|
+
_keys += _klen
|
306
|
+
_trans += _klen
|
307
|
+
end
|
308
|
+
_klen = _for_block_range_lengths[cs]
|
309
|
+
if _klen > 0
|
310
|
+
_lower = _keys
|
311
|
+
_upper = _keys + (_klen << 1) - 2
|
312
|
+
loop do
|
313
|
+
break if _upper < _lower
|
314
|
+
_mid = _lower + (((_upper-_lower) >> 1) & ~1)
|
315
|
+
if data[p].ord < _for_block_trans_keys[_mid]
|
316
|
+
_upper = _mid - 2
|
317
|
+
elsif data[p].ord > _for_block_trans_keys[_mid+1]
|
318
|
+
_lower = _mid + 2
|
319
|
+
else
|
320
|
+
_trans += ((_mid - _keys) >> 1)
|
321
|
+
_break_match = true
|
322
|
+
break
|
323
|
+
end
|
324
|
+
end # loop
|
325
|
+
break if _break_match
|
326
|
+
_trans += _klen
|
327
|
+
end
|
328
|
+
end while false
|
329
|
+
_trans = _for_block_indicies[_trans]
|
330
|
+
cs = _for_block_trans_targs[_trans]
|
331
|
+
if _for_block_trans_actions[_trans] != 0
|
332
|
+
_acts = _for_block_trans_actions[_trans]
|
333
|
+
_nacts = _for_block_actions[_acts]
|
334
|
+
_acts += 1
|
335
|
+
while _nacts > 0
|
336
|
+
_nacts -= 1
|
337
|
+
_acts += 1
|
338
|
+
case _for_block_actions[_acts - 1]
|
339
|
+
when 0 then
|
340
|
+
# line 7 "lib/vorax/parser/grammars/for_block.rl"
|
341
|
+
begin
|
342
|
+
|
343
|
+
@expr = Parser.walk_balanced_paren(data[(p..-1)])
|
344
|
+
p += @expr.length - 1
|
345
|
+
end
|
346
|
+
when 1 then
|
347
|
+
# line 12 "lib/vorax/parser/grammars/for_block.rl"
|
348
|
+
begin
|
349
|
+
|
350
|
+
@end_pos = p
|
351
|
+
end
|
352
|
+
when 2 then
|
353
|
+
# line 16 "lib/vorax/parser/grammars/for_block.rl"
|
354
|
+
begin
|
355
|
+
|
356
|
+
@for_var = data[(@start..@end)]
|
357
|
+
end
|
358
|
+
when 3 then
|
359
|
+
# line 20 "lib/vorax/parser/grammars/for_block.rl"
|
360
|
+
begin
|
361
|
+
|
362
|
+
@cursor_var = data[(@start..@end)]
|
363
|
+
end
|
364
|
+
when 4 then
|
365
|
+
# line 24 "lib/vorax/parser/grammars/for_block.rl"
|
366
|
+
begin
|
367
|
+
|
368
|
+
@start = p
|
369
|
+
end
|
370
|
+
when 5 then
|
371
|
+
# line 28 "lib/vorax/parser/grammars/for_block.rl"
|
372
|
+
begin
|
373
|
+
|
374
|
+
@end = p - 1
|
375
|
+
end
|
376
|
+
# line 377 "lib/vorax/parser/grammars/for_block.rb"
|
377
|
+
end # action switch
|
378
|
+
end
|
379
|
+
end
|
380
|
+
if _trigger_goto
|
381
|
+
next
|
382
|
+
end
|
383
|
+
end
|
384
|
+
if _goto_level <= _again
|
385
|
+
if cs == 0
|
386
|
+
_goto_level = _out
|
387
|
+
next
|
388
|
+
end
|
389
|
+
p += 1
|
390
|
+
if p != pe
|
391
|
+
_goto_level = _resume
|
392
|
+
next
|
393
|
+
end
|
394
|
+
end
|
395
|
+
if _goto_level <= _test_eof
|
396
|
+
end
|
397
|
+
if _goto_level <= _out
|
398
|
+
break
|
399
|
+
end
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
# line 58 "lib/vorax/parser/grammars/for_block.rl"
|
404
|
+
end
|
405
|
+
return {:cursor_var => @cursor_var,
|
406
|
+
:for_var => @for_var,
|
407
|
+
:expr => @expr,
|
408
|
+
:end_pos => @end_pos}
|
409
|
+
end
|
410
|
+
|
411
|
+
end
|
412
|
+
|
413
|
+
end
|