delorean_lang 0.0.34 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +2 -2
- data/README.md +8 -6
- data/delorean.gemspec +1 -1
- data/lib/delorean/base.rb +22 -10
- data/lib/delorean/const.rb +5 -0
- data/lib/delorean/delorean.rb +570 -416
- data/lib/delorean/delorean.treetop +35 -47
- data/lib/delorean/engine.rb +42 -25
- data/lib/delorean/functions.rb +53 -45
- data/lib/delorean/model.rb +3 -1
- data/lib/delorean/nodes.rb +68 -28
- data/lib/delorean/version.rb +1 -1
- data/spec/dev_spec.rb +4 -6
- data/spec/eval_spec.rb +114 -10
- data/spec/func_spec.rb +22 -18
- data/spec/parse_spec.rb +21 -0
- metadata +7 -6
data/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c) 2012
|
|
1
|
+
Copyright (c) 2012 PennyMac Loan Services
|
|
2
2
|
|
|
3
3
|
MIT License
|
|
4
4
|
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
Delorean is a simple functional scripting language. It is used at
|
|
4
4
|
[PENNYMAC][] as a scripting language for a financial modeling system.
|
|
5
5
|
|
|
6
|
+

|
|
7
|
+
|
|
6
8
|
## Installation
|
|
7
9
|
|
|
8
10
|
$ gem install delorean_lang
|
|
@@ -41,7 +43,7 @@ Or add it to your `Gemfile`, etc.
|
|
|
41
43
|
deemed too complex for our users. Also, sand-boxing Ruby to prevent
|
|
42
44
|
unauthorized data access did not seem practical.
|
|
43
45
|
|
|
44
|
-
* Many of the financial models created at [PENNYMAC][] simple
|
|
46
|
+
* Many of the financial models created at [PENNYMAC][] are simple
|
|
45
47
|
modifications of earlier models. It was important for the scripting
|
|
46
48
|
language to provide a simple inheritance model such that major
|
|
47
49
|
parts of these models could be shared.
|
|
@@ -58,7 +60,7 @@ definition:
|
|
|
58
60
|
|
|
59
61
|
NodeA:
|
|
60
62
|
attr1 = 123
|
|
61
|
-
|
|
63
|
+
attr2 = attr1*2
|
|
62
64
|
|
|
63
65
|
In the above example, `NodeA` is a new node definition. This node
|
|
64
66
|
includes two attributes: `attr1` and `attr2`. `attr1` is defined to be
|
|
@@ -75,7 +77,7 @@ Delorean attribute definitions have the following form:
|
|
|
75
77
|
Where `attr` is an attribute name. Attribute names are required to
|
|
76
78
|
match the following regular expression: `[a-z][a-zA-Z0-9_]*`. An
|
|
77
79
|
attribute can only be specified once in a node. Also, any attributes
|
|
78
|
-
it refers to in its expression must have been defined.
|
|
80
|
+
it refers to in its expression must have been previously defined.
|
|
79
81
|
|
|
80
82
|
Delorean also provides a mechanism to provide "input" to a
|
|
81
83
|
computation. This is performed thorough a special kind of attribute
|
|
@@ -84,12 +86,12 @@ parameter:
|
|
|
84
86
|
|
|
85
87
|
NodeB:
|
|
86
88
|
param =? "hello"
|
|
87
|
-
|
|
89
|
+
attr = param + " world"
|
|
88
90
|
|
|
89
91
|
In this example, `param` is defined as a parameter whose default value
|
|
90
92
|
is `"hello"`, which is a string literal. If we evaluate `NodeB.attr`
|
|
91
93
|
without providing `param`, the result will be the string `"hello
|
|
92
|
-
|
|
94
|
+
world"`. If the `param` is sent in with the value `"look out"`, then
|
|
93
95
|
`NodeB.attr` will evaluate to `"look out world"`.
|
|
94
96
|
|
|
95
97
|
The parameter default value is optional. If no default value if
|
|
@@ -112,7 +114,7 @@ nodes. The following example shows the usage of inheritance:
|
|
|
112
114
|
|
|
113
115
|
In this example, node `USInfo` provides a definition of a
|
|
114
116
|
`is_teenager` when provided with an `age` parameter. Node `IndiaInfo`
|
|
115
|
-
is derived from `USInfo`
|
|
117
|
+
is derived from `USInfo` and so it shares all of its attribute
|
|
116
118
|
definitions. However, the `teen_min` attribute has been overridden.
|
|
117
119
|
This specifies that the computation of `is_teenager` will use the
|
|
118
120
|
newly defined `teen_min`. Therefore, `IndiaInfo.is_teenager` with
|
data/delorean.gemspec
CHANGED
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
|
|
|
14
14
|
gem.require_paths = ["lib"]
|
|
15
15
|
gem.version = Delorean::VERSION
|
|
16
16
|
|
|
17
|
-
gem.add_dependency "treetop"
|
|
17
|
+
gem.add_dependency "treetop", "~> 1.4"
|
|
18
18
|
gem.add_dependency "activerecord", "3.2.11"
|
|
19
19
|
gem.add_development_dependency "rspec"
|
|
20
20
|
gem.add_development_dependency "sqlite3"
|
data/lib/delorean/base.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Delorean
|
|
|
11
11
|
|
|
12
12
|
######################################################################
|
|
13
13
|
|
|
14
|
-
def self._get_attr(obj, attr)
|
|
14
|
+
def self._get_attr(obj, attr, _e)
|
|
15
15
|
return nil if obj.nil?
|
|
16
16
|
|
|
17
17
|
if obj.kind_of? ActiveRecord::Base
|
|
@@ -26,6 +26,8 @@ module Delorean
|
|
|
26
26
|
raise InvalidGetAttribute, "ActiveRecord lookup '#{attr}' on #{obj}"
|
|
27
27
|
elsif obj.instance_of?(Hash)
|
|
28
28
|
return obj.member?(attr) ? obj[attr] : obj[attr.to_sym]
|
|
29
|
+
elsif obj.instance_of?(Class) && (obj < BaseClass)
|
|
30
|
+
return obj.send((attr + POST).to_sym, _e)
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
raise InvalidGetAttribute, "bad attribute lookup '#{attr}' on #{obj}"
|
|
@@ -33,18 +35,28 @@ module Delorean
|
|
|
33
35
|
|
|
34
36
|
######################################################################
|
|
35
37
|
|
|
36
|
-
def self.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
def self._index(obj, args, _e)
|
|
39
|
+
if obj.instance_of?(Hash)
|
|
40
|
+
raise InvalidIndex unless args.length == 1
|
|
41
|
+
obj[args[0]]
|
|
42
|
+
elsif obj.instance_of?(Array)
|
|
43
|
+
raise InvalidIndex unless args.length < 2
|
|
44
|
+
raise InvalidIndex unless
|
|
45
|
+
args[0].is_a?(Fixnum) && (!args[1] || args[1].is_a?(Fixnum))
|
|
46
|
+
obj[*args]
|
|
47
|
+
else
|
|
48
|
+
raise InvalidIndex
|
|
49
|
+
end
|
|
50
|
+
end
|
|
41
51
|
|
|
42
|
-
|
|
52
|
+
######################################################################
|
|
43
53
|
|
|
44
|
-
|
|
54
|
+
def self._script_call(node, mname, _e, attrs, params)
|
|
55
|
+
context = _e[:_engine]
|
|
56
|
+
node ||= self
|
|
45
57
|
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
engine = mname ? context.get_import_engine(mname) : context
|
|
59
|
+
engine.evaluate_attrs_hash(node, attrs, params)
|
|
48
60
|
end
|
|
49
61
|
|
|
50
62
|
######################################################################
|
data/lib/delorean/delorean.rb
CHANGED
|
@@ -329,7 +329,7 @@ module Delorean
|
|
|
329
329
|
r0 = r16
|
|
330
330
|
else
|
|
331
331
|
i25, s25 = index, []
|
|
332
|
-
r26 =
|
|
332
|
+
r26 = _nt_class_name
|
|
333
333
|
s25 << r26
|
|
334
334
|
if r26
|
|
335
335
|
if has_terminal?(':', false, index)
|
|
@@ -350,7 +350,7 @@ module Delorean
|
|
|
350
350
|
s25 << r28
|
|
351
351
|
if r28
|
|
352
352
|
i31, s31 = index, []
|
|
353
|
-
r32 =
|
|
353
|
+
r32 = _nt_class_name
|
|
354
354
|
s31 << r32
|
|
355
355
|
if r32
|
|
356
356
|
if has_terminal?('::', false, index)
|
|
@@ -376,7 +376,7 @@ module Delorean
|
|
|
376
376
|
end
|
|
377
377
|
s25 << r30
|
|
378
378
|
if r30
|
|
379
|
-
r34 =
|
|
379
|
+
r34 = _nt_class_name
|
|
380
380
|
s25 << r34
|
|
381
381
|
end
|
|
382
382
|
end
|
|
@@ -393,7 +393,7 @@ module Delorean
|
|
|
393
393
|
r0 = r25
|
|
394
394
|
else
|
|
395
395
|
i35, s35 = index, []
|
|
396
|
-
r36 =
|
|
396
|
+
r36 = _nt_class_name
|
|
397
397
|
s35 << r36
|
|
398
398
|
if r36
|
|
399
399
|
if has_terminal?(':', false, index)
|
|
@@ -428,7 +428,7 @@ module Delorean
|
|
|
428
428
|
r40 = _nt_sp
|
|
429
429
|
s38 << r40
|
|
430
430
|
if r40
|
|
431
|
-
r41 =
|
|
431
|
+
r41 = _nt_class_name
|
|
432
432
|
s38 << r41
|
|
433
433
|
if r41
|
|
434
434
|
r42 = _nt_sp
|
|
@@ -464,13 +464,13 @@ module Delorean
|
|
|
464
464
|
r0
|
|
465
465
|
end
|
|
466
466
|
|
|
467
|
-
module
|
|
467
|
+
module ClassName0
|
|
468
468
|
end
|
|
469
469
|
|
|
470
|
-
def
|
|
470
|
+
def _nt_class_name
|
|
471
471
|
start_index = index
|
|
472
|
-
if node_cache[:
|
|
473
|
-
cached = node_cache[:
|
|
472
|
+
if node_cache[:class_name].has_key?(index)
|
|
473
|
+
cached = node_cache[:class_name][index]
|
|
474
474
|
if cached
|
|
475
475
|
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
476
476
|
@index = cached.interval.end
|
|
@@ -506,13 +506,13 @@ module Delorean
|
|
|
506
506
|
end
|
|
507
507
|
if s0.last
|
|
508
508
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
509
|
-
r0.extend(
|
|
509
|
+
r0.extend(ClassName0)
|
|
510
510
|
else
|
|
511
511
|
@index = i0
|
|
512
512
|
r0 = nil
|
|
513
513
|
end
|
|
514
514
|
|
|
515
|
-
node_cache[:
|
|
515
|
+
node_cache[:class_name][start_index] = r0
|
|
516
516
|
|
|
517
517
|
r0
|
|
518
518
|
end
|
|
@@ -555,6 +555,17 @@ module Delorean
|
|
|
555
555
|
end
|
|
556
556
|
end
|
|
557
557
|
|
|
558
|
+
module Expression3
|
|
559
|
+
def v
|
|
560
|
+
elements[0]
|
|
561
|
+
end
|
|
562
|
+
|
|
563
|
+
def args
|
|
564
|
+
elements[4]
|
|
565
|
+
end
|
|
566
|
+
|
|
567
|
+
end
|
|
568
|
+
|
|
558
569
|
def _nt_expression
|
|
559
570
|
start_index = index
|
|
560
571
|
if node_cache[:expression].has_key?(index)
|
|
@@ -690,7 +701,7 @@ module Delorean
|
|
|
690
701
|
r0 = r6
|
|
691
702
|
else
|
|
692
703
|
i23, s23 = index, []
|
|
693
|
-
r24 =
|
|
704
|
+
r24 = _nt_getattr_exp
|
|
694
705
|
s23 << r24
|
|
695
706
|
if r24
|
|
696
707
|
r26 = _nt_sp
|
|
@@ -728,12 +739,77 @@ module Delorean
|
|
|
728
739
|
if r23
|
|
729
740
|
r0 = r23
|
|
730
741
|
else
|
|
731
|
-
|
|
742
|
+
i31, s31 = index, []
|
|
743
|
+
r32 = _nt_getattr_exp
|
|
744
|
+
s31 << r32
|
|
745
|
+
if r32
|
|
746
|
+
r34 = _nt_sp
|
|
747
|
+
if r34
|
|
748
|
+
r33 = r34
|
|
749
|
+
else
|
|
750
|
+
r33 = instantiate_node(SyntaxNode,input, index...index)
|
|
751
|
+
end
|
|
752
|
+
s31 << r33
|
|
753
|
+
if r33
|
|
754
|
+
if has_terminal?('[', false, index)
|
|
755
|
+
r35 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
756
|
+
@index += 1
|
|
757
|
+
else
|
|
758
|
+
terminal_parse_failure('[')
|
|
759
|
+
r35 = nil
|
|
760
|
+
end
|
|
761
|
+
s31 << r35
|
|
762
|
+
if r35
|
|
763
|
+
r37 = _nt_sp
|
|
764
|
+
if r37
|
|
765
|
+
r36 = r37
|
|
766
|
+
else
|
|
767
|
+
r36 = instantiate_node(SyntaxNode,input, index...index)
|
|
768
|
+
end
|
|
769
|
+
s31 << r36
|
|
770
|
+
if r36
|
|
771
|
+
r38 = _nt_fn_args
|
|
772
|
+
s31 << r38
|
|
773
|
+
if r38
|
|
774
|
+
r40 = _nt_sp
|
|
775
|
+
if r40
|
|
776
|
+
r39 = r40
|
|
777
|
+
else
|
|
778
|
+
r39 = instantiate_node(SyntaxNode,input, index...index)
|
|
779
|
+
end
|
|
780
|
+
s31 << r39
|
|
781
|
+
if r39
|
|
782
|
+
if has_terminal?(']', false, index)
|
|
783
|
+
r41 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
784
|
+
@index += 1
|
|
785
|
+
else
|
|
786
|
+
terminal_parse_failure(']')
|
|
787
|
+
r41 = nil
|
|
788
|
+
end
|
|
789
|
+
s31 << r41
|
|
790
|
+
end
|
|
791
|
+
end
|
|
792
|
+
end
|
|
793
|
+
end
|
|
794
|
+
end
|
|
795
|
+
end
|
|
796
|
+
if s31.last
|
|
797
|
+
r31 = instantiate_node(IndexOp,input, i31...index, s31)
|
|
798
|
+
r31.extend(Expression3)
|
|
799
|
+
else
|
|
800
|
+
@index = i31
|
|
801
|
+
r31 = nil
|
|
802
|
+
end
|
|
732
803
|
if r31
|
|
733
804
|
r0 = r31
|
|
734
805
|
else
|
|
735
|
-
|
|
736
|
-
|
|
806
|
+
r42 = _nt_getattr_exp
|
|
807
|
+
if r42
|
|
808
|
+
r0 = r42
|
|
809
|
+
else
|
|
810
|
+
@index = i0
|
|
811
|
+
r0 = nil
|
|
812
|
+
end
|
|
737
813
|
end
|
|
738
814
|
end
|
|
739
815
|
end
|
|
@@ -744,6 +820,81 @@ module Delorean
|
|
|
744
820
|
r0
|
|
745
821
|
end
|
|
746
822
|
|
|
823
|
+
module GetattrExp0
|
|
824
|
+
def identifier
|
|
825
|
+
elements[1]
|
|
826
|
+
end
|
|
827
|
+
end
|
|
828
|
+
|
|
829
|
+
module GetattrExp1
|
|
830
|
+
def v
|
|
831
|
+
elements[0]
|
|
832
|
+
end
|
|
833
|
+
|
|
834
|
+
def ga
|
|
835
|
+
elements[1]
|
|
836
|
+
end
|
|
837
|
+
end
|
|
838
|
+
|
|
839
|
+
def _nt_getattr_exp
|
|
840
|
+
start_index = index
|
|
841
|
+
if node_cache[:getattr_exp].has_key?(index)
|
|
842
|
+
cached = node_cache[:getattr_exp][index]
|
|
843
|
+
if cached
|
|
844
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
845
|
+
@index = cached.interval.end
|
|
846
|
+
end
|
|
847
|
+
return cached
|
|
848
|
+
end
|
|
849
|
+
|
|
850
|
+
i0, s0 = index, []
|
|
851
|
+
r1 = _nt_value
|
|
852
|
+
s0 << r1
|
|
853
|
+
if r1
|
|
854
|
+
s2, i2 = [], index
|
|
855
|
+
loop do
|
|
856
|
+
i3, s3 = index, []
|
|
857
|
+
if has_terminal?('.', false, index)
|
|
858
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
859
|
+
@index += 1
|
|
860
|
+
else
|
|
861
|
+
terminal_parse_failure('.')
|
|
862
|
+
r4 = nil
|
|
863
|
+
end
|
|
864
|
+
s3 << r4
|
|
865
|
+
if r4
|
|
866
|
+
r5 = _nt_identifier
|
|
867
|
+
s3 << r5
|
|
868
|
+
end
|
|
869
|
+
if s3.last
|
|
870
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
|
871
|
+
r3.extend(GetattrExp0)
|
|
872
|
+
else
|
|
873
|
+
@index = i3
|
|
874
|
+
r3 = nil
|
|
875
|
+
end
|
|
876
|
+
if r3
|
|
877
|
+
s2 << r3
|
|
878
|
+
else
|
|
879
|
+
break
|
|
880
|
+
end
|
|
881
|
+
end
|
|
882
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
|
883
|
+
s0 << r2
|
|
884
|
+
end
|
|
885
|
+
if s0.last
|
|
886
|
+
r0 = instantiate_node(ExpGetAttr,input, i0...index, s0)
|
|
887
|
+
r0.extend(GetattrExp1)
|
|
888
|
+
else
|
|
889
|
+
@index = i0
|
|
890
|
+
r0 = nil
|
|
891
|
+
end
|
|
892
|
+
|
|
893
|
+
node_cache[:getattr_exp][start_index] = r0
|
|
894
|
+
|
|
895
|
+
r0
|
|
896
|
+
end
|
|
897
|
+
|
|
747
898
|
module ListExpr0
|
|
748
899
|
def sp
|
|
749
900
|
elements[1]
|
|
@@ -1018,6 +1169,56 @@ module Delorean
|
|
|
1018
1169
|
end
|
|
1019
1170
|
|
|
1020
1171
|
module HashExpr0
|
|
1172
|
+
def sp
|
|
1173
|
+
elements[1]
|
|
1174
|
+
end
|
|
1175
|
+
|
|
1176
|
+
def ei
|
|
1177
|
+
elements[2]
|
|
1178
|
+
end
|
|
1179
|
+
|
|
1180
|
+
end
|
|
1181
|
+
|
|
1182
|
+
module HashExpr1
|
|
1183
|
+
def el
|
|
1184
|
+
elements[2]
|
|
1185
|
+
end
|
|
1186
|
+
|
|
1187
|
+
def er
|
|
1188
|
+
elements[6]
|
|
1189
|
+
end
|
|
1190
|
+
|
|
1191
|
+
def sp1
|
|
1192
|
+
elements[7]
|
|
1193
|
+
end
|
|
1194
|
+
|
|
1195
|
+
def sp2
|
|
1196
|
+
elements[9]
|
|
1197
|
+
end
|
|
1198
|
+
|
|
1199
|
+
def i
|
|
1200
|
+
elements[10]
|
|
1201
|
+
end
|
|
1202
|
+
|
|
1203
|
+
def sp3
|
|
1204
|
+
elements[11]
|
|
1205
|
+
end
|
|
1206
|
+
|
|
1207
|
+
def sp4
|
|
1208
|
+
elements[13]
|
|
1209
|
+
end
|
|
1210
|
+
|
|
1211
|
+
def e1
|
|
1212
|
+
elements[14]
|
|
1213
|
+
end
|
|
1214
|
+
|
|
1215
|
+
def ifexp
|
|
1216
|
+
elements[16]
|
|
1217
|
+
end
|
|
1218
|
+
|
|
1219
|
+
end
|
|
1220
|
+
|
|
1221
|
+
module HashExpr2
|
|
1021
1222
|
def args
|
|
1022
1223
|
elements[2]
|
|
1023
1224
|
end
|
|
@@ -1064,7 +1265,7 @@ module Delorean
|
|
|
1064
1265
|
end
|
|
1065
1266
|
s2 << r4
|
|
1066
1267
|
if r4
|
|
1067
|
-
r6 =
|
|
1268
|
+
r6 = _nt_expression
|
|
1068
1269
|
s2 << r6
|
|
1069
1270
|
if r6
|
|
1070
1271
|
r8 = _nt_sp
|
|
@@ -1075,21 +1276,138 @@ module Delorean
|
|
|
1075
1276
|
end
|
|
1076
1277
|
s2 << r7
|
|
1077
1278
|
if r7
|
|
1078
|
-
if has_terminal?('
|
|
1279
|
+
if has_terminal?(':', false, index)
|
|
1079
1280
|
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
1080
1281
|
@index += 1
|
|
1081
1282
|
else
|
|
1082
|
-
terminal_parse_failure('
|
|
1283
|
+
terminal_parse_failure(':')
|
|
1083
1284
|
r9 = nil
|
|
1084
1285
|
end
|
|
1085
1286
|
s2 << r9
|
|
1287
|
+
if r9
|
|
1288
|
+
r11 = _nt_sp
|
|
1289
|
+
if r11
|
|
1290
|
+
r10 = r11
|
|
1291
|
+
else
|
|
1292
|
+
r10 = instantiate_node(SyntaxNode,input, index...index)
|
|
1293
|
+
end
|
|
1294
|
+
s2 << r10
|
|
1295
|
+
if r10
|
|
1296
|
+
r12 = _nt_expression
|
|
1297
|
+
s2 << r12
|
|
1298
|
+
if r12
|
|
1299
|
+
r13 = _nt_sp
|
|
1300
|
+
s2 << r13
|
|
1301
|
+
if r13
|
|
1302
|
+
if has_terminal?('for', false, index)
|
|
1303
|
+
r14 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
|
1304
|
+
@index += 3
|
|
1305
|
+
else
|
|
1306
|
+
terminal_parse_failure('for')
|
|
1307
|
+
r14 = nil
|
|
1308
|
+
end
|
|
1309
|
+
s2 << r14
|
|
1310
|
+
if r14
|
|
1311
|
+
r15 = _nt_sp
|
|
1312
|
+
s2 << r15
|
|
1313
|
+
if r15
|
|
1314
|
+
r16 = _nt_identifier
|
|
1315
|
+
s2 << r16
|
|
1316
|
+
if r16
|
|
1317
|
+
r17 = _nt_sp
|
|
1318
|
+
s2 << r17
|
|
1319
|
+
if r17
|
|
1320
|
+
if has_terminal?('in', false, index)
|
|
1321
|
+
r18 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
|
1322
|
+
@index += 2
|
|
1323
|
+
else
|
|
1324
|
+
terminal_parse_failure('in')
|
|
1325
|
+
r18 = nil
|
|
1326
|
+
end
|
|
1327
|
+
s2 << r18
|
|
1328
|
+
if r18
|
|
1329
|
+
r19 = _nt_sp
|
|
1330
|
+
s2 << r19
|
|
1331
|
+
if r19
|
|
1332
|
+
r20 = _nt_expression
|
|
1333
|
+
s2 << r20
|
|
1334
|
+
if r20
|
|
1335
|
+
r22 = _nt_sp
|
|
1336
|
+
if r22
|
|
1337
|
+
r21 = r22
|
|
1338
|
+
else
|
|
1339
|
+
r21 = instantiate_node(SyntaxNode,input, index...index)
|
|
1340
|
+
end
|
|
1341
|
+
s2 << r21
|
|
1342
|
+
if r21
|
|
1343
|
+
i24, s24 = index, []
|
|
1344
|
+
if has_terminal?('if', false, index)
|
|
1345
|
+
r25 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
|
1346
|
+
@index += 2
|
|
1347
|
+
else
|
|
1348
|
+
terminal_parse_failure('if')
|
|
1349
|
+
r25 = nil
|
|
1350
|
+
end
|
|
1351
|
+
s24 << r25
|
|
1352
|
+
if r25
|
|
1353
|
+
r26 = _nt_sp
|
|
1354
|
+
s24 << r26
|
|
1355
|
+
if r26
|
|
1356
|
+
r27 = _nt_expression
|
|
1357
|
+
s24 << r27
|
|
1358
|
+
if r27
|
|
1359
|
+
r29 = _nt_sp
|
|
1360
|
+
if r29
|
|
1361
|
+
r28 = r29
|
|
1362
|
+
else
|
|
1363
|
+
r28 = instantiate_node(SyntaxNode,input, index...index)
|
|
1364
|
+
end
|
|
1365
|
+
s24 << r28
|
|
1366
|
+
end
|
|
1367
|
+
end
|
|
1368
|
+
end
|
|
1369
|
+
if s24.last
|
|
1370
|
+
r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
|
|
1371
|
+
r24.extend(HashExpr0)
|
|
1372
|
+
else
|
|
1373
|
+
@index = i24
|
|
1374
|
+
r24 = nil
|
|
1375
|
+
end
|
|
1376
|
+
if r24
|
|
1377
|
+
r23 = r24
|
|
1378
|
+
else
|
|
1379
|
+
r23 = instantiate_node(SyntaxNode,input, index...index)
|
|
1380
|
+
end
|
|
1381
|
+
s2 << r23
|
|
1382
|
+
if r23
|
|
1383
|
+
if has_terminal?('}', false, index)
|
|
1384
|
+
r30 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
1385
|
+
@index += 1
|
|
1386
|
+
else
|
|
1387
|
+
terminal_parse_failure('}')
|
|
1388
|
+
r30 = nil
|
|
1389
|
+
end
|
|
1390
|
+
s2 << r30
|
|
1391
|
+
end
|
|
1392
|
+
end
|
|
1393
|
+
end
|
|
1394
|
+
end
|
|
1395
|
+
end
|
|
1396
|
+
end
|
|
1397
|
+
end
|
|
1398
|
+
end
|
|
1399
|
+
end
|
|
1400
|
+
end
|
|
1401
|
+
end
|
|
1402
|
+
end
|
|
1403
|
+
end
|
|
1086
1404
|
end
|
|
1087
1405
|
end
|
|
1088
1406
|
end
|
|
1089
1407
|
end
|
|
1090
1408
|
if s2.last
|
|
1091
|
-
r2 = instantiate_node(
|
|
1092
|
-
r2.extend(
|
|
1409
|
+
r2 = instantiate_node(HashComprehension,input, i2...index, s2)
|
|
1410
|
+
r2.extend(HashExpr1)
|
|
1093
1411
|
else
|
|
1094
1412
|
@index = i2
|
|
1095
1413
|
r2 = nil
|
|
@@ -1097,8 +1415,60 @@ module Delorean
|
|
|
1097
1415
|
if r2
|
|
1098
1416
|
r0 = r2
|
|
1099
1417
|
else
|
|
1100
|
-
|
|
1101
|
-
|
|
1418
|
+
i31, s31 = index, []
|
|
1419
|
+
if has_terminal?('{', false, index)
|
|
1420
|
+
r32 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
1421
|
+
@index += 1
|
|
1422
|
+
else
|
|
1423
|
+
terminal_parse_failure('{')
|
|
1424
|
+
r32 = nil
|
|
1425
|
+
end
|
|
1426
|
+
s31 << r32
|
|
1427
|
+
if r32
|
|
1428
|
+
r34 = _nt_sp
|
|
1429
|
+
if r34
|
|
1430
|
+
r33 = r34
|
|
1431
|
+
else
|
|
1432
|
+
r33 = instantiate_node(SyntaxNode,input, index...index)
|
|
1433
|
+
end
|
|
1434
|
+
s31 << r33
|
|
1435
|
+
if r33
|
|
1436
|
+
r35 = _nt_hash_args
|
|
1437
|
+
s31 << r35
|
|
1438
|
+
if r35
|
|
1439
|
+
r37 = _nt_sp
|
|
1440
|
+
if r37
|
|
1441
|
+
r36 = r37
|
|
1442
|
+
else
|
|
1443
|
+
r36 = instantiate_node(SyntaxNode,input, index...index)
|
|
1444
|
+
end
|
|
1445
|
+
s31 << r36
|
|
1446
|
+
if r36
|
|
1447
|
+
if has_terminal?('}', false, index)
|
|
1448
|
+
r38 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
1449
|
+
@index += 1
|
|
1450
|
+
else
|
|
1451
|
+
terminal_parse_failure('}')
|
|
1452
|
+
r38 = nil
|
|
1453
|
+
end
|
|
1454
|
+
s31 << r38
|
|
1455
|
+
end
|
|
1456
|
+
end
|
|
1457
|
+
end
|
|
1458
|
+
end
|
|
1459
|
+
if s31.last
|
|
1460
|
+
r31 = instantiate_node(HashExpr,input, i31...index, s31)
|
|
1461
|
+
r31.extend(HashExpr2)
|
|
1462
|
+
else
|
|
1463
|
+
@index = i31
|
|
1464
|
+
r31 = nil
|
|
1465
|
+
end
|
|
1466
|
+
if r31
|
|
1467
|
+
r0 = r31
|
|
1468
|
+
else
|
|
1469
|
+
@index = i0
|
|
1470
|
+
r0 = nil
|
|
1471
|
+
end
|
|
1102
1472
|
end
|
|
1103
1473
|
end
|
|
1104
1474
|
|
|
@@ -1313,6 +1683,23 @@ module Delorean
|
|
|
1313
1683
|
end
|
|
1314
1684
|
|
|
1315
1685
|
module Value0
|
|
1686
|
+
def m
|
|
1687
|
+
elements[0]
|
|
1688
|
+
end
|
|
1689
|
+
|
|
1690
|
+
end
|
|
1691
|
+
|
|
1692
|
+
module Value1
|
|
1693
|
+
def mod
|
|
1694
|
+
elements[0]
|
|
1695
|
+
end
|
|
1696
|
+
|
|
1697
|
+
def c
|
|
1698
|
+
elements[1]
|
|
1699
|
+
end
|
|
1700
|
+
end
|
|
1701
|
+
|
|
1702
|
+
module Value2
|
|
1316
1703
|
def e
|
|
1317
1704
|
elements[2]
|
|
1318
1705
|
end
|
|
@@ -1355,84 +1742,116 @@ module Delorean
|
|
|
1355
1742
|
if r6
|
|
1356
1743
|
r0 = r6
|
|
1357
1744
|
else
|
|
1358
|
-
r7 =
|
|
1745
|
+
r7 = _nt_model_fn
|
|
1359
1746
|
if r7
|
|
1360
1747
|
r0 = r7
|
|
1361
1748
|
else
|
|
1362
|
-
r8 =
|
|
1749
|
+
r8 = _nt_identifier
|
|
1363
1750
|
if r8
|
|
1364
1751
|
r0 = r8
|
|
1365
1752
|
else
|
|
1366
|
-
r9 =
|
|
1753
|
+
r9 = _nt_list_expr
|
|
1367
1754
|
if r9
|
|
1368
1755
|
r0 = r9
|
|
1369
1756
|
else
|
|
1370
|
-
r10 =
|
|
1757
|
+
r10 = _nt_hash_expr
|
|
1371
1758
|
if r10
|
|
1372
1759
|
r0 = r10
|
|
1373
1760
|
else
|
|
1374
|
-
|
|
1761
|
+
i11, s11 = index, []
|
|
1762
|
+
i13, s13 = index, []
|
|
1763
|
+
r14 = _nt_class_name
|
|
1764
|
+
s13 << r14
|
|
1765
|
+
if r14
|
|
1766
|
+
if has_terminal?('::', false, index)
|
|
1767
|
+
r15 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
|
1768
|
+
@index += 2
|
|
1769
|
+
else
|
|
1770
|
+
terminal_parse_failure('::')
|
|
1771
|
+
r15 = nil
|
|
1772
|
+
end
|
|
1773
|
+
s13 << r15
|
|
1774
|
+
end
|
|
1775
|
+
if s13.last
|
|
1776
|
+
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
|
1777
|
+
r13.extend(Value0)
|
|
1778
|
+
else
|
|
1779
|
+
@index = i13
|
|
1780
|
+
r13 = nil
|
|
1781
|
+
end
|
|
1782
|
+
if r13
|
|
1783
|
+
r12 = r13
|
|
1784
|
+
else
|
|
1785
|
+
r12 = instantiate_node(SyntaxNode,input, index...index)
|
|
1786
|
+
end
|
|
1787
|
+
s11 << r12
|
|
1788
|
+
if r12
|
|
1789
|
+
r16 = _nt_class_name
|
|
1790
|
+
s11 << r16
|
|
1791
|
+
end
|
|
1792
|
+
if s11.last
|
|
1793
|
+
r11 = instantiate_node(NodeAsValue,input, i11...index, s11)
|
|
1794
|
+
r11.extend(Value1)
|
|
1795
|
+
else
|
|
1796
|
+
@index = i11
|
|
1797
|
+
r11 = nil
|
|
1798
|
+
end
|
|
1375
1799
|
if r11
|
|
1376
1800
|
r0 = r11
|
|
1377
1801
|
else
|
|
1378
|
-
|
|
1379
|
-
if
|
|
1380
|
-
|
|
1802
|
+
i17, s17 = index, []
|
|
1803
|
+
if has_terminal?('(', false, index)
|
|
1804
|
+
r18 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
1805
|
+
@index += 1
|
|
1381
1806
|
else
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1807
|
+
terminal_parse_failure('(')
|
|
1808
|
+
r18 = nil
|
|
1809
|
+
end
|
|
1810
|
+
s17 << r18
|
|
1811
|
+
if r18
|
|
1812
|
+
r20 = _nt_sp
|
|
1813
|
+
if r20
|
|
1814
|
+
r19 = r20
|
|
1386
1815
|
else
|
|
1387
|
-
|
|
1388
|
-
r14 = nil
|
|
1816
|
+
r19 = instantiate_node(SyntaxNode,input, index...index)
|
|
1389
1817
|
end
|
|
1390
|
-
|
|
1391
|
-
if
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
if
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1818
|
+
s17 << r19
|
|
1819
|
+
if r19
|
|
1820
|
+
r21 = _nt_expression
|
|
1821
|
+
s17 << r21
|
|
1822
|
+
if r21
|
|
1823
|
+
r23 = _nt_sp
|
|
1824
|
+
if r23
|
|
1825
|
+
r22 = r23
|
|
1826
|
+
else
|
|
1827
|
+
r22 = instantiate_node(SyntaxNode,input, index...index)
|
|
1828
|
+
end
|
|
1829
|
+
s17 << r22
|
|
1830
|
+
if r22
|
|
1831
|
+
if has_terminal?(')', false, index)
|
|
1832
|
+
r24 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
1833
|
+
@index += 1
|
|
1406
1834
|
else
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
s13 << r18
|
|
1410
|
-
if r18
|
|
1411
|
-
if has_terminal?(')', false, index)
|
|
1412
|
-
r20 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
1413
|
-
@index += 1
|
|
1414
|
-
else
|
|
1415
|
-
terminal_parse_failure(')')
|
|
1416
|
-
r20 = nil
|
|
1417
|
-
end
|
|
1418
|
-
s13 << r20
|
|
1835
|
+
terminal_parse_failure(')')
|
|
1836
|
+
r24 = nil
|
|
1419
1837
|
end
|
|
1838
|
+
s17 << r24
|
|
1420
1839
|
end
|
|
1421
1840
|
end
|
|
1422
1841
|
end
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1842
|
+
end
|
|
1843
|
+
if s17.last
|
|
1844
|
+
r17 = instantiate_node(Expr,input, i17...index, s17)
|
|
1845
|
+
r17.extend(Value2)
|
|
1846
|
+
else
|
|
1847
|
+
@index = i17
|
|
1848
|
+
r17 = nil
|
|
1849
|
+
end
|
|
1850
|
+
if r17
|
|
1851
|
+
r0 = r17
|
|
1852
|
+
else
|
|
1853
|
+
@index = i0
|
|
1854
|
+
r0 = nil
|
|
1436
1855
|
end
|
|
1437
1856
|
end
|
|
1438
1857
|
end
|
|
@@ -1456,13 +1875,6 @@ module Delorean
|
|
|
1456
1875
|
elements[0]
|
|
1457
1876
|
end
|
|
1458
1877
|
|
|
1459
|
-
end
|
|
1460
|
-
|
|
1461
|
-
module Fn1
|
|
1462
|
-
def fn
|
|
1463
|
-
elements[0]
|
|
1464
|
-
end
|
|
1465
|
-
|
|
1466
1878
|
def args
|
|
1467
1879
|
elements[3]
|
|
1468
1880
|
end
|
|
@@ -1480,107 +1892,62 @@ module Delorean
|
|
|
1480
1892
|
return cached
|
|
1481
1893
|
end
|
|
1482
1894
|
|
|
1483
|
-
i0 = index
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
if r2
|
|
1895
|
+
i0, s0 = index, []
|
|
1896
|
+
r1 = _nt_fn_name
|
|
1897
|
+
s0 << r1
|
|
1898
|
+
if r1
|
|
1488
1899
|
if has_terminal?('(', false, index)
|
|
1489
|
-
|
|
1900
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
1490
1901
|
@index += 1
|
|
1491
1902
|
else
|
|
1492
1903
|
terminal_parse_failure('(')
|
|
1493
|
-
|
|
1904
|
+
r2 = nil
|
|
1494
1905
|
end
|
|
1495
|
-
|
|
1496
|
-
if
|
|
1497
|
-
|
|
1498
|
-
if r5
|
|
1499
|
-
r4 = r5
|
|
1500
|
-
else
|
|
1501
|
-
r4 = instantiate_node(SyntaxNode,input, index...index)
|
|
1502
|
-
end
|
|
1503
|
-
s1 << r4
|
|
1906
|
+
s0 << r2
|
|
1907
|
+
if r2
|
|
1908
|
+
r4 = _nt_sp
|
|
1504
1909
|
if r4
|
|
1505
|
-
|
|
1506
|
-
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
1507
|
-
@index += 1
|
|
1508
|
-
else
|
|
1509
|
-
terminal_parse_failure(')')
|
|
1510
|
-
r6 = nil
|
|
1511
|
-
end
|
|
1512
|
-
s1 << r6
|
|
1513
|
-
end
|
|
1514
|
-
end
|
|
1515
|
-
end
|
|
1516
|
-
if s1.last
|
|
1517
|
-
r1 = instantiate_node(Fn,input, i1...index, s1)
|
|
1518
|
-
r1.extend(Fn0)
|
|
1519
|
-
else
|
|
1520
|
-
@index = i1
|
|
1521
|
-
r1 = nil
|
|
1522
|
-
end
|
|
1523
|
-
if r1
|
|
1524
|
-
r0 = r1
|
|
1525
|
-
else
|
|
1526
|
-
i7, s7 = index, []
|
|
1527
|
-
r8 = _nt_fn_name
|
|
1528
|
-
s7 << r8
|
|
1529
|
-
if r8
|
|
1530
|
-
if has_terminal?('(', false, index)
|
|
1531
|
-
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
1532
|
-
@index += 1
|
|
1910
|
+
r3 = r4
|
|
1533
1911
|
else
|
|
1534
|
-
|
|
1535
|
-
r9 = nil
|
|
1912
|
+
r3 = instantiate_node(SyntaxNode,input, index...index)
|
|
1536
1913
|
end
|
|
1537
|
-
|
|
1538
|
-
if
|
|
1539
|
-
|
|
1540
|
-
if
|
|
1541
|
-
|
|
1914
|
+
s0 << r3
|
|
1915
|
+
if r3
|
|
1916
|
+
r6 = _nt_fn_args
|
|
1917
|
+
if r6
|
|
1918
|
+
r5 = r6
|
|
1542
1919
|
else
|
|
1543
|
-
|
|
1920
|
+
r5 = instantiate_node(SyntaxNode,input, index...index)
|
|
1544
1921
|
end
|
|
1545
|
-
|
|
1546
|
-
if
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1922
|
+
s0 << r5
|
|
1923
|
+
if r5
|
|
1924
|
+
r8 = _nt_sp
|
|
1925
|
+
if r8
|
|
1926
|
+
r7 = r8
|
|
1927
|
+
else
|
|
1928
|
+
r7 = instantiate_node(SyntaxNode,input, index...index)
|
|
1929
|
+
end
|
|
1930
|
+
s0 << r7
|
|
1931
|
+
if r7
|
|
1932
|
+
if has_terminal?(')', false, index)
|
|
1933
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
1934
|
+
@index += 1
|
|
1553
1935
|
else
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
s7 << r13
|
|
1557
|
-
if r13
|
|
1558
|
-
if has_terminal?(')', false, index)
|
|
1559
|
-
r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
1560
|
-
@index += 1
|
|
1561
|
-
else
|
|
1562
|
-
terminal_parse_failure(')')
|
|
1563
|
-
r15 = nil
|
|
1564
|
-
end
|
|
1565
|
-
s7 << r15
|
|
1936
|
+
terminal_parse_failure(')')
|
|
1937
|
+
r9 = nil
|
|
1566
1938
|
end
|
|
1939
|
+
s0 << r9
|
|
1567
1940
|
end
|
|
1568
1941
|
end
|
|
1569
1942
|
end
|
|
1570
1943
|
end
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
if r7
|
|
1579
|
-
r0 = r7
|
|
1580
|
-
else
|
|
1581
|
-
@index = i0
|
|
1582
|
-
r0 = nil
|
|
1583
|
-
end
|
|
1944
|
+
end
|
|
1945
|
+
if s0.last
|
|
1946
|
+
r0 = instantiate_node(Fn,input, i0...index, s0)
|
|
1947
|
+
r0.extend(Fn0)
|
|
1948
|
+
else
|
|
1949
|
+
@index = i0
|
|
1950
|
+
r0 = nil
|
|
1584
1951
|
end
|
|
1585
1952
|
|
|
1586
1953
|
node_cache[:fn][start_index] = r0
|
|
@@ -1856,13 +2223,16 @@ module Delorean
|
|
|
1856
2223
|
end
|
|
1857
2224
|
|
|
1858
2225
|
module ModelName0
|
|
2226
|
+
def model_name
|
|
2227
|
+
elements[1]
|
|
2228
|
+
end
|
|
2229
|
+
end
|
|
2230
|
+
|
|
2231
|
+
module ModelName1
|
|
1859
2232
|
def class_name
|
|
1860
2233
|
elements[0]
|
|
1861
2234
|
end
|
|
1862
2235
|
|
|
1863
|
-
def model_name
|
|
1864
|
-
elements[2]
|
|
1865
|
-
end
|
|
1866
2236
|
end
|
|
1867
2237
|
|
|
1868
2238
|
def _nt_model_name
|
|
@@ -1876,41 +2246,43 @@ module Delorean
|
|
|
1876
2246
|
return cached
|
|
1877
2247
|
end
|
|
1878
2248
|
|
|
1879
|
-
i0 = index
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
2249
|
+
i0, s0 = index, []
|
|
2250
|
+
r1 = _nt_class_name
|
|
2251
|
+
s0 << r1
|
|
2252
|
+
if r1
|
|
2253
|
+
i3, s3 = index, []
|
|
1884
2254
|
if has_terminal?('::', false, index)
|
|
1885
|
-
|
|
2255
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
|
1886
2256
|
@index += 2
|
|
1887
2257
|
else
|
|
1888
2258
|
terminal_parse_failure('::')
|
|
2259
|
+
r4 = nil
|
|
2260
|
+
end
|
|
2261
|
+
s3 << r4
|
|
2262
|
+
if r4
|
|
2263
|
+
r5 = _nt_model_name
|
|
2264
|
+
s3 << r5
|
|
2265
|
+
end
|
|
2266
|
+
if s3.last
|
|
2267
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
|
2268
|
+
r3.extend(ModelName0)
|
|
2269
|
+
else
|
|
2270
|
+
@index = i3
|
|
1889
2271
|
r3 = nil
|
|
1890
2272
|
end
|
|
1891
|
-
s1 << r3
|
|
1892
2273
|
if r3
|
|
1893
|
-
|
|
1894
|
-
|
|
2274
|
+
r2 = r3
|
|
2275
|
+
else
|
|
2276
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
|
1895
2277
|
end
|
|
2278
|
+
s0 << r2
|
|
1896
2279
|
end
|
|
1897
|
-
if
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
else
|
|
1901
|
-
@index = i1
|
|
1902
|
-
r1 = nil
|
|
1903
|
-
end
|
|
1904
|
-
if r1
|
|
1905
|
-
r0 = r1
|
|
2280
|
+
if s0.last
|
|
2281
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2282
|
+
r0.extend(ModelName1)
|
|
1906
2283
|
else
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
r0 = r5
|
|
1910
|
-
else
|
|
1911
|
-
@index = i0
|
|
1912
|
-
r0 = nil
|
|
1913
|
-
end
|
|
2284
|
+
@index = i0
|
|
2285
|
+
r0 = nil
|
|
1914
2286
|
end
|
|
1915
2287
|
|
|
1916
2288
|
node_cache[:model_name][start_index] = r0
|
|
@@ -1971,59 +2343,6 @@ module Delorean
|
|
|
1971
2343
|
r0
|
|
1972
2344
|
end
|
|
1973
2345
|
|
|
1974
|
-
module ClassName0
|
|
1975
|
-
end
|
|
1976
|
-
|
|
1977
|
-
def _nt_class_name
|
|
1978
|
-
start_index = index
|
|
1979
|
-
if node_cache[:class_name].has_key?(index)
|
|
1980
|
-
cached = node_cache[:class_name][index]
|
|
1981
|
-
if cached
|
|
1982
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
1983
|
-
@index = cached.interval.end
|
|
1984
|
-
end
|
|
1985
|
-
return cached
|
|
1986
|
-
end
|
|
1987
|
-
|
|
1988
|
-
i0, s0 = index, []
|
|
1989
|
-
if has_terminal?('\G[A-Z]', true, index)
|
|
1990
|
-
r1 = true
|
|
1991
|
-
@index += 1
|
|
1992
|
-
else
|
|
1993
|
-
r1 = nil
|
|
1994
|
-
end
|
|
1995
|
-
s0 << r1
|
|
1996
|
-
if r1
|
|
1997
|
-
s2, i2 = [], index
|
|
1998
|
-
loop do
|
|
1999
|
-
if has_terminal?('\G[a-zA-Z0-9]', true, index)
|
|
2000
|
-
r3 = true
|
|
2001
|
-
@index += 1
|
|
2002
|
-
else
|
|
2003
|
-
r3 = nil
|
|
2004
|
-
end
|
|
2005
|
-
if r3
|
|
2006
|
-
s2 << r3
|
|
2007
|
-
else
|
|
2008
|
-
break
|
|
2009
|
-
end
|
|
2010
|
-
end
|
|
2011
|
-
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
|
2012
|
-
s0 << r2
|
|
2013
|
-
end
|
|
2014
|
-
if s0.last
|
|
2015
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2016
|
-
r0.extend(ClassName0)
|
|
2017
|
-
else
|
|
2018
|
-
@index = i0
|
|
2019
|
-
r0 = nil
|
|
2020
|
-
end
|
|
2021
|
-
|
|
2022
|
-
node_cache[:class_name][start_index] = r0
|
|
2023
|
-
|
|
2024
|
-
r0
|
|
2025
|
-
end
|
|
2026
|
-
|
|
2027
2346
|
module ScriptCall0
|
|
2028
2347
|
def m
|
|
2029
2348
|
elements[0]
|
|
@@ -2080,7 +2399,7 @@ module Delorean
|
|
|
2080
2399
|
s1 << r2
|
|
2081
2400
|
if r2
|
|
2082
2401
|
i4, s4 = index, []
|
|
2083
|
-
r5 =
|
|
2402
|
+
r5 = _nt_class_name
|
|
2084
2403
|
s4 << r5
|
|
2085
2404
|
if r5
|
|
2086
2405
|
if has_terminal?('::', false, index)
|
|
@@ -2509,171 +2828,6 @@ module Delorean
|
|
|
2509
2828
|
r0
|
|
2510
2829
|
end
|
|
2511
2830
|
|
|
2512
|
-
module NodeGetattr0
|
|
2513
|
-
def n
|
|
2514
|
-
elements[0]
|
|
2515
|
-
end
|
|
2516
|
-
|
|
2517
|
-
def i
|
|
2518
|
-
elements[2]
|
|
2519
|
-
end
|
|
2520
|
-
end
|
|
2521
|
-
|
|
2522
|
-
def _nt_node_getattr
|
|
2523
|
-
start_index = index
|
|
2524
|
-
if node_cache[:node_getattr].has_key?(index)
|
|
2525
|
-
cached = node_cache[:node_getattr][index]
|
|
2526
|
-
if cached
|
|
2527
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2528
|
-
@index = cached.interval.end
|
|
2529
|
-
end
|
|
2530
|
-
return cached
|
|
2531
|
-
end
|
|
2532
|
-
|
|
2533
|
-
i0, s0 = index, []
|
|
2534
|
-
r1 = _nt_node_name
|
|
2535
|
-
s0 << r1
|
|
2536
|
-
if r1
|
|
2537
|
-
if has_terminal?('.', false, index)
|
|
2538
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
2539
|
-
@index += 1
|
|
2540
|
-
else
|
|
2541
|
-
terminal_parse_failure('.')
|
|
2542
|
-
r2 = nil
|
|
2543
|
-
end
|
|
2544
|
-
s0 << r2
|
|
2545
|
-
if r2
|
|
2546
|
-
r3 = _nt_identifier
|
|
2547
|
-
s0 << r3
|
|
2548
|
-
end
|
|
2549
|
-
end
|
|
2550
|
-
if s0.last
|
|
2551
|
-
r0 = instantiate_node(NodeGetAttr,input, i0...index, s0)
|
|
2552
|
-
r0.extend(NodeGetattr0)
|
|
2553
|
-
else
|
|
2554
|
-
@index = i0
|
|
2555
|
-
r0 = nil
|
|
2556
|
-
end
|
|
2557
|
-
|
|
2558
|
-
node_cache[:node_getattr][start_index] = r0
|
|
2559
|
-
|
|
2560
|
-
r0
|
|
2561
|
-
end
|
|
2562
|
-
|
|
2563
|
-
module ModelFnGetattr0
|
|
2564
|
-
def mfn
|
|
2565
|
-
elements[0]
|
|
2566
|
-
end
|
|
2567
|
-
|
|
2568
|
-
def i
|
|
2569
|
-
elements[2]
|
|
2570
|
-
end
|
|
2571
|
-
end
|
|
2572
|
-
|
|
2573
|
-
def _nt_model_fn_getattr
|
|
2574
|
-
start_index = index
|
|
2575
|
-
if node_cache[:model_fn_getattr].has_key?(index)
|
|
2576
|
-
cached = node_cache[:model_fn_getattr][index]
|
|
2577
|
-
if cached
|
|
2578
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2579
|
-
@index = cached.interval.end
|
|
2580
|
-
end
|
|
2581
|
-
return cached
|
|
2582
|
-
end
|
|
2583
|
-
|
|
2584
|
-
i0, s0 = index, []
|
|
2585
|
-
r1 = _nt_model_fn
|
|
2586
|
-
s0 << r1
|
|
2587
|
-
if r1
|
|
2588
|
-
if has_terminal?('.', false, index)
|
|
2589
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
2590
|
-
@index += 1
|
|
2591
|
-
else
|
|
2592
|
-
terminal_parse_failure('.')
|
|
2593
|
-
r2 = nil
|
|
2594
|
-
end
|
|
2595
|
-
s0 << r2
|
|
2596
|
-
if r2
|
|
2597
|
-
r3 = _nt_identifier
|
|
2598
|
-
s0 << r3
|
|
2599
|
-
end
|
|
2600
|
-
end
|
|
2601
|
-
if s0.last
|
|
2602
|
-
r0 = instantiate_node(ModelFnGetAttr,input, i0...index, s0)
|
|
2603
|
-
r0.extend(ModelFnGetattr0)
|
|
2604
|
-
else
|
|
2605
|
-
@index = i0
|
|
2606
|
-
r0 = nil
|
|
2607
|
-
end
|
|
2608
|
-
|
|
2609
|
-
node_cache[:model_fn_getattr][start_index] = r0
|
|
2610
|
-
|
|
2611
|
-
r0
|
|
2612
|
-
end
|
|
2613
|
-
|
|
2614
|
-
module Getattr0
|
|
2615
|
-
def i
|
|
2616
|
-
elements[0]
|
|
2617
|
-
end
|
|
2618
|
-
|
|
2619
|
-
def ga
|
|
2620
|
-
elements[2]
|
|
2621
|
-
end
|
|
2622
|
-
end
|
|
2623
|
-
|
|
2624
|
-
def _nt_getattr
|
|
2625
|
-
start_index = index
|
|
2626
|
-
if node_cache[:getattr].has_key?(index)
|
|
2627
|
-
cached = node_cache[:getattr][index]
|
|
2628
|
-
if cached
|
|
2629
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2630
|
-
@index = cached.interval.end
|
|
2631
|
-
end
|
|
2632
|
-
return cached
|
|
2633
|
-
end
|
|
2634
|
-
|
|
2635
|
-
i0 = index
|
|
2636
|
-
i1, s1 = index, []
|
|
2637
|
-
r2 = _nt_identifier
|
|
2638
|
-
s1 << r2
|
|
2639
|
-
if r2
|
|
2640
|
-
if has_terminal?('.', false, index)
|
|
2641
|
-
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
|
2642
|
-
@index += 1
|
|
2643
|
-
else
|
|
2644
|
-
terminal_parse_failure('.')
|
|
2645
|
-
r3 = nil
|
|
2646
|
-
end
|
|
2647
|
-
s1 << r3
|
|
2648
|
-
if r3
|
|
2649
|
-
r4 = _nt_getattr
|
|
2650
|
-
s1 << r4
|
|
2651
|
-
end
|
|
2652
|
-
end
|
|
2653
|
-
if s1.last
|
|
2654
|
-
r1 = instantiate_node(GetAttr,input, i1...index, s1)
|
|
2655
|
-
r1.extend(Getattr0)
|
|
2656
|
-
else
|
|
2657
|
-
@index = i1
|
|
2658
|
-
r1 = nil
|
|
2659
|
-
end
|
|
2660
|
-
if r1
|
|
2661
|
-
r0 = r1
|
|
2662
|
-
else
|
|
2663
|
-
r5 = _nt_identifier
|
|
2664
|
-
if r5
|
|
2665
|
-
r0 = r5
|
|
2666
|
-
else
|
|
2667
|
-
@index = i0
|
|
2668
|
-
r0 = nil
|
|
2669
|
-
end
|
|
2670
|
-
end
|
|
2671
|
-
|
|
2672
|
-
node_cache[:getattr][start_index] = r0
|
|
2673
|
-
|
|
2674
|
-
r0
|
|
2675
|
-
end
|
|
2676
|
-
|
|
2677
2831
|
def _nt_number
|
|
2678
2832
|
start_index = index
|
|
2679
2833
|
if node_cache[:number].has_key?(index)
|