delorean_lang 0.0.33

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *~
19
+ *.komodoproject
20
+ .rvmrc
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in delorean.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Arman Bostani
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
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.
data/README.md ADDED
@@ -0,0 +1,145 @@
1
+ # Delorean
2
+
3
+ Delorean is a simple functional scripting language. It is used at
4
+ [PENNYMAC][] as a scripting language for a financial modeling system.
5
+
6
+ ## Installation
7
+
8
+ $ gem install delorean_lang
9
+
10
+ Or add it to your `Gemfile`, etc.
11
+
12
+ ## Usage
13
+
14
+ require 'delorean_lang'
15
+
16
+ engine = Delorean::Engine.new("MyModule")
17
+
18
+ my_code =<<eom
19
+ NodeA:
20
+ param =?
21
+ attr1 = param * 3
22
+ attr2 = attr1 + 3
23
+ attr3 = attr1 / attr2
24
+ NodeB: NodeA
25
+ attr3 = attr1 / NodeA.attr3
26
+ eom
27
+
28
+ engine.parse my_code
29
+
30
+ engine.evaluate_attrs("NodeB", %w{attr1 attr2 attr3})
31
+
32
+ ## The Delorean Language
33
+
34
+ ### Motivation
35
+
36
+ * The primary motivation for creation of Delorean was to provide a
37
+ simple scripting language for use by financial analysts.
38
+
39
+ * The scripting language needed to be tightly coupled with
40
+ Ruby. i.e. be able to query ActiveRecord models. Ruby itself was
41
+ deemed too complex for our users. Also, sand-boxing Ruby to prevent
42
+ unauthorized data access did not seem practical.
43
+
44
+ * Many of the financial models created at [PENNYMAC][] simple
45
+ modifications of earlier models. It was important for the scripting
46
+ language to provide a simple inheritance model such that major
47
+ parts of these models could be shared.
48
+
49
+ ### Concepts & Tutorial
50
+
51
+ Delorean is a [functional programming][] language. As such, it eschews
52
+ mutable data and state. There's also no concept of I/O in the classic
53
+ sense.
54
+
55
+ A Delorean script is comprised of a set of Nodes which include a
56
+ collection of attribute definitions. The following is a simple node
57
+ definition:
58
+
59
+ NodeA:
60
+ attr1 = 123
61
+ attr2 = attr1*2
62
+
63
+ In the above example, `NodeA` is a new node definition. This node
64
+ includes two attributes: `attr1` and `attr2`. `attr1` is defined to be
65
+ the integer literal `123`. `attr2` is a function which is defined as
66
+ `attr1` multiplied by 2.
67
+
68
+ Computation in Delorean happens through evaluation of node attributes.
69
+ Therefore, in the above example, `NodeA.attr2` evaluates to `246`.
70
+
71
+ Delorean attribute definitions have the following form:
72
+
73
+ attr = expression
74
+
75
+ Where `attr` is an attribute name. Attribute names are required to
76
+ match the following regular expression: `[a-z][a-zA-Z0-9_]*`. An
77
+ attribute can only be specified once in a node. Also, any attributes
78
+ it refers to in its expression must have been defined.
79
+
80
+ Delorean also provides a mechanism to provide "input" to a
81
+ computation. This is performed thorough a special kind of attribute
82
+ called a parameter. The following example shows the usage of a
83
+ parameter:
84
+
85
+ NodeB:
86
+ param =? "hello"
87
+ attr = param + " world"
88
+
89
+ In this example, `param` is defined as a parameter whose default value
90
+ is `"hello"`, which is a string literal. If we evaluate `NodeB.attr`
91
+ without providing `param`, the result will be the string `"hello
92
+ word"`. If the `param` is sent in with the value `"look out"`, then
93
+ `NodeB.attr` will evaluate to `"look out world"`.
94
+
95
+ The parameter default value is optional. If no default value if
96
+ provided for a parameter, then a value must be sent in if that
97
+ parameter is involved in a computation. Otherwise an error will
98
+ result.
99
+
100
+ An important concept in Delorean is that of node inheritance. This
101
+ mechanism allows nodes to derive functionality from previously defined
102
+ nodes. The following example shows the usage of inheritance:
103
+
104
+ USInfo:
105
+ age = ?
106
+ teen_max = 19
107
+ teen_min = 13
108
+ is_teenager = age >= teen_min && age <= teen_max
109
+
110
+ IndiaInfo: USInfo
111
+ teen_min = 10
112
+
113
+ In this example, node `USInfo` provides a definition of a
114
+ `is_teenager` when provided with an `age` parameter. Node `IndiaInfo`
115
+ is derived from `USInfo` an so it shares all of its attribute
116
+ definitions. However, the `teen_min` attribute has been overridden.
117
+ This specifies that the computation of `is_teenager` will use the
118
+ newly defined `teen_min`. Therefore, `IndiaInfo.is_teenager` with
119
+ input of `age = 10` will evaluate to `true`. Whereas,
120
+ `USInfo.is_teenager` with input of `age = 10` will evaluate to `false`.
121
+
122
+ TODO: provide details on the following topics:
123
+
124
+ * Supported data types
125
+ * Data structures (arrays and hashes)
126
+ * List comprehension
127
+ * Built-in functions
128
+ * Defining Delorean-callable class functions
129
+ * External modules
130
+
131
+ ## Implementation
132
+
133
+ This implementation of Delorean "compiles" script code to
134
+ Ruby.
135
+
136
+ TODO: provide details
137
+
138
+ ## License
139
+
140
+ Delorean has been released under the MIT license. Please check the
141
+ [LICENSE][] file for more details.
142
+
143
+ [license]: https://github.com/rubygems/rubygems.org/blob/master/MIT-LICENSE
144
+ [pennymac]: http://www.pennymacusa.com
145
+ [functional programming]: http://en.wikipedia.org/wiki/Functional_programming
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/delorean.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ require File.expand_path('../lib/delorean/version', __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["Arman Bostani"]
5
+ gem.email = ["arman.bostani@pnmac.com"]
6
+ gem.description = %q{A "compiler" for the Delorean programming language}
7
+ gem.summary = %q{Delorean compiler}
8
+ gem.homepage = "http://rubygems.org/gems/delorean_lang"
9
+
10
+ gem.files = `git ls-files`.split($\)
11
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
+ gem.name = "delorean_lang"
14
+ gem.require_paths = ["lib"]
15
+ gem.version = Delorean::VERSION
16
+
17
+ gem.add_dependency "treetop"
18
+ gem.add_dependency "activerecord", "3.2.11"
19
+ gem.add_development_dependency "rspec"
20
+ gem.add_development_dependency "sqlite3"
21
+ end
@@ -0,0 +1,54 @@
1
+ require 'delorean/functions'
2
+
3
+ module Delorean
4
+ module BaseModule
5
+
6
+ class BaseClass
7
+ # Using extend and include to get both constants and methods.
8
+ # Not sure if how to do this only with extend.
9
+ extend Delorean::Functions
10
+ include Delorean::Functions
11
+
12
+ ######################################################################
13
+
14
+ def self._get_attr(obj, attr)
15
+ return nil if obj.nil?
16
+
17
+ if obj.kind_of? ActiveRecord::Base
18
+ klass = obj.class
19
+
20
+ return obj.read_attribute(attr) if
21
+ klass.attribute_names.member? attr
22
+
23
+ return obj.send(attr.to_sym) if
24
+ klass.reflect_on_all_associations.map(&:name).member? attr.to_sym
25
+
26
+ raise InvalidGetAttribute, "ActiveRecord lookup '#{attr}' on #{obj}"
27
+ elsif obj.instance_of?(Hash)
28
+ return obj.member?(attr) ? obj[attr] : obj[attr.to_sym]
29
+ end
30
+
31
+ raise InvalidGetAttribute, "bad attribute lookup '#{attr}' on #{obj}"
32
+ end
33
+
34
+ ######################################################################
35
+
36
+ def self._script_call(node_name, mname, _e, attrs, params)
37
+ context = _e[:_engine]
38
+ node_name ||= self.name.split('::')[-1]
39
+
40
+ engine = mname ? context.get_import_engine(mname) : context
41
+
42
+ res = engine.evaluate_attrs(node_name, attrs, params)
43
+
44
+ return res[0] if attrs.length == 1
45
+
46
+ # There are more than one attrs, return hash result
47
+ Hash[* attrs.zip(res).flatten]
48
+ end
49
+
50
+ ######################################################################
51
+ end
52
+ end
53
+ end
54
+
@@ -0,0 +1,40 @@
1
+ require 'delorean/base'
2
+
3
+ module Delorean
4
+ class AbstractContainer
5
+ def initialize
6
+ @engines = {}
7
+ end
8
+
9
+ def names
10
+ @engines.keys.map {|n, v| n}
11
+ end
12
+
13
+ def get(name, version)
14
+ @engines[ [name, version] ]
15
+ end
16
+
17
+ def add(name, version, engine)
18
+ @engines[ [name, version] ] = engine
19
+ end
20
+
21
+ def import(name, version)
22
+ engine = get(name, version)
23
+
24
+ return engine if engine
25
+
26
+ if names.member? name
27
+ n, v = @engines.keys.detect {|n, v| n == name}
28
+
29
+ raise "Can't import #{name} version #{version}. " +
30
+ "Collides with imported version #{v}."
31
+ end
32
+
33
+ add(name, version, get_engine(name, version))
34
+ end
35
+
36
+ def get_engine(name, version)
37
+ raise "get_engine needs to be overriden"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,3157 @@
1
+ # Autogenerated from a Treetop grammar. Edits may be lost.
2
+
3
+
4
+ module Delorean
5
+ include Treetop::Runtime
6
+
7
+ def root
8
+ @root ||= :line
9
+ end
10
+
11
+ module Line0
12
+ end
13
+
14
+ module Line1
15
+ def f
16
+ elements[0]
17
+ end
18
+
19
+ end
20
+
21
+ def _nt_line
22
+ start_index = index
23
+ if node_cache[:line].has_key?(index)
24
+ cached = node_cache[:line][index]
25
+ if cached
26
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
27
+ @index = cached.interval.end
28
+ end
29
+ return cached
30
+ end
31
+
32
+ i0, s0 = index, []
33
+ r1 = _nt_formula
34
+ s0 << r1
35
+ if r1
36
+ r3 = _nt_sp
37
+ if r3
38
+ r2 = r3
39
+ else
40
+ r2 = instantiate_node(SyntaxNode,input, index...index)
41
+ end
42
+ s0 << r2
43
+ if r2
44
+ i5, s5 = index, []
45
+ if has_terminal?('#', false, index)
46
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
47
+ @index += 1
48
+ else
49
+ terminal_parse_failure('#')
50
+ r6 = nil
51
+ end
52
+ s5 << r6
53
+ if r6
54
+ s7, i7 = [], index
55
+ loop do
56
+ if index < input_length
57
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
58
+ @index += 1
59
+ else
60
+ terminal_parse_failure("any character")
61
+ r8 = nil
62
+ end
63
+ if r8
64
+ s7 << r8
65
+ else
66
+ break
67
+ end
68
+ end
69
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
70
+ s5 << r7
71
+ end
72
+ if s5.last
73
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
74
+ r5.extend(Line0)
75
+ else
76
+ @index = i5
77
+ r5 = nil
78
+ end
79
+ if r5
80
+ r4 = r5
81
+ else
82
+ r4 = instantiate_node(SyntaxNode,input, index...index)
83
+ end
84
+ s0 << r4
85
+ end
86
+ end
87
+ if s0.last
88
+ r0 = instantiate_node(Line,input, i0...index, s0)
89
+ r0.extend(Line1)
90
+ else
91
+ @index = i0
92
+ r0 = nil
93
+ end
94
+
95
+ node_cache[:line][start_index] = r0
96
+
97
+ r0
98
+ end
99
+
100
+ module Formula0
101
+ def sp
102
+ elements[0]
103
+ end
104
+
105
+ def i
106
+ elements[1]
107
+ end
108
+
109
+ def e
110
+ elements[5]
111
+ end
112
+ end
113
+
114
+ module Formula1
115
+ def sp
116
+ elements[0]
117
+ end
118
+
119
+ def i
120
+ elements[1]
121
+ end
122
+
123
+ end
124
+
125
+ module Formula2
126
+ def sp
127
+ elements[0]
128
+ end
129
+
130
+ def i
131
+ elements[1]
132
+ end
133
+
134
+ def e
135
+ elements[5]
136
+ end
137
+ end
138
+
139
+ module Formula3
140
+ def m
141
+ elements[0]
142
+ end
143
+
144
+ end
145
+
146
+ module Formula4
147
+ def n
148
+ elements[0]
149
+ end
150
+
151
+ def mod
152
+ elements[3]
153
+ end
154
+
155
+ def p
156
+ elements[4]
157
+ end
158
+ end
159
+
160
+ module Formula5
161
+ def n
162
+ elements[0]
163
+ end
164
+
165
+ end
166
+
167
+ module Formula6
168
+ def sp1
169
+ elements[1]
170
+ end
171
+
172
+ def n
173
+ elements[2]
174
+ end
175
+
176
+ def sp2
177
+ elements[3]
178
+ end
179
+
180
+ def v
181
+ elements[4]
182
+ end
183
+ end
184
+
185
+ def _nt_formula
186
+ start_index = index
187
+ if node_cache[:formula].has_key?(index)
188
+ cached = node_cache[:formula][index]
189
+ if cached
190
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
191
+ @index = cached.interval.end
192
+ end
193
+ return cached
194
+ end
195
+
196
+ i0 = index
197
+ i1, s1 = index, []
198
+ r2 = _nt_sp
199
+ s1 << r2
200
+ if r2
201
+ r3 = _nt_identifier
202
+ s1 << r3
203
+ if r3
204
+ r5 = _nt_sp
205
+ if r5
206
+ r4 = r5
207
+ else
208
+ r4 = instantiate_node(SyntaxNode,input, index...index)
209
+ end
210
+ s1 << r4
211
+ if r4
212
+ if has_terminal?('=?', false, index)
213
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 2))
214
+ @index += 2
215
+ else
216
+ terminal_parse_failure('=?')
217
+ r6 = nil
218
+ end
219
+ s1 << r6
220
+ if r6
221
+ r8 = _nt_sp
222
+ if r8
223
+ r7 = r8
224
+ else
225
+ r7 = instantiate_node(SyntaxNode,input, index...index)
226
+ end
227
+ s1 << r7
228
+ if r7
229
+ r9 = _nt_expression
230
+ s1 << r9
231
+ end
232
+ end
233
+ end
234
+ end
235
+ end
236
+ if s1.last
237
+ r1 = instantiate_node(ParameterDefault,input, i1...index, s1)
238
+ r1.extend(Formula0)
239
+ else
240
+ @index = i1
241
+ r1 = nil
242
+ end
243
+ if r1
244
+ r0 = r1
245
+ else
246
+ i10, s10 = index, []
247
+ r11 = _nt_sp
248
+ s10 << r11
249
+ if r11
250
+ r12 = _nt_identifier
251
+ s10 << r12
252
+ if r12
253
+ r14 = _nt_sp
254
+ if r14
255
+ r13 = r14
256
+ else
257
+ r13 = instantiate_node(SyntaxNode,input, index...index)
258
+ end
259
+ s10 << r13
260
+ if r13
261
+ if has_terminal?('=?', false, index)
262
+ r15 = instantiate_node(SyntaxNode,input, index...(index + 2))
263
+ @index += 2
264
+ else
265
+ terminal_parse_failure('=?')
266
+ r15 = nil
267
+ end
268
+ s10 << r15
269
+ end
270
+ end
271
+ end
272
+ if s10.last
273
+ r10 = instantiate_node(Parameter,input, i10...index, s10)
274
+ r10.extend(Formula1)
275
+ else
276
+ @index = i10
277
+ r10 = nil
278
+ end
279
+ if r10
280
+ r0 = r10
281
+ else
282
+ i16, s16 = index, []
283
+ r17 = _nt_sp
284
+ s16 << r17
285
+ if r17
286
+ r18 = _nt_identifier
287
+ s16 << r18
288
+ if r18
289
+ r20 = _nt_sp
290
+ if r20
291
+ r19 = r20
292
+ else
293
+ r19 = instantiate_node(SyntaxNode,input, index...index)
294
+ end
295
+ s16 << r19
296
+ if r19
297
+ if has_terminal?('=', false, index)
298
+ r21 = instantiate_node(SyntaxNode,input, index...(index + 1))
299
+ @index += 1
300
+ else
301
+ terminal_parse_failure('=')
302
+ r21 = nil
303
+ end
304
+ s16 << r21
305
+ if r21
306
+ r23 = _nt_sp
307
+ if r23
308
+ r22 = r23
309
+ else
310
+ r22 = instantiate_node(SyntaxNode,input, index...index)
311
+ end
312
+ s16 << r22
313
+ if r22
314
+ r24 = _nt_expression
315
+ s16 << r24
316
+ end
317
+ end
318
+ end
319
+ end
320
+ end
321
+ if s16.last
322
+ r16 = instantiate_node(Formula,input, i16...index, s16)
323
+ r16.extend(Formula2)
324
+ else
325
+ @index = i16
326
+ r16 = nil
327
+ end
328
+ if r16
329
+ r0 = r16
330
+ else
331
+ i25, s25 = index, []
332
+ r26 = _nt_node_name
333
+ s25 << r26
334
+ if r26
335
+ if has_terminal?(':', false, index)
336
+ r27 = instantiate_node(SyntaxNode,input, index...(index + 1))
337
+ @index += 1
338
+ else
339
+ terminal_parse_failure(':')
340
+ r27 = nil
341
+ end
342
+ s25 << r27
343
+ if r27
344
+ r29 = _nt_sp
345
+ if r29
346
+ r28 = r29
347
+ else
348
+ r28 = instantiate_node(SyntaxNode,input, index...index)
349
+ end
350
+ s25 << r28
351
+ if r28
352
+ i31, s31 = index, []
353
+ r32 = _nt_node_name
354
+ s31 << r32
355
+ if r32
356
+ if has_terminal?('::', false, index)
357
+ r33 = instantiate_node(SyntaxNode,input, index...(index + 2))
358
+ @index += 2
359
+ else
360
+ terminal_parse_failure('::')
361
+ r33 = nil
362
+ end
363
+ s31 << r33
364
+ end
365
+ if s31.last
366
+ r31 = instantiate_node(SyntaxNode,input, i31...index, s31)
367
+ r31.extend(Formula3)
368
+ else
369
+ @index = i31
370
+ r31 = nil
371
+ end
372
+ if r31
373
+ r30 = r31
374
+ else
375
+ r30 = instantiate_node(SyntaxNode,input, index...index)
376
+ end
377
+ s25 << r30
378
+ if r30
379
+ r34 = _nt_node_name
380
+ s25 << r34
381
+ end
382
+ end
383
+ end
384
+ end
385
+ if s25.last
386
+ r25 = instantiate_node(SubNode,input, i25...index, s25)
387
+ r25.extend(Formula4)
388
+ else
389
+ @index = i25
390
+ r25 = nil
391
+ end
392
+ if r25
393
+ r0 = r25
394
+ else
395
+ i35, s35 = index, []
396
+ r36 = _nt_node_name
397
+ s35 << r36
398
+ if r36
399
+ if has_terminal?(':', false, index)
400
+ r37 = instantiate_node(SyntaxNode,input, index...(index + 1))
401
+ @index += 1
402
+ else
403
+ terminal_parse_failure(':')
404
+ r37 = nil
405
+ end
406
+ s35 << r37
407
+ end
408
+ if s35.last
409
+ r35 = instantiate_node(BaseNode,input, i35...index, s35)
410
+ r35.extend(Formula5)
411
+ else
412
+ @index = i35
413
+ r35 = nil
414
+ end
415
+ if r35
416
+ r0 = r35
417
+ else
418
+ i38, s38 = index, []
419
+ if has_terminal?('import', false, index)
420
+ r39 = instantiate_node(SyntaxNode,input, index...(index + 6))
421
+ @index += 6
422
+ else
423
+ terminal_parse_failure('import')
424
+ r39 = nil
425
+ end
426
+ s38 << r39
427
+ if r39
428
+ r40 = _nt_sp
429
+ s38 << r40
430
+ if r40
431
+ r41 = _nt_node_name
432
+ s38 << r41
433
+ if r41
434
+ r42 = _nt_sp
435
+ s38 << r42
436
+ if r42
437
+ r43 = _nt_integer
438
+ s38 << r43
439
+ end
440
+ end
441
+ end
442
+ end
443
+ if s38.last
444
+ r38 = instantiate_node(Import,input, i38...index, s38)
445
+ r38.extend(Formula6)
446
+ else
447
+ @index = i38
448
+ r38 = nil
449
+ end
450
+ if r38
451
+ r0 = r38
452
+ else
453
+ @index = i0
454
+ r0 = nil
455
+ end
456
+ end
457
+ end
458
+ end
459
+ end
460
+ end
461
+
462
+ node_cache[:formula][start_index] = r0
463
+
464
+ r0
465
+ end
466
+
467
+ module NodeName0
468
+ end
469
+
470
+ def _nt_node_name
471
+ start_index = index
472
+ if node_cache[:node_name].has_key?(index)
473
+ cached = node_cache[:node_name][index]
474
+ if cached
475
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
476
+ @index = cached.interval.end
477
+ end
478
+ return cached
479
+ end
480
+
481
+ i0, s0 = index, []
482
+ if has_terminal?('\G[A-Z]', true, index)
483
+ r1 = true
484
+ @index += 1
485
+ else
486
+ r1 = nil
487
+ end
488
+ s0 << r1
489
+ if r1
490
+ s2, i2 = [], index
491
+ loop do
492
+ if has_terminal?('\G[a-zA-Z0-9_]', true, index)
493
+ r3 = true
494
+ @index += 1
495
+ else
496
+ r3 = nil
497
+ end
498
+ if r3
499
+ s2 << r3
500
+ else
501
+ break
502
+ end
503
+ end
504
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
505
+ s0 << r2
506
+ end
507
+ if s0.last
508
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
509
+ r0.extend(NodeName0)
510
+ else
511
+ @index = i0
512
+ r0 = nil
513
+ end
514
+
515
+ node_cache[:node_name][start_index] = r0
516
+
517
+ r0
518
+ end
519
+
520
+ module Expression0
521
+ def op
522
+ elements[0]
523
+ end
524
+
525
+ def e
526
+ elements[2]
527
+ end
528
+ end
529
+
530
+ module Expression1
531
+ def v
532
+ elements[2]
533
+ end
534
+
535
+ def e1
536
+ elements[6]
537
+ end
538
+
539
+ def e2
540
+ elements[10]
541
+ end
542
+ end
543
+
544
+ module Expression2
545
+ def v
546
+ elements[0]
547
+ end
548
+
549
+ def op
550
+ elements[2]
551
+ end
552
+
553
+ def e
554
+ elements[4]
555
+ end
556
+ end
557
+
558
+ def _nt_expression
559
+ start_index = index
560
+ if node_cache[:expression].has_key?(index)
561
+ cached = node_cache[:expression][index]
562
+ if cached
563
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
564
+ @index = cached.interval.end
565
+ end
566
+ return cached
567
+ end
568
+
569
+ i0 = index
570
+ i1, s1 = index, []
571
+ r2 = _nt_unary_op
572
+ s1 << r2
573
+ if r2
574
+ r4 = _nt_sp
575
+ if r4
576
+ r3 = r4
577
+ else
578
+ r3 = instantiate_node(SyntaxNode,input, index...index)
579
+ end
580
+ s1 << r3
581
+ if r3
582
+ r5 = _nt_expression
583
+ s1 << r5
584
+ end
585
+ end
586
+ if s1.last
587
+ r1 = instantiate_node(UnOp,input, i1...index, s1)
588
+ r1.extend(Expression0)
589
+ else
590
+ @index = i1
591
+ r1 = nil
592
+ end
593
+ if r1
594
+ r0 = r1
595
+ else
596
+ i6, s6 = index, []
597
+ if has_terminal?('if', false, index)
598
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
599
+ @index += 2
600
+ else
601
+ terminal_parse_failure('if')
602
+ r7 = nil
603
+ end
604
+ s6 << r7
605
+ if r7
606
+ r9 = _nt_sp
607
+ if r9
608
+ r8 = r9
609
+ else
610
+ r8 = instantiate_node(SyntaxNode,input, index...index)
611
+ end
612
+ s6 << r8
613
+ if r8
614
+ r10 = _nt_expression
615
+ s6 << r10
616
+ if r10
617
+ r12 = _nt_sp
618
+ if r12
619
+ r11 = r12
620
+ else
621
+ r11 = instantiate_node(SyntaxNode,input, index...index)
622
+ end
623
+ s6 << r11
624
+ if r11
625
+ if has_terminal?('then', false, index)
626
+ r13 = instantiate_node(SyntaxNode,input, index...(index + 4))
627
+ @index += 4
628
+ else
629
+ terminal_parse_failure('then')
630
+ r13 = nil
631
+ end
632
+ s6 << r13
633
+ if r13
634
+ r15 = _nt_sp
635
+ if r15
636
+ r14 = r15
637
+ else
638
+ r14 = instantiate_node(SyntaxNode,input, index...index)
639
+ end
640
+ s6 << r14
641
+ if r14
642
+ r16 = _nt_expression
643
+ s6 << r16
644
+ if r16
645
+ r18 = _nt_sp
646
+ if r18
647
+ r17 = r18
648
+ else
649
+ r17 = instantiate_node(SyntaxNode,input, index...index)
650
+ end
651
+ s6 << r17
652
+ if r17
653
+ if has_terminal?('else', false, index)
654
+ r19 = instantiate_node(SyntaxNode,input, index...(index + 4))
655
+ @index += 4
656
+ else
657
+ terminal_parse_failure('else')
658
+ r19 = nil
659
+ end
660
+ s6 << r19
661
+ if r19
662
+ r21 = _nt_sp
663
+ if r21
664
+ r20 = r21
665
+ else
666
+ r20 = instantiate_node(SyntaxNode,input, index...index)
667
+ end
668
+ s6 << r20
669
+ if r20
670
+ r22 = _nt_expression
671
+ s6 << r22
672
+ end
673
+ end
674
+ end
675
+ end
676
+ end
677
+ end
678
+ end
679
+ end
680
+ end
681
+ end
682
+ if s6.last
683
+ r6 = instantiate_node(IfElse,input, i6...index, s6)
684
+ r6.extend(Expression1)
685
+ else
686
+ @index = i6
687
+ r6 = nil
688
+ end
689
+ if r6
690
+ r0 = r6
691
+ else
692
+ i23, s23 = index, []
693
+ r24 = _nt_value
694
+ s23 << r24
695
+ if r24
696
+ r26 = _nt_sp
697
+ if r26
698
+ r25 = r26
699
+ else
700
+ r25 = instantiate_node(SyntaxNode,input, index...index)
701
+ end
702
+ s23 << r25
703
+ if r25
704
+ r27 = _nt_binary_op
705
+ s23 << r27
706
+ if r27
707
+ r29 = _nt_sp
708
+ if r29
709
+ r28 = r29
710
+ else
711
+ r28 = instantiate_node(SyntaxNode,input, index...index)
712
+ end
713
+ s23 << r28
714
+ if r28
715
+ r30 = _nt_expression
716
+ s23 << r30
717
+ end
718
+ end
719
+ end
720
+ end
721
+ if s23.last
722
+ r23 = instantiate_node(BinOp,input, i23...index, s23)
723
+ r23.extend(Expression2)
724
+ else
725
+ @index = i23
726
+ r23 = nil
727
+ end
728
+ if r23
729
+ r0 = r23
730
+ else
731
+ r31 = _nt_value
732
+ if r31
733
+ r0 = r31
734
+ else
735
+ @index = i0
736
+ r0 = nil
737
+ end
738
+ end
739
+ end
740
+ end
741
+
742
+ node_cache[:expression][start_index] = r0
743
+
744
+ r0
745
+ end
746
+
747
+ module ListExpr0
748
+ def sp
749
+ elements[1]
750
+ end
751
+
752
+ def e3
753
+ elements[2]
754
+ end
755
+
756
+ end
757
+
758
+ module ListExpr1
759
+ def e2
760
+ elements[2]
761
+ end
762
+
763
+ def sp1
764
+ elements[3]
765
+ end
766
+
767
+ def sp2
768
+ elements[5]
769
+ end
770
+
771
+ def i
772
+ elements[6]
773
+ end
774
+
775
+ def sp3
776
+ elements[7]
777
+ end
778
+
779
+ def sp4
780
+ elements[9]
781
+ end
782
+
783
+ def e1
784
+ elements[10]
785
+ end
786
+
787
+ def ifexp
788
+ elements[12]
789
+ end
790
+
791
+ end
792
+
793
+ module ListExpr2
794
+ def args
795
+ elements[2]
796
+ end
797
+
798
+ end
799
+
800
+ def _nt_list_expr
801
+ start_index = index
802
+ if node_cache[:list_expr].has_key?(index)
803
+ cached = node_cache[:list_expr][index]
804
+ if cached
805
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
806
+ @index = cached.interval.end
807
+ end
808
+ return cached
809
+ end
810
+
811
+ i0 = index
812
+ if has_terminal?('[]', false, index)
813
+ r1 = instantiate_node(ListExpr,input, index...(index + 2))
814
+ @index += 2
815
+ else
816
+ terminal_parse_failure('[]')
817
+ r1 = nil
818
+ end
819
+ if r1
820
+ r0 = r1
821
+ else
822
+ i2, s2 = index, []
823
+ if has_terminal?('[', false, index)
824
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
825
+ @index += 1
826
+ else
827
+ terminal_parse_failure('[')
828
+ r3 = nil
829
+ end
830
+ s2 << r3
831
+ if r3
832
+ r5 = _nt_sp
833
+ if r5
834
+ r4 = r5
835
+ else
836
+ r4 = instantiate_node(SyntaxNode,input, index...index)
837
+ end
838
+ s2 << r4
839
+ if r4
840
+ r6 = _nt_expression
841
+ s2 << r6
842
+ if r6
843
+ r7 = _nt_sp
844
+ s2 << r7
845
+ if r7
846
+ if has_terminal?('for', false, index)
847
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 3))
848
+ @index += 3
849
+ else
850
+ terminal_parse_failure('for')
851
+ r8 = nil
852
+ end
853
+ s2 << r8
854
+ if r8
855
+ r9 = _nt_sp
856
+ s2 << r9
857
+ if r9
858
+ r10 = _nt_identifier
859
+ s2 << r10
860
+ if r10
861
+ r11 = _nt_sp
862
+ s2 << r11
863
+ if r11
864
+ if has_terminal?('in', false, index)
865
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 2))
866
+ @index += 2
867
+ else
868
+ terminal_parse_failure('in')
869
+ r12 = nil
870
+ end
871
+ s2 << r12
872
+ if r12
873
+ r13 = _nt_sp
874
+ s2 << r13
875
+ if r13
876
+ r14 = _nt_expression
877
+ s2 << r14
878
+ if r14
879
+ r16 = _nt_sp
880
+ if r16
881
+ r15 = r16
882
+ else
883
+ r15 = instantiate_node(SyntaxNode,input, index...index)
884
+ end
885
+ s2 << r15
886
+ if r15
887
+ i18, s18 = index, []
888
+ if has_terminal?('if', false, index)
889
+ r19 = instantiate_node(SyntaxNode,input, index...(index + 2))
890
+ @index += 2
891
+ else
892
+ terminal_parse_failure('if')
893
+ r19 = nil
894
+ end
895
+ s18 << r19
896
+ if r19
897
+ r20 = _nt_sp
898
+ s18 << r20
899
+ if r20
900
+ r21 = _nt_expression
901
+ s18 << r21
902
+ if r21
903
+ r23 = _nt_sp
904
+ if r23
905
+ r22 = r23
906
+ else
907
+ r22 = instantiate_node(SyntaxNode,input, index...index)
908
+ end
909
+ s18 << r22
910
+ end
911
+ end
912
+ end
913
+ if s18.last
914
+ r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
915
+ r18.extend(ListExpr0)
916
+ else
917
+ @index = i18
918
+ r18 = nil
919
+ end
920
+ if r18
921
+ r17 = r18
922
+ else
923
+ r17 = instantiate_node(SyntaxNode,input, index...index)
924
+ end
925
+ s2 << r17
926
+ if r17
927
+ if has_terminal?(']', false, index)
928
+ r24 = instantiate_node(SyntaxNode,input, index...(index + 1))
929
+ @index += 1
930
+ else
931
+ terminal_parse_failure(']')
932
+ r24 = nil
933
+ end
934
+ s2 << r24
935
+ end
936
+ end
937
+ end
938
+ end
939
+ end
940
+ end
941
+ end
942
+ end
943
+ end
944
+ end
945
+ end
946
+ end
947
+ end
948
+ if s2.last
949
+ r2 = instantiate_node(ListComprehension,input, i2...index, s2)
950
+ r2.extend(ListExpr1)
951
+ else
952
+ @index = i2
953
+ r2 = nil
954
+ end
955
+ if r2
956
+ r0 = r2
957
+ else
958
+ i25, s25 = index, []
959
+ if has_terminal?('[', false, index)
960
+ r26 = instantiate_node(SyntaxNode,input, index...(index + 1))
961
+ @index += 1
962
+ else
963
+ terminal_parse_failure('[')
964
+ r26 = nil
965
+ end
966
+ s25 << r26
967
+ if r26
968
+ r28 = _nt_sp
969
+ if r28
970
+ r27 = r28
971
+ else
972
+ r27 = instantiate_node(SyntaxNode,input, index...index)
973
+ end
974
+ s25 << r27
975
+ if r27
976
+ r29 = _nt_fn_args
977
+ s25 << r29
978
+ if r29
979
+ r31 = _nt_sp
980
+ if r31
981
+ r30 = r31
982
+ else
983
+ r30 = instantiate_node(SyntaxNode,input, index...index)
984
+ end
985
+ s25 << r30
986
+ if r30
987
+ if has_terminal?(']', false, index)
988
+ r32 = instantiate_node(SyntaxNode,input, index...(index + 1))
989
+ @index += 1
990
+ else
991
+ terminal_parse_failure(']')
992
+ r32 = nil
993
+ end
994
+ s25 << r32
995
+ end
996
+ end
997
+ end
998
+ end
999
+ if s25.last
1000
+ r25 = instantiate_node(ListExpr,input, i25...index, s25)
1001
+ r25.extend(ListExpr2)
1002
+ else
1003
+ @index = i25
1004
+ r25 = nil
1005
+ end
1006
+ if r25
1007
+ r0 = r25
1008
+ else
1009
+ @index = i0
1010
+ r0 = nil
1011
+ end
1012
+ end
1013
+ end
1014
+
1015
+ node_cache[:list_expr][start_index] = r0
1016
+
1017
+ r0
1018
+ end
1019
+
1020
+ module HashExpr0
1021
+ def args
1022
+ elements[2]
1023
+ end
1024
+
1025
+ end
1026
+
1027
+ def _nt_hash_expr
1028
+ start_index = index
1029
+ if node_cache[:hash_expr].has_key?(index)
1030
+ cached = node_cache[:hash_expr][index]
1031
+ if cached
1032
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1033
+ @index = cached.interval.end
1034
+ end
1035
+ return cached
1036
+ end
1037
+
1038
+ i0 = index
1039
+ if has_terminal?('{}', false, index)
1040
+ r1 = instantiate_node(HashExpr,input, index...(index + 2))
1041
+ @index += 2
1042
+ else
1043
+ terminal_parse_failure('{}')
1044
+ r1 = nil
1045
+ end
1046
+ if r1
1047
+ r0 = r1
1048
+ else
1049
+ i2, s2 = index, []
1050
+ if has_terminal?('{', false, index)
1051
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
1052
+ @index += 1
1053
+ else
1054
+ terminal_parse_failure('{')
1055
+ r3 = nil
1056
+ end
1057
+ s2 << r3
1058
+ if r3
1059
+ r5 = _nt_sp
1060
+ if r5
1061
+ r4 = r5
1062
+ else
1063
+ r4 = instantiate_node(SyntaxNode,input, index...index)
1064
+ end
1065
+ s2 << r4
1066
+ if r4
1067
+ r6 = _nt_hash_args
1068
+ s2 << r6
1069
+ if r6
1070
+ r8 = _nt_sp
1071
+ if r8
1072
+ r7 = r8
1073
+ else
1074
+ r7 = instantiate_node(SyntaxNode,input, index...index)
1075
+ end
1076
+ s2 << r7
1077
+ if r7
1078
+ if has_terminal?('}', false, index)
1079
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
1080
+ @index += 1
1081
+ else
1082
+ terminal_parse_failure('}')
1083
+ r9 = nil
1084
+ end
1085
+ s2 << r9
1086
+ end
1087
+ end
1088
+ end
1089
+ end
1090
+ if s2.last
1091
+ r2 = instantiate_node(HashExpr,input, i2...index, s2)
1092
+ r2.extend(HashExpr0)
1093
+ else
1094
+ @index = i2
1095
+ r2 = nil
1096
+ end
1097
+ if r2
1098
+ r0 = r2
1099
+ else
1100
+ @index = i0
1101
+ r0 = nil
1102
+ end
1103
+ end
1104
+
1105
+ node_cache[:hash_expr][start_index] = r0
1106
+
1107
+ r0
1108
+ end
1109
+
1110
+ def _nt_binary_op
1111
+ start_index = index
1112
+ if node_cache[:binary_op].has_key?(index)
1113
+ cached = node_cache[:binary_op][index]
1114
+ if cached
1115
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1116
+ @index = cached.interval.end
1117
+ end
1118
+ return cached
1119
+ end
1120
+
1121
+ i0 = index
1122
+ if has_terminal?('+', false, index)
1123
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
1124
+ @index += 1
1125
+ else
1126
+ terminal_parse_failure('+')
1127
+ r1 = nil
1128
+ end
1129
+ if r1
1130
+ r0 = r1
1131
+ else
1132
+ if has_terminal?('-', false, index)
1133
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
1134
+ @index += 1
1135
+ else
1136
+ terminal_parse_failure('-')
1137
+ r2 = nil
1138
+ end
1139
+ if r2
1140
+ r0 = r2
1141
+ else
1142
+ if has_terminal?('*', false, index)
1143
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
1144
+ @index += 1
1145
+ else
1146
+ terminal_parse_failure('*')
1147
+ r3 = nil
1148
+ end
1149
+ if r3
1150
+ r0 = r3
1151
+ else
1152
+ if has_terminal?('/', false, index)
1153
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
1154
+ @index += 1
1155
+ else
1156
+ terminal_parse_failure('/')
1157
+ r4 = nil
1158
+ end
1159
+ if r4
1160
+ r0 = r4
1161
+ else
1162
+ if has_terminal?('%', false, index)
1163
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
1164
+ @index += 1
1165
+ else
1166
+ terminal_parse_failure('%')
1167
+ r5 = nil
1168
+ end
1169
+ if r5
1170
+ r0 = r5
1171
+ else
1172
+ if has_terminal?('==', false, index)
1173
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 2))
1174
+ @index += 2
1175
+ else
1176
+ terminal_parse_failure('==')
1177
+ r6 = nil
1178
+ end
1179
+ if r6
1180
+ r0 = r6
1181
+ else
1182
+ if has_terminal?('!=', false, index)
1183
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
1184
+ @index += 2
1185
+ else
1186
+ terminal_parse_failure('!=')
1187
+ r7 = nil
1188
+ end
1189
+ if r7
1190
+ r0 = r7
1191
+ else
1192
+ if has_terminal?('>=', false, index)
1193
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 2))
1194
+ @index += 2
1195
+ else
1196
+ terminal_parse_failure('>=')
1197
+ r8 = nil
1198
+ end
1199
+ if r8
1200
+ r0 = r8
1201
+ else
1202
+ if has_terminal?('<=', false, index)
1203
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 2))
1204
+ @index += 2
1205
+ else
1206
+ terminal_parse_failure('<=')
1207
+ r9 = nil
1208
+ end
1209
+ if r9
1210
+ r0 = r9
1211
+ else
1212
+ if has_terminal?('>', false, index)
1213
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
1214
+ @index += 1
1215
+ else
1216
+ terminal_parse_failure('>')
1217
+ r10 = nil
1218
+ end
1219
+ if r10
1220
+ r0 = r10
1221
+ else
1222
+ if has_terminal?('<', false, index)
1223
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
1224
+ @index += 1
1225
+ else
1226
+ terminal_parse_failure('<')
1227
+ r11 = nil
1228
+ end
1229
+ if r11
1230
+ r0 = r11
1231
+ else
1232
+ if has_terminal?('&&', false, index)
1233
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 2))
1234
+ @index += 2
1235
+ else
1236
+ terminal_parse_failure('&&')
1237
+ r12 = nil
1238
+ end
1239
+ if r12
1240
+ r0 = r12
1241
+ else
1242
+ if has_terminal?('||', false, index)
1243
+ r13 = instantiate_node(SyntaxNode,input, index...(index + 2))
1244
+ @index += 2
1245
+ else
1246
+ terminal_parse_failure('||')
1247
+ r13 = nil
1248
+ end
1249
+ if r13
1250
+ r0 = r13
1251
+ else
1252
+ @index = i0
1253
+ r0 = nil
1254
+ end
1255
+ end
1256
+ end
1257
+ end
1258
+ end
1259
+ end
1260
+ end
1261
+ end
1262
+ end
1263
+ end
1264
+ end
1265
+ end
1266
+ end
1267
+
1268
+ node_cache[:binary_op][start_index] = r0
1269
+
1270
+ r0
1271
+ end
1272
+
1273
+ def _nt_unary_op
1274
+ start_index = index
1275
+ if node_cache[:unary_op].has_key?(index)
1276
+ cached = node_cache[:unary_op][index]
1277
+ if cached
1278
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1279
+ @index = cached.interval.end
1280
+ end
1281
+ return cached
1282
+ end
1283
+
1284
+ i0 = index
1285
+ if has_terminal?('!', false, index)
1286
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
1287
+ @index += 1
1288
+ else
1289
+ terminal_parse_failure('!')
1290
+ r1 = nil
1291
+ end
1292
+ if r1
1293
+ r0 = r1
1294
+ else
1295
+ if has_terminal?('-', false, index)
1296
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
1297
+ @index += 1
1298
+ else
1299
+ terminal_parse_failure('-')
1300
+ r2 = nil
1301
+ end
1302
+ if r2
1303
+ r0 = r2
1304
+ else
1305
+ @index = i0
1306
+ r0 = nil
1307
+ end
1308
+ end
1309
+
1310
+ node_cache[:unary_op][start_index] = r0
1311
+
1312
+ r0
1313
+ end
1314
+
1315
+ module Value0
1316
+ def e
1317
+ elements[2]
1318
+ end
1319
+
1320
+ end
1321
+
1322
+ def _nt_value
1323
+ start_index = index
1324
+ if node_cache[:value].has_key?(index)
1325
+ cached = node_cache[:value][index]
1326
+ if cached
1327
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1328
+ @index = cached.interval.end
1329
+ end
1330
+ return cached
1331
+ end
1332
+
1333
+ i0 = index
1334
+ r1 = _nt_number
1335
+ if r1
1336
+ r0 = r1
1337
+ else
1338
+ r2 = _nt_string
1339
+ if r2
1340
+ r0 = r2
1341
+ else
1342
+ r3 = _nt_boolean
1343
+ if r3
1344
+ r0 = r3
1345
+ else
1346
+ r4 = _nt_nil_val
1347
+ if r4
1348
+ r0 = r4
1349
+ else
1350
+ r5 = _nt_script_call
1351
+ if r5
1352
+ r0 = r5
1353
+ else
1354
+ r6 = _nt_fn
1355
+ if r6
1356
+ r0 = r6
1357
+ else
1358
+ r7 = _nt_model_fn_getattr
1359
+ if r7
1360
+ r0 = r7
1361
+ else
1362
+ r8 = _nt_model_fn
1363
+ if r8
1364
+ r0 = r8
1365
+ else
1366
+ r9 = _nt_node_getattr
1367
+ if r9
1368
+ r0 = r9
1369
+ else
1370
+ r10 = _nt_getattr
1371
+ if r10
1372
+ r0 = r10
1373
+ else
1374
+ r11 = _nt_list_expr
1375
+ if r11
1376
+ r0 = r11
1377
+ else
1378
+ r12 = _nt_hash_expr
1379
+ if r12
1380
+ r0 = r12
1381
+ else
1382
+ i13, s13 = index, []
1383
+ if has_terminal?('(', false, index)
1384
+ r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
1385
+ @index += 1
1386
+ else
1387
+ terminal_parse_failure('(')
1388
+ r14 = nil
1389
+ end
1390
+ s13 << r14
1391
+ if r14
1392
+ r16 = _nt_sp
1393
+ if r16
1394
+ r15 = r16
1395
+ else
1396
+ r15 = instantiate_node(SyntaxNode,input, index...index)
1397
+ end
1398
+ s13 << r15
1399
+ if r15
1400
+ r17 = _nt_expression
1401
+ s13 << r17
1402
+ if r17
1403
+ r19 = _nt_sp
1404
+ if r19
1405
+ r18 = r19
1406
+ else
1407
+ r18 = instantiate_node(SyntaxNode,input, index...index)
1408
+ end
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
1419
+ end
1420
+ end
1421
+ end
1422
+ end
1423
+ if s13.last
1424
+ r13 = instantiate_node(Expr,input, i13...index, s13)
1425
+ r13.extend(Value0)
1426
+ else
1427
+ @index = i13
1428
+ r13 = nil
1429
+ end
1430
+ if r13
1431
+ r0 = r13
1432
+ else
1433
+ @index = i0
1434
+ r0 = nil
1435
+ end
1436
+ end
1437
+ end
1438
+ end
1439
+ end
1440
+ end
1441
+ end
1442
+ end
1443
+ end
1444
+ end
1445
+ end
1446
+ end
1447
+ end
1448
+
1449
+ node_cache[:value][start_index] = r0
1450
+
1451
+ r0
1452
+ end
1453
+
1454
+ module Fn0
1455
+ def fn
1456
+ elements[0]
1457
+ end
1458
+
1459
+ end
1460
+
1461
+ module Fn1
1462
+ def fn
1463
+ elements[0]
1464
+ end
1465
+
1466
+ def args
1467
+ elements[3]
1468
+ end
1469
+
1470
+ end
1471
+
1472
+ def _nt_fn
1473
+ start_index = index
1474
+ if node_cache[:fn].has_key?(index)
1475
+ cached = node_cache[:fn][index]
1476
+ if cached
1477
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1478
+ @index = cached.interval.end
1479
+ end
1480
+ return cached
1481
+ end
1482
+
1483
+ i0 = index
1484
+ i1, s1 = index, []
1485
+ r2 = _nt_fn_name
1486
+ s1 << r2
1487
+ if r2
1488
+ if has_terminal?('(', false, index)
1489
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
1490
+ @index += 1
1491
+ else
1492
+ terminal_parse_failure('(')
1493
+ r3 = nil
1494
+ end
1495
+ s1 << r3
1496
+ if r3
1497
+ r5 = _nt_sp
1498
+ if r5
1499
+ r4 = r5
1500
+ else
1501
+ r4 = instantiate_node(SyntaxNode,input, index...index)
1502
+ end
1503
+ s1 << r4
1504
+ if r4
1505
+ if has_terminal?(')', false, index)
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
1533
+ else
1534
+ terminal_parse_failure('(')
1535
+ r9 = nil
1536
+ end
1537
+ s7 << r9
1538
+ if r9
1539
+ r11 = _nt_sp
1540
+ if r11
1541
+ r10 = r11
1542
+ else
1543
+ r10 = instantiate_node(SyntaxNode,input, index...index)
1544
+ end
1545
+ s7 << r10
1546
+ if r10
1547
+ r12 = _nt_fn_args
1548
+ s7 << r12
1549
+ if r12
1550
+ r14 = _nt_sp
1551
+ if r14
1552
+ r13 = r14
1553
+ else
1554
+ r13 = instantiate_node(SyntaxNode,input, index...index)
1555
+ end
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
1566
+ end
1567
+ end
1568
+ end
1569
+ end
1570
+ end
1571
+ if s7.last
1572
+ r7 = instantiate_node(Fn,input, i7...index, s7)
1573
+ r7.extend(Fn1)
1574
+ else
1575
+ @index = i7
1576
+ r7 = nil
1577
+ end
1578
+ if r7
1579
+ r0 = r7
1580
+ else
1581
+ @index = i0
1582
+ r0 = nil
1583
+ end
1584
+ end
1585
+
1586
+ node_cache[:fn][start_index] = r0
1587
+
1588
+ r0
1589
+ end
1590
+
1591
+ module FnArgs0
1592
+ def args
1593
+ elements[3]
1594
+ end
1595
+ end
1596
+
1597
+ module FnArgs1
1598
+ def arg0
1599
+ elements[0]
1600
+ end
1601
+
1602
+ def args_rest
1603
+ elements[1]
1604
+ end
1605
+ end
1606
+
1607
+ def _nt_fn_args
1608
+ start_index = index
1609
+ if node_cache[:fn_args].has_key?(index)
1610
+ cached = node_cache[:fn_args][index]
1611
+ if cached
1612
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1613
+ @index = cached.interval.end
1614
+ end
1615
+ return cached
1616
+ end
1617
+
1618
+ i0, s0 = index, []
1619
+ r1 = _nt_expression
1620
+ s0 << r1
1621
+ if r1
1622
+ i3, s3 = index, []
1623
+ r5 = _nt_sp
1624
+ if r5
1625
+ r4 = r5
1626
+ else
1627
+ r4 = instantiate_node(SyntaxNode,input, index...index)
1628
+ end
1629
+ s3 << r4
1630
+ if r4
1631
+ if has_terminal?(',', false, index)
1632
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
1633
+ @index += 1
1634
+ else
1635
+ terminal_parse_failure(',')
1636
+ r6 = nil
1637
+ end
1638
+ s3 << r6
1639
+ if r6
1640
+ r8 = _nt_sp
1641
+ if r8
1642
+ r7 = r8
1643
+ else
1644
+ r7 = instantiate_node(SyntaxNode,input, index...index)
1645
+ end
1646
+ s3 << r7
1647
+ if r7
1648
+ r10 = _nt_fn_args
1649
+ if r10
1650
+ r9 = r10
1651
+ else
1652
+ r9 = instantiate_node(SyntaxNode,input, index...index)
1653
+ end
1654
+ s3 << r9
1655
+ end
1656
+ end
1657
+ end
1658
+ if s3.last
1659
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1660
+ r3.extend(FnArgs0)
1661
+ else
1662
+ @index = i3
1663
+ r3 = nil
1664
+ end
1665
+ if r3
1666
+ r2 = r3
1667
+ else
1668
+ r2 = instantiate_node(SyntaxNode,input, index...index)
1669
+ end
1670
+ s0 << r2
1671
+ end
1672
+ if s0.last
1673
+ r0 = instantiate_node(FnArgs,input, i0...index, s0)
1674
+ r0.extend(FnArgs1)
1675
+ else
1676
+ @index = i0
1677
+ r0 = nil
1678
+ end
1679
+
1680
+ node_cache[:fn_args][start_index] = r0
1681
+
1682
+ r0
1683
+ end
1684
+
1685
+ module ModelFn0
1686
+ def m
1687
+ elements[0]
1688
+ end
1689
+
1690
+ def fn
1691
+ elements[2]
1692
+ end
1693
+
1694
+ end
1695
+
1696
+ module ModelFn1
1697
+ def m
1698
+ elements[0]
1699
+ end
1700
+
1701
+ def fn
1702
+ elements[2]
1703
+ end
1704
+
1705
+ def args
1706
+ elements[5]
1707
+ end
1708
+
1709
+ end
1710
+
1711
+ def _nt_model_fn
1712
+ start_index = index
1713
+ if node_cache[:model_fn].has_key?(index)
1714
+ cached = node_cache[:model_fn][index]
1715
+ if cached
1716
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1717
+ @index = cached.interval.end
1718
+ end
1719
+ return cached
1720
+ end
1721
+
1722
+ i0 = index
1723
+ i1, s1 = index, []
1724
+ r2 = _nt_model_name
1725
+ s1 << r2
1726
+ if r2
1727
+ if has_terminal?('.', false, index)
1728
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
1729
+ @index += 1
1730
+ else
1731
+ terminal_parse_failure('.')
1732
+ r3 = nil
1733
+ end
1734
+ s1 << r3
1735
+ if r3
1736
+ r4 = _nt_identifier
1737
+ s1 << r4
1738
+ if r4
1739
+ if has_terminal?('(', false, index)
1740
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
1741
+ @index += 1
1742
+ else
1743
+ terminal_parse_failure('(')
1744
+ r5 = nil
1745
+ end
1746
+ s1 << r5
1747
+ if r5
1748
+ r7 = _nt_sp
1749
+ if r7
1750
+ r6 = r7
1751
+ else
1752
+ r6 = instantiate_node(SyntaxNode,input, index...index)
1753
+ end
1754
+ s1 << r6
1755
+ if r6
1756
+ if has_terminal?(')', false, index)
1757
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
1758
+ @index += 1
1759
+ else
1760
+ terminal_parse_failure(')')
1761
+ r8 = nil
1762
+ end
1763
+ s1 << r8
1764
+ end
1765
+ end
1766
+ end
1767
+ end
1768
+ end
1769
+ if s1.last
1770
+ r1 = instantiate_node(ModelFn,input, i1...index, s1)
1771
+ r1.extend(ModelFn0)
1772
+ else
1773
+ @index = i1
1774
+ r1 = nil
1775
+ end
1776
+ if r1
1777
+ r0 = r1
1778
+ else
1779
+ i9, s9 = index, []
1780
+ r10 = _nt_model_name
1781
+ s9 << r10
1782
+ if r10
1783
+ if has_terminal?('.', false, index)
1784
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
1785
+ @index += 1
1786
+ else
1787
+ terminal_parse_failure('.')
1788
+ r11 = nil
1789
+ end
1790
+ s9 << r11
1791
+ if r11
1792
+ r12 = _nt_identifier
1793
+ s9 << r12
1794
+ if r12
1795
+ if has_terminal?('(', false, index)
1796
+ r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
1797
+ @index += 1
1798
+ else
1799
+ terminal_parse_failure('(')
1800
+ r13 = nil
1801
+ end
1802
+ s9 << r13
1803
+ if r13
1804
+ r15 = _nt_sp
1805
+ if r15
1806
+ r14 = r15
1807
+ else
1808
+ r14 = instantiate_node(SyntaxNode,input, index...index)
1809
+ end
1810
+ s9 << r14
1811
+ if r14
1812
+ r16 = _nt_fn_args
1813
+ s9 << r16
1814
+ if r16
1815
+ r18 = _nt_sp
1816
+ if r18
1817
+ r17 = r18
1818
+ else
1819
+ r17 = instantiate_node(SyntaxNode,input, index...index)
1820
+ end
1821
+ s9 << r17
1822
+ if r17
1823
+ if has_terminal?(')', false, index)
1824
+ r19 = instantiate_node(SyntaxNode,input, index...(index + 1))
1825
+ @index += 1
1826
+ else
1827
+ terminal_parse_failure(')')
1828
+ r19 = nil
1829
+ end
1830
+ s9 << r19
1831
+ end
1832
+ end
1833
+ end
1834
+ end
1835
+ end
1836
+ end
1837
+ end
1838
+ if s9.last
1839
+ r9 = instantiate_node(ModelFn,input, i9...index, s9)
1840
+ r9.extend(ModelFn1)
1841
+ else
1842
+ @index = i9
1843
+ r9 = nil
1844
+ end
1845
+ if r9
1846
+ r0 = r9
1847
+ else
1848
+ @index = i0
1849
+ r0 = nil
1850
+ end
1851
+ end
1852
+
1853
+ node_cache[:model_fn][start_index] = r0
1854
+
1855
+ r0
1856
+ end
1857
+
1858
+ module ModelName0
1859
+ def class_name
1860
+ elements[0]
1861
+ end
1862
+
1863
+ def model_name
1864
+ elements[2]
1865
+ end
1866
+ end
1867
+
1868
+ def _nt_model_name
1869
+ start_index = index
1870
+ if node_cache[:model_name].has_key?(index)
1871
+ cached = node_cache[:model_name][index]
1872
+ if cached
1873
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1874
+ @index = cached.interval.end
1875
+ end
1876
+ return cached
1877
+ end
1878
+
1879
+ i0 = index
1880
+ i1, s1 = index, []
1881
+ r2 = _nt_class_name
1882
+ s1 << r2
1883
+ if r2
1884
+ if has_terminal?('::', false, index)
1885
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
1886
+ @index += 2
1887
+ else
1888
+ terminal_parse_failure('::')
1889
+ r3 = nil
1890
+ end
1891
+ s1 << r3
1892
+ if r3
1893
+ r4 = _nt_model_name
1894
+ s1 << r4
1895
+ end
1896
+ end
1897
+ if s1.last
1898
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1899
+ r1.extend(ModelName0)
1900
+ else
1901
+ @index = i1
1902
+ r1 = nil
1903
+ end
1904
+ if r1
1905
+ r0 = r1
1906
+ else
1907
+ r5 = _nt_class_name
1908
+ if r5
1909
+ r0 = r5
1910
+ else
1911
+ @index = i0
1912
+ r0 = nil
1913
+ end
1914
+ end
1915
+
1916
+ node_cache[:model_name][start_index] = r0
1917
+
1918
+ r0
1919
+ end
1920
+
1921
+ module FnName0
1922
+ end
1923
+
1924
+ def _nt_fn_name
1925
+ start_index = index
1926
+ if node_cache[:fn_name].has_key?(index)
1927
+ cached = node_cache[:fn_name][index]
1928
+ if cached
1929
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1930
+ @index = cached.interval.end
1931
+ end
1932
+ return cached
1933
+ end
1934
+
1935
+ i0, s0 = index, []
1936
+ if has_terminal?('\G[A-Z]', true, index)
1937
+ r1 = true
1938
+ @index += 1
1939
+ else
1940
+ r1 = nil
1941
+ end
1942
+ s0 << r1
1943
+ if r1
1944
+ s2, i2 = [], index
1945
+ loop do
1946
+ if has_terminal?('\G[A-Z0-9]', true, index)
1947
+ r3 = true
1948
+ @index += 1
1949
+ else
1950
+ r3 = nil
1951
+ end
1952
+ if r3
1953
+ s2 << r3
1954
+ else
1955
+ break
1956
+ end
1957
+ end
1958
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1959
+ s0 << r2
1960
+ end
1961
+ if s0.last
1962
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1963
+ r0.extend(FnName0)
1964
+ else
1965
+ @index = i0
1966
+ r0 = nil
1967
+ end
1968
+
1969
+ node_cache[:fn_name][start_index] = r0
1970
+
1971
+ r0
1972
+ end
1973
+
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
+ module ScriptCall0
2028
+ def m
2029
+ elements[0]
2030
+ end
2031
+
2032
+ end
2033
+
2034
+ module ScriptCall1
2035
+ def mod
2036
+ elements[1]
2037
+ end
2038
+
2039
+ def c
2040
+ elements[2]
2041
+ end
2042
+
2043
+ def al
2044
+ elements[5]
2045
+ end
2046
+
2047
+ end
2048
+
2049
+ module ScriptCall2
2050
+ def i
2051
+ elements[1]
2052
+ end
2053
+
2054
+ def al
2055
+ elements[4]
2056
+ end
2057
+
2058
+ end
2059
+
2060
+ def _nt_script_call
2061
+ start_index = index
2062
+ if node_cache[:script_call].has_key?(index)
2063
+ cached = node_cache[:script_call][index]
2064
+ if cached
2065
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2066
+ @index = cached.interval.end
2067
+ end
2068
+ return cached
2069
+ end
2070
+
2071
+ i0 = index
2072
+ i1, s1 = index, []
2073
+ if has_terminal?('@', false, index)
2074
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
2075
+ @index += 1
2076
+ else
2077
+ terminal_parse_failure('@')
2078
+ r2 = nil
2079
+ end
2080
+ s1 << r2
2081
+ if r2
2082
+ i4, s4 = index, []
2083
+ r5 = _nt_node_name
2084
+ s4 << r5
2085
+ if r5
2086
+ if has_terminal?('::', false, index)
2087
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 2))
2088
+ @index += 2
2089
+ else
2090
+ terminal_parse_failure('::')
2091
+ r6 = nil
2092
+ end
2093
+ s4 << r6
2094
+ end
2095
+ if s4.last
2096
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
2097
+ r4.extend(ScriptCall0)
2098
+ else
2099
+ @index = i4
2100
+ r4 = nil
2101
+ end
2102
+ if r4
2103
+ r3 = r4
2104
+ else
2105
+ r3 = instantiate_node(SyntaxNode,input, index...index)
2106
+ end
2107
+ s1 << r3
2108
+ if r3
2109
+ r7 = _nt_class_name
2110
+ s1 << r7
2111
+ if r7
2112
+ if has_terminal?('(', false, index)
2113
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
2114
+ @index += 1
2115
+ else
2116
+ terminal_parse_failure('(')
2117
+ r8 = nil
2118
+ end
2119
+ s1 << r8
2120
+ if r8
2121
+ r10 = _nt_sp
2122
+ if r10
2123
+ r9 = r10
2124
+ else
2125
+ r9 = instantiate_node(SyntaxNode,input, index...index)
2126
+ end
2127
+ s1 << r9
2128
+ if r9
2129
+ r11 = _nt_kw_args
2130
+ s1 << r11
2131
+ if r11
2132
+ r13 = _nt_sp
2133
+ if r13
2134
+ r12 = r13
2135
+ else
2136
+ r12 = instantiate_node(SyntaxNode,input, index...index)
2137
+ end
2138
+ s1 << r12
2139
+ if r12
2140
+ if has_terminal?(')', false, index)
2141
+ r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
2142
+ @index += 1
2143
+ else
2144
+ terminal_parse_failure(')')
2145
+ r14 = nil
2146
+ end
2147
+ s1 << r14
2148
+ end
2149
+ end
2150
+ end
2151
+ end
2152
+ end
2153
+ end
2154
+ end
2155
+ if s1.last
2156
+ r1 = instantiate_node(ScriptCallNode,input, i1...index, s1)
2157
+ r1.extend(ScriptCall1)
2158
+ else
2159
+ @index = i1
2160
+ r1 = nil
2161
+ end
2162
+ if r1
2163
+ r0 = r1
2164
+ else
2165
+ i15, s15 = index, []
2166
+ if has_terminal?('@', false, index)
2167
+ r16 = instantiate_node(SyntaxNode,input, index...(index + 1))
2168
+ @index += 1
2169
+ else
2170
+ terminal_parse_failure('@')
2171
+ r16 = nil
2172
+ end
2173
+ s15 << r16
2174
+ if r16
2175
+ r18 = _nt_identifier
2176
+ if r18
2177
+ r17 = r18
2178
+ else
2179
+ r17 = instantiate_node(SyntaxNode,input, index...index)
2180
+ end
2181
+ s15 << r17
2182
+ if r17
2183
+ if has_terminal?('(', false, index)
2184
+ r19 = instantiate_node(SyntaxNode,input, index...(index + 1))
2185
+ @index += 1
2186
+ else
2187
+ terminal_parse_failure('(')
2188
+ r19 = nil
2189
+ end
2190
+ s15 << r19
2191
+ if r19
2192
+ r21 = _nt_sp
2193
+ if r21
2194
+ r20 = r21
2195
+ else
2196
+ r20 = instantiate_node(SyntaxNode,input, index...index)
2197
+ end
2198
+ s15 << r20
2199
+ if r20
2200
+ r22 = _nt_kw_args
2201
+ s15 << r22
2202
+ if r22
2203
+ r24 = _nt_sp
2204
+ if r24
2205
+ r23 = r24
2206
+ else
2207
+ r23 = instantiate_node(SyntaxNode,input, index...index)
2208
+ end
2209
+ s15 << r23
2210
+ if r23
2211
+ if has_terminal?(')', false, index)
2212
+ r25 = instantiate_node(SyntaxNode,input, index...(index + 1))
2213
+ @index += 1
2214
+ else
2215
+ terminal_parse_failure(')')
2216
+ r25 = nil
2217
+ end
2218
+ s15 << r25
2219
+ end
2220
+ end
2221
+ end
2222
+ end
2223
+ end
2224
+ end
2225
+ if s15.last
2226
+ r15 = instantiate_node(ScriptCall,input, i15...index, s15)
2227
+ r15.extend(ScriptCall2)
2228
+ else
2229
+ @index = i15
2230
+ r15 = nil
2231
+ end
2232
+ if r15
2233
+ r0 = r15
2234
+ else
2235
+ @index = i0
2236
+ r0 = nil
2237
+ end
2238
+ end
2239
+
2240
+ node_cache[:script_call][start_index] = r0
2241
+
2242
+ r0
2243
+ end
2244
+
2245
+ module HashArgs0
2246
+ def al
2247
+ elements[3]
2248
+ end
2249
+ end
2250
+
2251
+ module HashArgs1
2252
+ def e0
2253
+ elements[0]
2254
+ end
2255
+
2256
+ def e1
2257
+ elements[4]
2258
+ end
2259
+
2260
+ def args_rest
2261
+ elements[5]
2262
+ end
2263
+ end
2264
+
2265
+ def _nt_hash_args
2266
+ start_index = index
2267
+ if node_cache[:hash_args].has_key?(index)
2268
+ cached = node_cache[:hash_args][index]
2269
+ if cached
2270
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2271
+ @index = cached.interval.end
2272
+ end
2273
+ return cached
2274
+ end
2275
+
2276
+ i0, s0 = index, []
2277
+ r1 = _nt_expression
2278
+ s0 << r1
2279
+ if r1
2280
+ r3 = _nt_sp
2281
+ if r3
2282
+ r2 = r3
2283
+ else
2284
+ r2 = instantiate_node(SyntaxNode,input, index...index)
2285
+ end
2286
+ s0 << r2
2287
+ if r2
2288
+ if has_terminal?(':', false, index)
2289
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
2290
+ @index += 1
2291
+ else
2292
+ terminal_parse_failure(':')
2293
+ r4 = nil
2294
+ end
2295
+ s0 << r4
2296
+ if r4
2297
+ r6 = _nt_sp
2298
+ if r6
2299
+ r5 = r6
2300
+ else
2301
+ r5 = instantiate_node(SyntaxNode,input, index...index)
2302
+ end
2303
+ s0 << r5
2304
+ if r5
2305
+ r7 = _nt_expression
2306
+ s0 << r7
2307
+ if r7
2308
+ i9, s9 = index, []
2309
+ r11 = _nt_sp
2310
+ if r11
2311
+ r10 = r11
2312
+ else
2313
+ r10 = instantiate_node(SyntaxNode,input, index...index)
2314
+ end
2315
+ s9 << r10
2316
+ if r10
2317
+ if has_terminal?(',', false, index)
2318
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
2319
+ @index += 1
2320
+ else
2321
+ terminal_parse_failure(',')
2322
+ r12 = nil
2323
+ end
2324
+ s9 << r12
2325
+ if r12
2326
+ r14 = _nt_sp
2327
+ if r14
2328
+ r13 = r14
2329
+ else
2330
+ r13 = instantiate_node(SyntaxNode,input, index...index)
2331
+ end
2332
+ s9 << r13
2333
+ if r13
2334
+ r16 = _nt_hash_args
2335
+ if r16
2336
+ r15 = r16
2337
+ else
2338
+ r15 = instantiate_node(SyntaxNode,input, index...index)
2339
+ end
2340
+ s9 << r15
2341
+ end
2342
+ end
2343
+ end
2344
+ if s9.last
2345
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
2346
+ r9.extend(HashArgs0)
2347
+ else
2348
+ @index = i9
2349
+ r9 = nil
2350
+ end
2351
+ if r9
2352
+ r8 = r9
2353
+ else
2354
+ r8 = instantiate_node(SyntaxNode,input, index...index)
2355
+ end
2356
+ s0 << r8
2357
+ end
2358
+ end
2359
+ end
2360
+ end
2361
+ end
2362
+ if s0.last
2363
+ r0 = instantiate_node(HashArgs,input, i0...index, s0)
2364
+ r0.extend(HashArgs1)
2365
+ else
2366
+ @index = i0
2367
+ r0 = nil
2368
+ end
2369
+
2370
+ node_cache[:hash_args][start_index] = r0
2371
+
2372
+ r0
2373
+ end
2374
+
2375
+ module KwArgs0
2376
+ def i
2377
+ elements[0]
2378
+ end
2379
+
2380
+ end
2381
+
2382
+ module KwArgs1
2383
+ def al
2384
+ elements[3]
2385
+ end
2386
+ end
2387
+
2388
+ module KwArgs2
2389
+ def k
2390
+ elements[0]
2391
+ end
2392
+
2393
+ def arg0
2394
+ elements[1]
2395
+ end
2396
+
2397
+ def args_rest
2398
+ elements[2]
2399
+ end
2400
+ end
2401
+
2402
+ def _nt_kw_args
2403
+ start_index = index
2404
+ if node_cache[:kw_args].has_key?(index)
2405
+ cached = node_cache[:kw_args][index]
2406
+ if cached
2407
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2408
+ @index = cached.interval.end
2409
+ end
2410
+ return cached
2411
+ end
2412
+
2413
+ i0, s0 = index, []
2414
+ i2, s2 = index, []
2415
+ r3 = _nt_identifier
2416
+ s2 << r3
2417
+ if r3
2418
+ if has_terminal?(':', false, index)
2419
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
2420
+ @index += 1
2421
+ else
2422
+ terminal_parse_failure(':')
2423
+ r4 = nil
2424
+ end
2425
+ s2 << r4
2426
+ if r4
2427
+ r6 = _nt_sp
2428
+ if r6
2429
+ r5 = r6
2430
+ else
2431
+ r5 = instantiate_node(SyntaxNode,input, index...index)
2432
+ end
2433
+ s2 << r5
2434
+ end
2435
+ end
2436
+ if s2.last
2437
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2438
+ r2.extend(KwArgs0)
2439
+ else
2440
+ @index = i2
2441
+ r2 = nil
2442
+ end
2443
+ if r2
2444
+ r1 = r2
2445
+ else
2446
+ r1 = instantiate_node(SyntaxNode,input, index...index)
2447
+ end
2448
+ s0 << r1
2449
+ if r1
2450
+ r7 = _nt_expression
2451
+ s0 << r7
2452
+ if r7
2453
+ i9, s9 = index, []
2454
+ r11 = _nt_sp
2455
+ if r11
2456
+ r10 = r11
2457
+ else
2458
+ r10 = instantiate_node(SyntaxNode,input, index...index)
2459
+ end
2460
+ s9 << r10
2461
+ if r10
2462
+ if has_terminal?(',', false, index)
2463
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
2464
+ @index += 1
2465
+ else
2466
+ terminal_parse_failure(',')
2467
+ r12 = nil
2468
+ end
2469
+ s9 << r12
2470
+ if r12
2471
+ r14 = _nt_sp
2472
+ if r14
2473
+ r13 = r14
2474
+ else
2475
+ r13 = instantiate_node(SyntaxNode,input, index...index)
2476
+ end
2477
+ s9 << r13
2478
+ if r13
2479
+ r15 = _nt_kw_args
2480
+ s9 << r15
2481
+ end
2482
+ end
2483
+ end
2484
+ if s9.last
2485
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
2486
+ r9.extend(KwArgs1)
2487
+ else
2488
+ @index = i9
2489
+ r9 = nil
2490
+ end
2491
+ if r9
2492
+ r8 = r9
2493
+ else
2494
+ r8 = instantiate_node(SyntaxNode,input, index...index)
2495
+ end
2496
+ s0 << r8
2497
+ end
2498
+ end
2499
+ if s0.last
2500
+ r0 = instantiate_node(KwArgs,input, i0...index, s0)
2501
+ r0.extend(KwArgs2)
2502
+ else
2503
+ @index = i0
2504
+ r0 = nil
2505
+ end
2506
+
2507
+ node_cache[:kw_args][start_index] = r0
2508
+
2509
+ r0
2510
+ end
2511
+
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
+ def _nt_number
2678
+ start_index = index
2679
+ if node_cache[:number].has_key?(index)
2680
+ cached = node_cache[:number][index]
2681
+ if cached
2682
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2683
+ @index = cached.interval.end
2684
+ end
2685
+ return cached
2686
+ end
2687
+
2688
+ i0 = index
2689
+ r1 = _nt_decimal
2690
+ if r1
2691
+ r0 = r1
2692
+ else
2693
+ r2 = _nt_integer
2694
+ if r2
2695
+ r0 = r2
2696
+ else
2697
+ @index = i0
2698
+ r0 = nil
2699
+ end
2700
+ end
2701
+
2702
+ node_cache[:number][start_index] = r0
2703
+
2704
+ r0
2705
+ end
2706
+
2707
+ module Decimal0
2708
+ end
2709
+
2710
+ def _nt_decimal
2711
+ start_index = index
2712
+ if node_cache[:decimal].has_key?(index)
2713
+ cached = node_cache[:decimal][index]
2714
+ if cached
2715
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2716
+ @index = cached.interval.end
2717
+ end
2718
+ return cached
2719
+ end
2720
+
2721
+ i0, s0 = index, []
2722
+ s1, i1 = [], index
2723
+ loop do
2724
+ if has_terminal?('\G[0-9]', true, index)
2725
+ r2 = true
2726
+ @index += 1
2727
+ else
2728
+ r2 = nil
2729
+ end
2730
+ if r2
2731
+ s1 << r2
2732
+ else
2733
+ break
2734
+ end
2735
+ end
2736
+ if s1.empty?
2737
+ @index = i1
2738
+ r1 = nil
2739
+ else
2740
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2741
+ end
2742
+ s0 << r1
2743
+ if r1
2744
+ if has_terminal?('.', false, index)
2745
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
2746
+ @index += 1
2747
+ else
2748
+ terminal_parse_failure('.')
2749
+ r3 = nil
2750
+ end
2751
+ s0 << r3
2752
+ if r3
2753
+ s4, i4 = [], index
2754
+ loop do
2755
+ if has_terminal?('\G[0-9]', true, index)
2756
+ r5 = true
2757
+ @index += 1
2758
+ else
2759
+ r5 = nil
2760
+ end
2761
+ if r5
2762
+ s4 << r5
2763
+ else
2764
+ break
2765
+ end
2766
+ end
2767
+ if s4.empty?
2768
+ @index = i4
2769
+ r4 = nil
2770
+ else
2771
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
2772
+ end
2773
+ s0 << r4
2774
+ end
2775
+ end
2776
+ if s0.last
2777
+ r0 = instantiate_node(Literal,input, i0...index, s0)
2778
+ r0.extend(Decimal0)
2779
+ else
2780
+ @index = i0
2781
+ r0 = nil
2782
+ end
2783
+
2784
+ node_cache[:decimal][start_index] = r0
2785
+
2786
+ r0
2787
+ end
2788
+
2789
+ def _nt_integer
2790
+ start_index = index
2791
+ if node_cache[:integer].has_key?(index)
2792
+ cached = node_cache[:integer][index]
2793
+ if cached
2794
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2795
+ @index = cached.interval.end
2796
+ end
2797
+ return cached
2798
+ end
2799
+
2800
+ s0, i0 = [], index
2801
+ loop do
2802
+ if has_terminal?('\G[0-9]', true, index)
2803
+ r1 = true
2804
+ @index += 1
2805
+ else
2806
+ r1 = nil
2807
+ end
2808
+ if r1
2809
+ s0 << r1
2810
+ else
2811
+ break
2812
+ end
2813
+ end
2814
+ if s0.empty?
2815
+ @index = i0
2816
+ r0 = nil
2817
+ else
2818
+ r0 = instantiate_node(Literal,input, i0...index, s0)
2819
+ end
2820
+
2821
+ node_cache[:integer][start_index] = r0
2822
+
2823
+ r0
2824
+ end
2825
+
2826
+ module Identifier0
2827
+ end
2828
+
2829
+ def _nt_identifier
2830
+ start_index = index
2831
+ if node_cache[:identifier].has_key?(index)
2832
+ cached = node_cache[:identifier][index]
2833
+ if cached
2834
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2835
+ @index = cached.interval.end
2836
+ end
2837
+ return cached
2838
+ end
2839
+
2840
+ i0, s0 = index, []
2841
+ if has_terminal?('\G[a-z]', true, index)
2842
+ r1 = true
2843
+ @index += 1
2844
+ else
2845
+ r1 = nil
2846
+ end
2847
+ s0 << r1
2848
+ if r1
2849
+ s2, i2 = [], index
2850
+ loop do
2851
+ if has_terminal?('\G[a-zA-Z0-9_]', true, index)
2852
+ r3 = true
2853
+ @index += 1
2854
+ else
2855
+ r3 = nil
2856
+ end
2857
+ if r3
2858
+ s2 << r3
2859
+ else
2860
+ break
2861
+ end
2862
+ end
2863
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2864
+ s0 << r2
2865
+ end
2866
+ if s0.last
2867
+ r0 = instantiate_node(Identifier,input, i0...index, s0)
2868
+ r0.extend(Identifier0)
2869
+ else
2870
+ @index = i0
2871
+ r0 = nil
2872
+ end
2873
+
2874
+ node_cache[:identifier][start_index] = r0
2875
+
2876
+ r0
2877
+ end
2878
+
2879
+ def _nt_boolean
2880
+ start_index = index
2881
+ if node_cache[:boolean].has_key?(index)
2882
+ cached = node_cache[:boolean][index]
2883
+ if cached
2884
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2885
+ @index = cached.interval.end
2886
+ end
2887
+ return cached
2888
+ end
2889
+
2890
+ i0 = index
2891
+ if has_terminal?('true', false, index)
2892
+ r1 = instantiate_node(Literal,input, index...(index + 4))
2893
+ @index += 4
2894
+ else
2895
+ terminal_parse_failure('true')
2896
+ r1 = nil
2897
+ end
2898
+ if r1
2899
+ r0 = r1
2900
+ else
2901
+ if has_terminal?('false', false, index)
2902
+ r2 = instantiate_node(Literal,input, index...(index + 5))
2903
+ @index += 5
2904
+ else
2905
+ terminal_parse_failure('false')
2906
+ r2 = nil
2907
+ end
2908
+ if r2
2909
+ r0 = r2
2910
+ else
2911
+ @index = i0
2912
+ r0 = nil
2913
+ end
2914
+ end
2915
+
2916
+ node_cache[:boolean][start_index] = r0
2917
+
2918
+ r0
2919
+ end
2920
+
2921
+ def _nt_nil_val
2922
+ start_index = index
2923
+ if node_cache[:nil_val].has_key?(index)
2924
+ cached = node_cache[:nil_val][index]
2925
+ if cached
2926
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2927
+ @index = cached.interval.end
2928
+ end
2929
+ return cached
2930
+ end
2931
+
2932
+ if has_terminal?('nil', false, index)
2933
+ r0 = instantiate_node(Literal,input, index...(index + 3))
2934
+ @index += 3
2935
+ else
2936
+ terminal_parse_failure('nil')
2937
+ r0 = nil
2938
+ end
2939
+
2940
+ node_cache[:nil_val][start_index] = r0
2941
+
2942
+ r0
2943
+ end
2944
+
2945
+ def _nt_sp
2946
+ start_index = index
2947
+ if node_cache[:sp].has_key?(index)
2948
+ cached = node_cache[:sp][index]
2949
+ if cached
2950
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2951
+ @index = cached.interval.end
2952
+ end
2953
+ return cached
2954
+ end
2955
+
2956
+ s0, i0 = [], index
2957
+ loop do
2958
+ if has_terminal?('\G[\\s]', true, index)
2959
+ r1 = true
2960
+ @index += 1
2961
+ else
2962
+ r1 = nil
2963
+ end
2964
+ if r1
2965
+ s0 << r1
2966
+ else
2967
+ break
2968
+ end
2969
+ end
2970
+ if s0.empty?
2971
+ @index = i0
2972
+ r0 = nil
2973
+ else
2974
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2975
+ end
2976
+
2977
+ node_cache[:sp][start_index] = r0
2978
+
2979
+ r0
2980
+ end
2981
+
2982
+ module String0
2983
+ end
2984
+
2985
+ module String1
2986
+ end
2987
+
2988
+ module String2
2989
+ end
2990
+
2991
+ def _nt_string
2992
+ start_index = index
2993
+ if node_cache[:string].has_key?(index)
2994
+ cached = node_cache[:string][index]
2995
+ if cached
2996
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2997
+ @index = cached.interval.end
2998
+ end
2999
+ return cached
3000
+ end
3001
+
3002
+ i0 = index
3003
+ i1, s1 = index, []
3004
+ if has_terminal?('"', false, index)
3005
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
3006
+ @index += 1
3007
+ else
3008
+ terminal_parse_failure('"')
3009
+ r2 = nil
3010
+ end
3011
+ s1 << r2
3012
+ if r2
3013
+ s3, i3 = [], index
3014
+ loop do
3015
+ i4 = index
3016
+ if has_terminal?('\"', false, index)
3017
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
3018
+ @index += 2
3019
+ else
3020
+ terminal_parse_failure('\"')
3021
+ r5 = nil
3022
+ end
3023
+ if r5
3024
+ r4 = r5
3025
+ else
3026
+ i6, s6 = index, []
3027
+ i7 = index
3028
+ if has_terminal?('"', false, index)
3029
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
3030
+ @index += 1
3031
+ else
3032
+ terminal_parse_failure('"')
3033
+ r8 = nil
3034
+ end
3035
+ if r8
3036
+ r7 = nil
3037
+ else
3038
+ @index = i7
3039
+ r7 = instantiate_node(SyntaxNode,input, index...index)
3040
+ end
3041
+ s6 << r7
3042
+ if r7
3043
+ if index < input_length
3044
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
3045
+ @index += 1
3046
+ else
3047
+ terminal_parse_failure("any character")
3048
+ r9 = nil
3049
+ end
3050
+ s6 << r9
3051
+ end
3052
+ if s6.last
3053
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
3054
+ r6.extend(String0)
3055
+ else
3056
+ @index = i6
3057
+ r6 = nil
3058
+ end
3059
+ if r6
3060
+ r4 = r6
3061
+ else
3062
+ @index = i4
3063
+ r4 = nil
3064
+ end
3065
+ end
3066
+ if r4
3067
+ s3 << r4
3068
+ else
3069
+ break
3070
+ end
3071
+ end
3072
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
3073
+ s1 << r3
3074
+ if r3
3075
+ if has_terminal?('"', false, index)
3076
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
3077
+ @index += 1
3078
+ else
3079
+ terminal_parse_failure('"')
3080
+ r10 = nil
3081
+ end
3082
+ s1 << r10
3083
+ end
3084
+ end
3085
+ if s1.last
3086
+ r1 = instantiate_node(String,input, i1...index, s1)
3087
+ r1.extend(String1)
3088
+ else
3089
+ @index = i1
3090
+ r1 = nil
3091
+ end
3092
+ if r1
3093
+ r0 = r1
3094
+ else
3095
+ i11, s11 = index, []
3096
+ if has_terminal?("'", false, index)
3097
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
3098
+ @index += 1
3099
+ else
3100
+ terminal_parse_failure("'")
3101
+ r12 = nil
3102
+ end
3103
+ s11 << r12
3104
+ if r12
3105
+ s13, i13 = [], index
3106
+ loop do
3107
+ if has_terminal?('\G[^\']', true, index)
3108
+ r14 = true
3109
+ @index += 1
3110
+ else
3111
+ r14 = nil
3112
+ end
3113
+ if r14
3114
+ s13 << r14
3115
+ else
3116
+ break
3117
+ end
3118
+ end
3119
+ r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
3120
+ s11 << r13
3121
+ if r13
3122
+ if has_terminal?("'", false, index)
3123
+ r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
3124
+ @index += 1
3125
+ else
3126
+ terminal_parse_failure("'")
3127
+ r15 = nil
3128
+ end
3129
+ s11 << r15
3130
+ end
3131
+ end
3132
+ if s11.last
3133
+ r11 = instantiate_node(String,input, i11...index, s11)
3134
+ r11.extend(String2)
3135
+ else
3136
+ @index = i11
3137
+ r11 = nil
3138
+ end
3139
+ if r11
3140
+ r0 = r11
3141
+ else
3142
+ @index = i0
3143
+ r0 = nil
3144
+ end
3145
+ end
3146
+
3147
+ node_cache[:string][start_index] = r0
3148
+
3149
+ r0
3150
+ end
3151
+
3152
+ end
3153
+
3154
+ class DeloreanParser < Treetop::Runtime::CompiledParser
3155
+ include Delorean
3156
+ end
3157
+