soroban 0.7.3 → 0.8.0

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.
@@ -1 +1,4 @@
1
- require 'soroban/import/ruby_xl_importer'
1
+ if defined?(RubyXL)
2
+ require 'soroban/import/ruby_xl_patch'
3
+ require 'soroban/import/ruby_xl_importer'
4
+ end
@@ -1,12 +1,15 @@
1
+ require 'soroban/helpers'
2
+ require 'soroban/sheet'
3
+ require 'soroban/label_walker'
4
+
1
5
  module Soroban
6
+
2
7
  module Import
3
8
 
4
9
  # Use the RubyXL gem to load an xlsx file, returning a new Soroban::Sheet
5
10
  # object. Specify the path to the xlsx file, the index of the sheet to be
6
11
  # imported, and a hash of name => label bindings.
7
12
  def self.rubyXL(path, sheet, bindings)
8
- require 'rubyXL'
9
- require 'soroban/import/ruby_xl_patch'
10
13
  RubyXLImporter.new(path, sheet, bindings).import
11
14
  end
12
15
 
@@ -15,41 +18,44 @@ module Soroban
15
18
  class RubyXLImporter
16
19
 
17
20
  def initialize(path, index, bindings)
18
- @path, @index, @bindings = path, index, bindings
21
+ @_path, @_index, @_bindings = path, index, bindings
22
+ @_sheet = nil
23
+ @_model = nil
19
24
  end
20
25
 
21
26
  def import
22
- workbook = RubyXL::Parser.parse(@path)
23
- @sheet = workbook.worksheets[@index]
24
- @model = Soroban::Sheet.new
25
- @bindings.values.each do |label_or_range|
26
- if Soroban::range?(label_or_range)
27
- LabelWalker.new(label_or_range).each do |label|
27
+ workbook = RubyXL::Parser.parse(@_path)
28
+ @_sheet = workbook.worksheets[@_index]
29
+ @_model = Soroban::Sheet.new
30
+ @_bindings.values.each do |label_or_range|
31
+ if Soroban::Helpers::range?(label_or_range)
32
+ Soroban::LabelWalker.new(label_or_range).each do |label|
28
33
  _addCell(label)
29
34
  end
30
35
  else
31
36
  _addCell(label_or_range)
32
37
  end
33
38
  end
34
- while label = @model.missing.first
39
+ while label = @_model.missing.first
35
40
  _addCell(label)
36
41
  end
37
- @model.bind(@bindings)
38
- return @model
42
+ @_model.bind(@_bindings)
43
+ return @_model
39
44
  end
40
45
 
41
46
  private
42
47
 
43
48
  def _addCell(label)
44
- row, col = Soroban::getPos(label)
45
- cell = @sheet[row][col]
49
+ row, col = Soroban::Helpers::getPos(label)
50
+ cell = @_sheet[row][col]
46
51
  data = cell.formula rescue nil
47
52
  data = "=#{data}" unless data.nil?
48
53
  data ||= cell.value.to_s rescue nil
49
- @model.set(label.to_sym => data)
54
+ @_model.set(label.to_sym => data)
50
55
  end
51
56
 
52
57
  end
53
58
 
54
59
  end
60
+
55
61
  end
@@ -1,7 +1,9 @@
1
1
  module RubyXL
2
+
2
3
  class Cell < PrivateClass
3
4
  def is_date?
4
5
  return false
5
6
  end
6
7
  end
8
+
7
9
  end
@@ -1,30 +1,31 @@
1
+ require 'soroban/helpers'
2
+
1
3
  module Soroban
2
4
 
3
- # An enumerable that allows cells in a range to be visited.
5
+ # An enumerable that allows the labels for cells in a range to be visited.
4
6
  class LabelWalker
5
-
6
7
  include Enumerable
7
8
 
8
9
  # Create a new walker from a supplied range.
9
10
  def initialize(range)
10
- @fc, @fr, @tc, @tr = Soroban::getRange(range)
11
+ @_fc, @_fr, @_tc, @_tr = Soroban::Helpers.getRange(range)
11
12
  end
12
13
 
13
- # Yield the label of each cell referenced by the supplied range.
14
+ # Yield the label of each cell referenced by the supplied range. For a range
15
+ # of the form "A1:B4", this will yield "A1", "A2", "A3", ..., "B3", "B4".
14
16
  def each
15
- col, row = @fc, @fr
17
+ col, row = @_fc, @_fr
16
18
  while true do
17
19
  yield "#{col}#{row}"
18
- break if row == @tr && col == @tc
19
- if row == @tr
20
- row = @fr
20
+ break if row == @_tr && col == @_tc
21
+ if row == @_tr
22
+ row = @_fr
21
23
  col = col.next
22
24
  else
23
25
  row = row.next
24
26
  end
25
27
  end
26
28
  end
27
-
28
29
  end
29
30
 
30
31
  end
@@ -6,10 +6,12 @@ require 'soroban/parser/grammar'
6
6
 
7
7
  module Soroban
8
8
 
9
- # A Treetop parser for Excel formulas that can generate valid Ruby expression
10
- # via a rewrite operation, and which can build an array of referenced labels.
11
- def self.parser
12
- @@parser ||= SorobanParser.new
9
+ class Parser
10
+ # A Treetop parser for Excel formulas that can generate valid Ruby expression
11
+ # via a rewrite operation, and which can build an array of referenced labels.
12
+ def self.instance
13
+ @@parser ||= ExcelParser.new
14
+ end
13
15
  end
14
16
 
15
17
  end
@@ -2,989 +2,991 @@
2
2
 
3
3
 
4
4
  module Soroban
5
- include Treetop::Runtime
5
+ module Excel
6
+ include Treetop::Runtime
6
7
 
7
- def root
8
- @root ||= :formula
9
- end
10
-
11
- module Formula0
12
- def logical
13
- elements[2]
8
+ def root
9
+ @root ||= :formula
14
10
  end
15
- end
16
11
 
17
- def _nt_formula
18
- start_index = index
19
- if node_cache[:formula].has_key?(index)
20
- cached = node_cache[:formula][index]
21
- if cached
22
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
23
- @index = cached.interval.end
12
+ module Formula0
13
+ def logical
14
+ elements[2]
24
15
  end
25
- return cached
26
16
  end
27
17
 
28
- i0 = index
29
- i1, s1 = index, []
30
- if has_terminal?('=', false, index)
31
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
32
- @index += 1
33
- else
34
- terminal_parse_failure('=')
35
- r2 = nil
36
- end
37
- s1 << r2
38
- if r2
39
- r4 = _nt_space
40
- if r4
41
- r3 = r4
18
+ def _nt_formula
19
+ start_index = index
20
+ if node_cache[:formula].has_key?(index)
21
+ cached = node_cache[:formula][index]
22
+ if cached
23
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
24
+ @index = cached.interval.end
25
+ end
26
+ return cached
27
+ end
28
+
29
+ i0 = index
30
+ i1, s1 = index, []
31
+ if has_terminal?('=', false, index)
32
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
33
+ @index += 1
42
34
  else
43
- r3 = instantiate_node(SyntaxNode,input, index...index)
35
+ terminal_parse_failure('=')
36
+ r2 = nil
37
+ end
38
+ s1 << r2
39
+ if r2
40
+ r4 = _nt_space
41
+ if r4
42
+ r3 = r4
43
+ else
44
+ r3 = instantiate_node(SyntaxNode,input, index...index)
45
+ end
46
+ s1 << r3
47
+ if r3
48
+ r5 = _nt_logical
49
+ s1 << r5
50
+ end
44
51
  end
45
- s1 << r3
46
- if r3
47
- r5 = _nt_logical
48
- s1 << r5
52
+ if s1.last
53
+ r1 = instantiate_node(Formula,input, i1...index, s1)
54
+ r1.extend(Formula0)
55
+ else
56
+ @index = i1
57
+ r1 = nil
49
58
  end
50
- end
51
- if s1.last
52
- r1 = instantiate_node(Formula,input, i1...index, s1)
53
- r1.extend(Formula0)
54
- else
55
- @index = i1
56
- r1 = nil
57
- end
58
- if r1
59
- r0 = r1
60
- else
61
- r6 = _nt_string
62
- if r6
63
- r0 = r6
59
+ if r1
60
+ r0 = r1
64
61
  else
65
- r7 = _nt_number
66
- if r7
67
- r0 = r7
62
+ r6 = _nt_string
63
+ if r6
64
+ r0 = r6
68
65
  else
69
- r8 = _nt_boolean
70
- if r8
71
- r0 = r8
66
+ r7 = _nt_number
67
+ if r7
68
+ r0 = r7
72
69
  else
73
- @index = i0
74
- r0 = nil
70
+ r8 = _nt_boolean
71
+ if r8
72
+ r0 = r8
73
+ else
74
+ @index = i0
75
+ r0 = nil
76
+ end
75
77
  end
76
78
  end
77
79
  end
78
- end
79
-
80
- node_cache[:formula][start_index] = r0
81
80
 
82
- r0
83
- end
81
+ node_cache[:formula][start_index] = r0
84
82
 
85
- module Logical0
86
- def and
87
- elements[3]
83
+ r0
88
84
  end
89
- end
90
85
 
91
- module Logical1
92
- def and
93
- elements[0]
86
+ module Logical0
87
+ def and
88
+ elements[3]
89
+ end
94
90
  end
95
91
 
96
- end
97
-
98
- def _nt_logical
99
- start_index = index
100
- if node_cache[:logical].has_key?(index)
101
- cached = node_cache[:logical][index]
102
- if cached
103
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
104
- @index = cached.interval.end
92
+ module Logical1
93
+ def and
94
+ elements[0]
105
95
  end
106
- return cached
96
+
107
97
  end
108
98
 
109
- i0, s0 = index, []
110
- r1 = _nt_and
111
- s0 << r1
112
- if r1
113
- s2, i2 = [], index
114
- loop do
115
- i3, s3 = index, []
116
- r5 = _nt_space
117
- if r5
118
- r4 = r5
119
- else
120
- r4 = instantiate_node(SyntaxNode,input, index...index)
99
+ def _nt_logical
100
+ start_index = index
101
+ if node_cache[:logical].has_key?(index)
102
+ cached = node_cache[:logical][index]
103
+ if cached
104
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
105
+ @index = cached.interval.end
121
106
  end
122
- s3 << r4
123
- if r4
124
- if has_terminal?('or', false, index)
125
- r6 = instantiate_node(SyntaxNode,input, index...(index + 2))
126
- @index += 2
107
+ return cached
108
+ end
109
+
110
+ i0, s0 = index, []
111
+ r1 = _nt_and
112
+ s0 << r1
113
+ if r1
114
+ s2, i2 = [], index
115
+ loop do
116
+ i3, s3 = index, []
117
+ r5 = _nt_space
118
+ if r5
119
+ r4 = r5
127
120
  else
128
- terminal_parse_failure('or')
129
- r6 = nil
121
+ r4 = instantiate_node(SyntaxNode,input, index...index)
130
122
  end
131
- s3 << r6
132
- if r6
133
- r8 = _nt_space
134
- if r8
135
- r7 = r8
123
+ s3 << r4
124
+ if r4
125
+ if has_terminal?('or', false, index)
126
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 2))
127
+ @index += 2
136
128
  else
137
- r7 = instantiate_node(SyntaxNode,input, index...index)
129
+ terminal_parse_failure('or')
130
+ r6 = nil
138
131
  end
139
- s3 << r7
140
- if r7
141
- r9 = _nt_and
142
- s3 << r9
132
+ s3 << r6
133
+ if r6
134
+ r8 = _nt_space
135
+ if r8
136
+ r7 = r8
137
+ else
138
+ r7 = instantiate_node(SyntaxNode,input, index...index)
139
+ end
140
+ s3 << r7
141
+ if r7
142
+ r9 = _nt_and
143
+ s3 << r9
144
+ end
143
145
  end
144
146
  end
147
+ if s3.last
148
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
149
+ r3.extend(Logical0)
150
+ else
151
+ @index = i3
152
+ r3 = nil
153
+ end
154
+ if r3
155
+ s2 << r3
156
+ else
157
+ break
158
+ end
145
159
  end
146
- if s3.last
147
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
148
- r3.extend(Logical0)
149
- else
150
- @index = i3
151
- r3 = nil
152
- end
153
- if r3
154
- s2 << r3
155
- else
156
- break
157
- end
160
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
161
+ s0 << r2
162
+ end
163
+ if s0.last
164
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
165
+ r0.extend(Logical1)
166
+ else
167
+ @index = i0
168
+ r0 = nil
158
169
  end
159
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
160
- s0 << r2
161
- end
162
- if s0.last
163
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
164
- r0.extend(Logical1)
165
- else
166
- @index = i0
167
- r0 = nil
168
- end
169
-
170
- node_cache[:logical][start_index] = r0
171
170
 
172
- r0
173
- end
171
+ node_cache[:logical][start_index] = r0
174
172
 
175
- module And0
176
- def truthval
177
- elements[3]
173
+ r0
178
174
  end
179
- end
180
175
 
181
- module And1
182
- def truthval
183
- elements[0]
176
+ module And0
177
+ def truthval
178
+ elements[3]
179
+ end
184
180
  end
185
181
 
186
- end
187
-
188
- def _nt_and
189
- start_index = index
190
- if node_cache[:and].has_key?(index)
191
- cached = node_cache[:and][index]
192
- if cached
193
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
194
- @index = cached.interval.end
182
+ module And1
183
+ def truthval
184
+ elements[0]
195
185
  end
196
- return cached
186
+
197
187
  end
198
188
 
199
- i0, s0 = index, []
200
- r1 = _nt_truthval
201
- s0 << r1
202
- if r1
203
- s2, i2 = [], index
204
- loop do
205
- i3, s3 = index, []
206
- r5 = _nt_space
207
- if r5
208
- r4 = r5
209
- else
210
- r4 = instantiate_node(SyntaxNode,input, index...index)
189
+ def _nt_and
190
+ start_index = index
191
+ if node_cache[:and].has_key?(index)
192
+ cached = node_cache[:and][index]
193
+ if cached
194
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
195
+ @index = cached.interval.end
211
196
  end
212
- s3 << r4
213
- if r4
214
- if has_terminal?('and', false, index)
215
- r6 = instantiate_node(SyntaxNode,input, index...(index + 3))
216
- @index += 3
197
+ return cached
198
+ end
199
+
200
+ i0, s0 = index, []
201
+ r1 = _nt_truthval
202
+ s0 << r1
203
+ if r1
204
+ s2, i2 = [], index
205
+ loop do
206
+ i3, s3 = index, []
207
+ r5 = _nt_space
208
+ if r5
209
+ r4 = r5
217
210
  else
218
- terminal_parse_failure('and')
219
- r6 = nil
211
+ r4 = instantiate_node(SyntaxNode,input, index...index)
220
212
  end
221
- s3 << r6
222
- if r6
223
- r8 = _nt_space
224
- if r8
225
- r7 = r8
213
+ s3 << r4
214
+ if r4
215
+ if has_terminal?('and', false, index)
216
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 3))
217
+ @index += 3
226
218
  else
227
- r7 = instantiate_node(SyntaxNode,input, index...index)
219
+ terminal_parse_failure('and')
220
+ r6 = nil
228
221
  end
229
- s3 << r7
230
- if r7
231
- r9 = _nt_truthval
232
- s3 << r9
222
+ s3 << r6
223
+ if r6
224
+ r8 = _nt_space
225
+ if r8
226
+ r7 = r8
227
+ else
228
+ r7 = instantiate_node(SyntaxNode,input, index...index)
229
+ end
230
+ s3 << r7
231
+ if r7
232
+ r9 = _nt_truthval
233
+ s3 << r9
234
+ end
233
235
  end
234
236
  end
237
+ if s3.last
238
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
239
+ r3.extend(And0)
240
+ else
241
+ @index = i3
242
+ r3 = nil
243
+ end
244
+ if r3
245
+ s2 << r3
246
+ else
247
+ break
248
+ end
235
249
  end
236
- if s3.last
237
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
238
- r3.extend(And0)
239
- else
240
- @index = i3
241
- r3 = nil
242
- end
243
- if r3
244
- s2 << r3
245
- else
246
- break
247
- end
250
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
251
+ s0 << r2
252
+ end
253
+ if s0.last
254
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
255
+ r0.extend(And1)
256
+ else
257
+ @index = i0
258
+ r0 = nil
248
259
  end
249
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
250
- s0 << r2
251
- end
252
- if s0.last
253
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
254
- r0.extend(And1)
255
- else
256
- @index = i0
257
- r0 = nil
258
- end
259
-
260
- node_cache[:and][start_index] = r0
261
260
 
262
- r0
263
- end
261
+ node_cache[:and][start_index] = r0
264
262
 
265
- module Truthval0
266
- def logical
267
- elements[2]
263
+ r0
268
264
  end
269
265
 
270
- end
271
-
272
- def _nt_truthval
273
- start_index = index
274
- if node_cache[:truthval].has_key?(index)
275
- cached = node_cache[:truthval][index]
276
- if cached
277
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
278
- @index = cached.interval.end
266
+ module Truthval0
267
+ def logical
268
+ elements[2]
279
269
  end
280
- return cached
270
+
281
271
  end
282
272
 
283
- i0 = index
284
- r1 = _nt_comparison
285
- if r1
286
- r0 = r1
287
- else
288
- i2, s2 = index, []
289
- if has_terminal?('(', false, index)
290
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
291
- @index += 1
273
+ def _nt_truthval
274
+ start_index = index
275
+ if node_cache[:truthval].has_key?(index)
276
+ cached = node_cache[:truthval][index]
277
+ if cached
278
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
279
+ @index = cached.interval.end
280
+ end
281
+ return cached
282
+ end
283
+
284
+ i0 = index
285
+ r1 = _nt_comparison
286
+ if r1
287
+ r0 = r1
292
288
  else
293
- terminal_parse_failure('(')
294
- r3 = nil
295
- end
296
- s2 << r3
297
- if r3
298
- r5 = _nt_space
299
- if r5
300
- r4 = r5
289
+ i2, s2 = index, []
290
+ if has_terminal?('(', false, index)
291
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
292
+ @index += 1
301
293
  else
302
- r4 = instantiate_node(SyntaxNode,input, index...index)
294
+ terminal_parse_failure('(')
295
+ r3 = nil
303
296
  end
304
- s2 << r4
305
- if r4
306
- r6 = _nt_logical
307
- s2 << r6
308
- if r6
309
- r8 = _nt_space
310
- if r8
311
- r7 = r8
312
- else
313
- r7 = instantiate_node(SyntaxNode,input, index...index)
314
- end
315
- s2 << r7
316
- if r7
317
- if has_terminal?(')', false, index)
318
- r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
319
- @index += 1
297
+ s2 << r3
298
+ if r3
299
+ r5 = _nt_space
300
+ if r5
301
+ r4 = r5
302
+ else
303
+ r4 = instantiate_node(SyntaxNode,input, index...index)
304
+ end
305
+ s2 << r4
306
+ if r4
307
+ r6 = _nt_logical
308
+ s2 << r6
309
+ if r6
310
+ r8 = _nt_space
311
+ if r8
312
+ r7 = r8
320
313
  else
321
- terminal_parse_failure(')')
322
- r9 = nil
314
+ r7 = instantiate_node(SyntaxNode,input, index...index)
315
+ end
316
+ s2 << r7
317
+ if r7
318
+ if has_terminal?(')', false, index)
319
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
320
+ @index += 1
321
+ else
322
+ terminal_parse_failure(')')
323
+ r9 = nil
324
+ end
325
+ s2 << r9
323
326
  end
324
- s2 << r9
325
327
  end
326
328
  end
327
329
  end
328
- end
329
- if s2.last
330
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
331
- r2.extend(Truthval0)
332
- else
333
- @index = i2
334
- r2 = nil
335
- end
336
- if r2
337
- r0 = r2
338
- else
339
- r10 = _nt_boolean
340
- if r10
341
- r0 = r10
330
+ if s2.last
331
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
332
+ r2.extend(Truthval0)
342
333
  else
343
- @index = i0
344
- r0 = nil
334
+ @index = i2
335
+ r2 = nil
336
+ end
337
+ if r2
338
+ r0 = r2
339
+ else
340
+ r10 = _nt_boolean
341
+ if r10
342
+ r0 = r10
343
+ else
344
+ @index = i0
345
+ r0 = nil
346
+ end
345
347
  end
346
348
  end
347
- end
348
349
 
349
- node_cache[:truthval][start_index] = r0
350
+ node_cache[:truthval][start_index] = r0
350
351
 
351
- r0
352
- end
352
+ r0
353
+ end
353
354
 
354
- def _nt_boolean
355
- start_index = index
356
- if node_cache[:boolean].has_key?(index)
357
- cached = node_cache[:boolean][index]
358
- if cached
359
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
360
- @index = cached.interval.end
355
+ def _nt_boolean
356
+ start_index = index
357
+ if node_cache[:boolean].has_key?(index)
358
+ cached = node_cache[:boolean][index]
359
+ if cached
360
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
361
+ @index = cached.interval.end
362
+ end
363
+ return cached
361
364
  end
362
- return cached
363
- end
364
365
 
365
- i0 = index
366
- if has_terminal?('true', false, index)
367
- r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
368
- @index += 4
369
- else
370
- terminal_parse_failure('true')
371
- r1 = nil
372
- end
373
- if r1
374
- r0 = r1
375
- else
376
- if has_terminal?('false', false, index)
377
- r2 = instantiate_node(SyntaxNode,input, index...(index + 5))
378
- @index += 5
366
+ i0 = index
367
+ if has_terminal?('true', false, index)
368
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
369
+ @index += 4
379
370
  else
380
- terminal_parse_failure('false')
381
- r2 = nil
371
+ terminal_parse_failure('true')
372
+ r1 = nil
382
373
  end
383
- if r2
384
- r0 = r2
374
+ if r1
375
+ r0 = r1
385
376
  else
386
- if has_terminal?('TRUE', false, index)
387
- r3 = instantiate_node(SyntaxNode,input, index...(index + 4))
388
- @index += 4
377
+ if has_terminal?('false', false, index)
378
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 5))
379
+ @index += 5
389
380
  else
390
- terminal_parse_failure('TRUE')
391
- r3 = nil
381
+ terminal_parse_failure('false')
382
+ r2 = nil
392
383
  end
393
- if r3
394
- r0 = r3
384
+ if r2
385
+ r0 = r2
395
386
  else
396
- if has_terminal?('FALSE', false, index)
397
- r4 = instantiate_node(SyntaxNode,input, index...(index + 5))
398
- @index += 5
387
+ if has_terminal?('TRUE', false, index)
388
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 4))
389
+ @index += 4
399
390
  else
400
- terminal_parse_failure('FALSE')
401
- r4 = nil
391
+ terminal_parse_failure('TRUE')
392
+ r3 = nil
402
393
  end
403
- if r4
404
- r0 = r4
394
+ if r3
395
+ r0 = r3
405
396
  else
406
- @index = i0
407
- r0 = nil
397
+ if has_terminal?('FALSE', false, index)
398
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 5))
399
+ @index += 5
400
+ else
401
+ terminal_parse_failure('FALSE')
402
+ r4 = nil
403
+ end
404
+ if r4
405
+ r0 = r4
406
+ else
407
+ @index = i0
408
+ r0 = nil
409
+ end
408
410
  end
409
411
  end
410
412
  end
411
- end
412
413
 
413
- node_cache[:boolean][start_index] = r0
414
-
415
- r0
416
- end
414
+ node_cache[:boolean][start_index] = r0
417
415
 
418
- module Comparison0
419
- def comparator
420
- elements[1]
416
+ r0
421
417
  end
422
418
 
423
- def expression
424
- elements[3]
425
- end
426
- end
419
+ module Comparison0
420
+ def comparator
421
+ elements[1]
422
+ end
427
423
 
428
- module Comparison1
429
- def expression
430
- elements[0]
424
+ def expression
425
+ elements[3]
426
+ end
431
427
  end
432
428
 
433
- end
434
-
435
- def _nt_comparison
436
- start_index = index
437
- if node_cache[:comparison].has_key?(index)
438
- cached = node_cache[:comparison][index]
439
- if cached
440
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
441
- @index = cached.interval.end
429
+ module Comparison1
430
+ def expression
431
+ elements[0]
442
432
  end
443
- return cached
433
+
444
434
  end
445
435
 
446
- i0, s0 = index, []
447
- r1 = _nt_expression
448
- s0 << r1
449
- if r1
450
- s2, i2 = [], index
451
- loop do
452
- i3, s3 = index, []
453
- r5 = _nt_space
454
- if r5
455
- r4 = r5
456
- else
457
- r4 = instantiate_node(SyntaxNode,input, index...index)
436
+ def _nt_comparison
437
+ start_index = index
438
+ if node_cache[:comparison].has_key?(index)
439
+ cached = node_cache[:comparison][index]
440
+ if cached
441
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
442
+ @index = cached.interval.end
458
443
  end
459
- s3 << r4
460
- if r4
461
- r6 = _nt_comparator
462
- s3 << r6
463
- if r6
464
- r8 = _nt_space
465
- if r8
466
- r7 = r8
467
- else
468
- r7 = instantiate_node(SyntaxNode,input, index...index)
469
- end
470
- s3 << r7
471
- if r7
472
- r9 = _nt_expression
473
- s3 << r9
444
+ return cached
445
+ end
446
+
447
+ i0, s0 = index, []
448
+ r1 = _nt_expression
449
+ s0 << r1
450
+ if r1
451
+ s2, i2 = [], index
452
+ loop do
453
+ i3, s3 = index, []
454
+ r5 = _nt_space
455
+ if r5
456
+ r4 = r5
457
+ else
458
+ r4 = instantiate_node(SyntaxNode,input, index...index)
459
+ end
460
+ s3 << r4
461
+ if r4
462
+ r6 = _nt_comparator
463
+ s3 << r6
464
+ if r6
465
+ r8 = _nt_space
466
+ if r8
467
+ r7 = r8
468
+ else
469
+ r7 = instantiate_node(SyntaxNode,input, index...index)
470
+ end
471
+ s3 << r7
472
+ if r7
473
+ r9 = _nt_expression
474
+ s3 << r9
475
+ end
474
476
  end
475
477
  end
478
+ if s3.last
479
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
480
+ r3.extend(Comparison0)
481
+ else
482
+ @index = i3
483
+ r3 = nil
484
+ end
485
+ if r3
486
+ s2 << r3
487
+ else
488
+ break
489
+ end
476
490
  end
477
- if s3.last
478
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
479
- r3.extend(Comparison0)
480
- else
481
- @index = i3
482
- r3 = nil
483
- end
484
- if r3
485
- s2 << r3
486
- else
487
- break
488
- end
491
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
492
+ s0 << r2
493
+ end
494
+ if s0.last
495
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
496
+ r0.extend(Comparison1)
497
+ else
498
+ @index = i0
499
+ r0 = nil
489
500
  end
490
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
491
- s0 << r2
492
- end
493
- if s0.last
494
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
495
- r0.extend(Comparison1)
496
- else
497
- @index = i0
498
- r0 = nil
499
- end
500
501
 
501
- node_cache[:comparison][start_index] = r0
502
+ node_cache[:comparison][start_index] = r0
502
503
 
503
- r0
504
- end
504
+ r0
505
+ end
505
506
 
506
- def _nt_comparator
507
- start_index = index
508
- if node_cache[:comparator].has_key?(index)
509
- cached = node_cache[:comparator][index]
510
- if cached
511
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
512
- @index = cached.interval.end
507
+ def _nt_comparator
508
+ start_index = index
509
+ if node_cache[:comparator].has_key?(index)
510
+ cached = node_cache[:comparator][index]
511
+ if cached
512
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
513
+ @index = cached.interval.end
514
+ end
515
+ return cached
513
516
  end
514
- return cached
515
- end
516
517
 
517
- i0 = index
518
- if has_terminal?('=', false, index)
519
- r1 = instantiate_node(Equal,input, index...(index + 1))
520
- @index += 1
521
- else
522
- terminal_parse_failure('=')
523
- r1 = nil
524
- end
525
- if r1
526
- r0 = r1
527
- else
528
- if has_terminal?('<>', false, index)
529
- r2 = instantiate_node(NotEqual,input, index...(index + 2))
530
- @index += 2
518
+ i0 = index
519
+ if has_terminal?('=', false, index)
520
+ r1 = instantiate_node(Equal,input, index...(index + 1))
521
+ @index += 1
531
522
  else
532
- terminal_parse_failure('<>')
533
- r2 = nil
523
+ terminal_parse_failure('=')
524
+ r1 = nil
534
525
  end
535
- if r2
536
- r0 = r2
526
+ if r1
527
+ r0 = r1
537
528
  else
538
- if has_terminal?('>=', false, index)
539
- r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
529
+ if has_terminal?('<>', false, index)
530
+ r2 = instantiate_node(NotEqual,input, index...(index + 2))
540
531
  @index += 2
541
532
  else
542
- terminal_parse_failure('>=')
543
- r3 = nil
533
+ terminal_parse_failure('<>')
534
+ r2 = nil
544
535
  end
545
- if r3
546
- r0 = r3
536
+ if r2
537
+ r0 = r2
547
538
  else
548
- if has_terminal?('<=', false, index)
549
- r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
539
+ if has_terminal?('>=', false, index)
540
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
550
541
  @index += 2
551
542
  else
552
- terminal_parse_failure('<=')
553
- r4 = nil
543
+ terminal_parse_failure('>=')
544
+ r3 = nil
554
545
  end
555
- if r4
556
- r0 = r4
546
+ if r3
547
+ r0 = r3
557
548
  else
558
- if has_terminal?('>', false, index)
559
- r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
560
- @index += 1
549
+ if has_terminal?('<=', false, index)
550
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
551
+ @index += 2
561
552
  else
562
- terminal_parse_failure('>')
563
- r5 = nil
553
+ terminal_parse_failure('<=')
554
+ r4 = nil
564
555
  end
565
- if r5
566
- r0 = r5
556
+ if r4
557
+ r0 = r4
567
558
  else
568
- if has_terminal?('<', false, index)
569
- r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
559
+ if has_terminal?('>', false, index)
560
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
570
561
  @index += 1
571
562
  else
572
- terminal_parse_failure('<')
573
- r6 = nil
563
+ terminal_parse_failure('>')
564
+ r5 = nil
574
565
  end
575
- if r6
576
- r0 = r6
566
+ if r5
567
+ r0 = r5
577
568
  else
578
- @index = i0
579
- r0 = nil
569
+ if has_terminal?('<', false, index)
570
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
571
+ @index += 1
572
+ else
573
+ terminal_parse_failure('<')
574
+ r6 = nil
575
+ end
576
+ if r6
577
+ r0 = r6
578
+ else
579
+ @index = i0
580
+ r0 = nil
581
+ end
580
582
  end
581
583
  end
582
584
  end
583
585
  end
584
586
  end
585
- end
586
-
587
- node_cache[:comparator][start_index] = r0
588
587
 
589
- r0
590
- end
588
+ node_cache[:comparator][start_index] = r0
591
589
 
592
- module Expression0
593
- def additive_operator
594
- elements[1]
590
+ r0
595
591
  end
596
592
 
597
- def multiplicative
598
- elements[3]
599
- end
600
- end
593
+ module Expression0
594
+ def additive_operator
595
+ elements[1]
596
+ end
601
597
 
602
- module Expression1
603
- def multiplicative
604
- elements[0]
598
+ def multiplicative
599
+ elements[3]
600
+ end
605
601
  end
606
602
 
607
- end
608
-
609
- def _nt_expression
610
- start_index = index
611
- if node_cache[:expression].has_key?(index)
612
- cached = node_cache[:expression][index]
613
- if cached
614
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
615
- @index = cached.interval.end
603
+ module Expression1
604
+ def multiplicative
605
+ elements[0]
616
606
  end
617
- return cached
607
+
618
608
  end
619
609
 
620
- i0, s0 = index, []
621
- r1 = _nt_multiplicative
622
- s0 << r1
623
- if r1
624
- s2, i2 = [], index
625
- loop do
626
- i3, s3 = index, []
627
- r5 = _nt_space
628
- if r5
629
- r4 = r5
630
- else
631
- r4 = instantiate_node(SyntaxNode,input, index...index)
610
+ def _nt_expression
611
+ start_index = index
612
+ if node_cache[:expression].has_key?(index)
613
+ cached = node_cache[:expression][index]
614
+ if cached
615
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
616
+ @index = cached.interval.end
632
617
  end
633
- s3 << r4
634
- if r4
635
- r6 = _nt_additive_operator
636
- s3 << r6
637
- if r6
638
- r8 = _nt_space
639
- if r8
640
- r7 = r8
641
- else
642
- r7 = instantiate_node(SyntaxNode,input, index...index)
643
- end
644
- s3 << r7
645
- if r7
646
- r9 = _nt_multiplicative
647
- s3 << r9
618
+ return cached
619
+ end
620
+
621
+ i0, s0 = index, []
622
+ r1 = _nt_multiplicative
623
+ s0 << r1
624
+ if r1
625
+ s2, i2 = [], index
626
+ loop do
627
+ i3, s3 = index, []
628
+ r5 = _nt_space
629
+ if r5
630
+ r4 = r5
631
+ else
632
+ r4 = instantiate_node(SyntaxNode,input, index...index)
633
+ end
634
+ s3 << r4
635
+ if r4
636
+ r6 = _nt_additive_operator
637
+ s3 << r6
638
+ if r6
639
+ r8 = _nt_space
640
+ if r8
641
+ r7 = r8
642
+ else
643
+ r7 = instantiate_node(SyntaxNode,input, index...index)
644
+ end
645
+ s3 << r7
646
+ if r7
647
+ r9 = _nt_multiplicative
648
+ s3 << r9
649
+ end
648
650
  end
649
651
  end
652
+ if s3.last
653
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
654
+ r3.extend(Expression0)
655
+ else
656
+ @index = i3
657
+ r3 = nil
658
+ end
659
+ if r3
660
+ s2 << r3
661
+ else
662
+ break
663
+ end
650
664
  end
651
- if s3.last
652
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
653
- r3.extend(Expression0)
654
- else
655
- @index = i3
656
- r3 = nil
657
- end
658
- if r3
659
- s2 << r3
660
- else
661
- break
662
- end
665
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
666
+ s0 << r2
667
+ end
668
+ if s0.last
669
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
670
+ r0.extend(Expression1)
671
+ else
672
+ @index = i0
673
+ r0 = nil
663
674
  end
664
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
665
- s0 << r2
666
- end
667
- if s0.last
668
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
669
- r0.extend(Expression1)
670
- else
671
- @index = i0
672
- r0 = nil
673
- end
674
675
 
675
- node_cache[:expression][start_index] = r0
676
+ node_cache[:expression][start_index] = r0
676
677
 
677
- r0
678
- end
678
+ r0
679
+ end
679
680
 
680
- def _nt_additive_operator
681
- start_index = index
682
- if node_cache[:additive_operator].has_key?(index)
683
- cached = node_cache[:additive_operator][index]
684
- if cached
685
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
686
- @index = cached.interval.end
681
+ def _nt_additive_operator
682
+ start_index = index
683
+ if node_cache[:additive_operator].has_key?(index)
684
+ cached = node_cache[:additive_operator][index]
685
+ if cached
686
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
687
+ @index = cached.interval.end
688
+ end
689
+ return cached
687
690
  end
688
- return cached
689
- end
690
691
 
691
- i0 = index
692
- if has_terminal?('+', false, index)
693
- r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
694
- @index += 1
695
- else
696
- terminal_parse_failure('+')
697
- r1 = nil
698
- end
699
- if r1
700
- r0 = r1
701
- else
702
- if has_terminal?('-', false, index)
703
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
692
+ i0 = index
693
+ if has_terminal?('+', false, index)
694
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
704
695
  @index += 1
705
696
  else
706
- terminal_parse_failure('-')
707
- r2 = nil
697
+ terminal_parse_failure('+')
698
+ r1 = nil
708
699
  end
709
- if r2
710
- r0 = r2
700
+ if r1
701
+ r0 = r1
711
702
  else
712
- @index = i0
713
- r0 = nil
703
+ if has_terminal?('-', false, index)
704
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
705
+ @index += 1
706
+ else
707
+ terminal_parse_failure('-')
708
+ r2 = nil
709
+ end
710
+ if r2
711
+ r0 = r2
712
+ else
713
+ @index = i0
714
+ r0 = nil
715
+ end
714
716
  end
715
- end
716
-
717
- node_cache[:additive_operator][start_index] = r0
718
717
 
719
- r0
720
- end
718
+ node_cache[:additive_operator][start_index] = r0
721
719
 
722
- module Multiplicative0
723
- def multiplicative_operator
724
- elements[1]
720
+ r0
725
721
  end
726
722
 
727
- def value
728
- elements[3]
729
- end
730
- end
723
+ module Multiplicative0
724
+ def multiplicative_operator
725
+ elements[1]
726
+ end
731
727
 
732
- module Multiplicative1
733
- def value
734
- elements[0]
728
+ def value
729
+ elements[3]
730
+ end
735
731
  end
736
732
 
737
- end
738
-
739
- def _nt_multiplicative
740
- start_index = index
741
- if node_cache[:multiplicative].has_key?(index)
742
- cached = node_cache[:multiplicative][index]
743
- if cached
744
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
745
- @index = cached.interval.end
733
+ module Multiplicative1
734
+ def value
735
+ elements[0]
746
736
  end
747
- return cached
737
+
748
738
  end
749
739
 
750
- i0, s0 = index, []
751
- r1 = _nt_value
752
- s0 << r1
753
- if r1
754
- s2, i2 = [], index
755
- loop do
756
- i3, s3 = index, []
757
- r5 = _nt_space
758
- if r5
759
- r4 = r5
760
- else
761
- r4 = instantiate_node(SyntaxNode,input, index...index)
740
+ def _nt_multiplicative
741
+ start_index = index
742
+ if node_cache[:multiplicative].has_key?(index)
743
+ cached = node_cache[:multiplicative][index]
744
+ if cached
745
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
746
+ @index = cached.interval.end
762
747
  end
763
- s3 << r4
764
- if r4
765
- r6 = _nt_multiplicative_operator
766
- s3 << r6
767
- if r6
768
- r8 = _nt_space
769
- if r8
770
- r7 = r8
771
- else
772
- r7 = instantiate_node(SyntaxNode,input, index...index)
773
- end
774
- s3 << r7
775
- if r7
776
- r9 = _nt_value
777
- s3 << r9
748
+ return cached
749
+ end
750
+
751
+ i0, s0 = index, []
752
+ r1 = _nt_value
753
+ s0 << r1
754
+ if r1
755
+ s2, i2 = [], index
756
+ loop do
757
+ i3, s3 = index, []
758
+ r5 = _nt_space
759
+ if r5
760
+ r4 = r5
761
+ else
762
+ r4 = instantiate_node(SyntaxNode,input, index...index)
763
+ end
764
+ s3 << r4
765
+ if r4
766
+ r6 = _nt_multiplicative_operator
767
+ s3 << r6
768
+ if r6
769
+ r8 = _nt_space
770
+ if r8
771
+ r7 = r8
772
+ else
773
+ r7 = instantiate_node(SyntaxNode,input, index...index)
774
+ end
775
+ s3 << r7
776
+ if r7
777
+ r9 = _nt_value
778
+ s3 << r9
779
+ end
778
780
  end
779
781
  end
782
+ if s3.last
783
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
784
+ r3.extend(Multiplicative0)
785
+ else
786
+ @index = i3
787
+ r3 = nil
788
+ end
789
+ if r3
790
+ s2 << r3
791
+ else
792
+ break
793
+ end
780
794
  end
781
- if s3.last
782
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
783
- r3.extend(Multiplicative0)
784
- else
785
- @index = i3
786
- r3 = nil
787
- end
788
- if r3
789
- s2 << r3
790
- else
791
- break
792
- end
795
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
796
+ s0 << r2
797
+ end
798
+ if s0.last
799
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
800
+ r0.extend(Multiplicative1)
801
+ else
802
+ @index = i0
803
+ r0 = nil
793
804
  end
794
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
795
- s0 << r2
796
- end
797
- if s0.last
798
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
799
- r0.extend(Multiplicative1)
800
- else
801
- @index = i0
802
- r0 = nil
803
- end
804
805
 
805
- node_cache[:multiplicative][start_index] = r0
806
+ node_cache[:multiplicative][start_index] = r0
806
807
 
807
- r0
808
- end
808
+ r0
809
+ end
809
810
 
810
- def _nt_multiplicative_operator
811
- start_index = index
812
- if node_cache[:multiplicative_operator].has_key?(index)
813
- cached = node_cache[:multiplicative_operator][index]
814
- if cached
815
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
816
- @index = cached.interval.end
811
+ def _nt_multiplicative_operator
812
+ start_index = index
813
+ if node_cache[:multiplicative_operator].has_key?(index)
814
+ cached = node_cache[:multiplicative_operator][index]
815
+ if cached
816
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
817
+ @index = cached.interval.end
818
+ end
819
+ return cached
817
820
  end
818
- return cached
819
- end
820
821
 
821
- i0 = index
822
- if has_terminal?('^', false, index)
823
- r1 = instantiate_node(Pow,input, index...(index + 1))
824
- @index += 1
825
- else
826
- terminal_parse_failure('^')
827
- r1 = nil
828
- end
829
- if r1
830
- r0 = r1
831
- else
832
- if has_terminal?('*', false, index)
833
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
822
+ i0 = index
823
+ if has_terminal?('^', false, index)
824
+ r1 = instantiate_node(Pow,input, index...(index + 1))
834
825
  @index += 1
835
826
  else
836
- terminal_parse_failure('*')
837
- r2 = nil
827
+ terminal_parse_failure('^')
828
+ r1 = nil
838
829
  end
839
- if r2
840
- r0 = r2
830
+ if r1
831
+ r0 = r1
841
832
  else
842
- if has_terminal?('/', false, index)
843
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
833
+ if has_terminal?('*', false, index)
834
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
844
835
  @index += 1
845
836
  else
846
- terminal_parse_failure('/')
847
- r3 = nil
837
+ terminal_parse_failure('*')
838
+ r2 = nil
848
839
  end
849
- if r3
850
- r0 = r3
840
+ if r2
841
+ r0 = r2
851
842
  else
852
- @index = i0
853
- r0 = nil
843
+ if has_terminal?('/', false, index)
844
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
845
+ @index += 1
846
+ else
847
+ terminal_parse_failure('/')
848
+ r3 = nil
849
+ end
850
+ if r3
851
+ r0 = r3
852
+ else
853
+ @index = i0
854
+ r0 = nil
855
+ end
854
856
  end
855
857
  end
856
- end
857
858
 
858
- node_cache[:multiplicative_operator][start_index] = r0
859
+ node_cache[:multiplicative_operator][start_index] = r0
859
860
 
860
- r0
861
- end
862
-
863
- module Value0
864
- def expression
865
- elements[2]
861
+ r0
866
862
  end
867
863
 
868
- end
864
+ module Value0
865
+ def expression
866
+ elements[2]
867
+ end
869
868
 
870
- module Value1
871
- def value
872
- elements[1]
873
869
  end
874
- end
875
870
 
876
- def _nt_value
877
- start_index = index
878
- if node_cache[:value].has_key?(index)
879
- cached = node_cache[:value][index]
880
- if cached
881
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
882
- @index = cached.interval.end
871
+ module Value1
872
+ def value
873
+ elements[1]
883
874
  end
884
- return cached
885
875
  end
886
876
 
887
- i0 = index
888
- r1 = _nt_function
889
- if r1
890
- r0 = r1
891
- else
892
- i2, s2 = index, []
893
- if has_terminal?('(', false, index)
894
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
895
- @index += 1
877
+ def _nt_value
878
+ start_index = index
879
+ if node_cache[:value].has_key?(index)
880
+ cached = node_cache[:value][index]
881
+ if cached
882
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
883
+ @index = cached.interval.end
884
+ end
885
+ return cached
886
+ end
887
+
888
+ i0 = index
889
+ r1 = _nt_function
890
+ if r1
891
+ r0 = r1
896
892
  else
897
- terminal_parse_failure('(')
898
- r3 = nil
899
- end
900
- s2 << r3
901
- if r3
902
- r5 = _nt_space
903
- if r5
904
- r4 = r5
893
+ i2, s2 = index, []
894
+ if has_terminal?('(', false, index)
895
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
896
+ @index += 1
905
897
  else
906
- r4 = instantiate_node(SyntaxNode,input, index...index)
898
+ terminal_parse_failure('(')
899
+ r3 = nil
907
900
  end
908
- s2 << r4
909
- if r4
910
- r6 = _nt_expression
911
- s2 << r6
912
- if r6
913
- r8 = _nt_space
914
- if r8
915
- r7 = r8
916
- else
917
- r7 = instantiate_node(SyntaxNode,input, index...index)
918
- end
919
- s2 << r7
920
- if r7
921
- if has_terminal?(')', false, index)
922
- r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
923
- @index += 1
901
+ s2 << r3
902
+ if r3
903
+ r5 = _nt_space
904
+ if r5
905
+ r4 = r5
906
+ else
907
+ r4 = instantiate_node(SyntaxNode,input, index...index)
908
+ end
909
+ s2 << r4
910
+ if r4
911
+ r6 = _nt_expression
912
+ s2 << r6
913
+ if r6
914
+ r8 = _nt_space
915
+ if r8
916
+ r7 = r8
924
917
  else
925
- terminal_parse_failure(')')
926
- r9 = nil
918
+ r7 = instantiate_node(SyntaxNode,input, index...index)
919
+ end
920
+ s2 << r7
921
+ if r7
922
+ if has_terminal?(')', false, index)
923
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
924
+ @index += 1
925
+ else
926
+ terminal_parse_failure(')')
927
+ r9 = nil
928
+ end
929
+ s2 << r9
927
930
  end
928
- s2 << r9
929
931
  end
930
932
  end
931
933
  end
932
- end
933
- if s2.last
934
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
935
- r2.extend(Value0)
936
- else
937
- @index = i2
938
- r2 = nil
939
- end
940
- if r2
941
- r0 = r2
942
- else
943
- r10 = _nt_range
944
- if r10
945
- r0 = r10
934
+ if s2.last
935
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
936
+ r2.extend(Value0)
946
937
  else
947
- r11 = _nt_number
948
- if r11
949
- r0 = r11
938
+ @index = i2
939
+ r2 = nil
940
+ end
941
+ if r2
942
+ r0 = r2
943
+ else
944
+ r10 = _nt_range
945
+ if r10
946
+ r0 = r10
950
947
  else
951
- r12 = _nt_boolean
952
- if r12
953
- r0 = r12
948
+ r11 = _nt_number
949
+ if r11
950
+ r0 = r11
954
951
  else
955
- r13 = _nt_identifier
956
- if r13
957
- r0 = r13
952
+ r12 = _nt_boolean
953
+ if r12
954
+ r0 = r12
958
955
  else
959
- r14 = _nt_string
960
- if r14
961
- r0 = r14
956
+ r13 = _nt_identifier
957
+ if r13
958
+ r0 = r13
962
959
  else
963
- i15, s15 = index, []
964
- if has_terminal?('-', false, index)
965
- r16 = instantiate_node(SyntaxNode,input, index...(index + 1))
966
- @index += 1
967
- else
968
- terminal_parse_failure('-')
969
- r16 = nil
970
- end
971
- s15 << r16
972
- if r16
973
- r17 = _nt_value
974
- s15 << r17
975
- end
976
- if s15.last
977
- r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
978
- r15.extend(Value1)
979
- else
980
- @index = i15
981
- r15 = nil
982
- end
983
- if r15
984
- r0 = r15
960
+ r14 = _nt_string
961
+ if r14
962
+ r0 = r14
985
963
  else
986
- @index = i0
987
- r0 = nil
964
+ i15, s15 = index, []
965
+ if has_terminal?('-', false, index)
966
+ r16 = instantiate_node(SyntaxNode,input, index...(index + 1))
967
+ @index += 1
968
+ else
969
+ terminal_parse_failure('-')
970
+ r16 = nil
971
+ end
972
+ s15 << r16
973
+ if r16
974
+ r17 = _nt_value
975
+ s15 << r17
976
+ end
977
+ if s15.last
978
+ r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
979
+ r15.extend(Value1)
980
+ else
981
+ @index = i15
982
+ r15 = nil
983
+ end
984
+ if r15
985
+ r0 = r15
986
+ else
987
+ @index = i0
988
+ r0 = nil
989
+ end
988
990
  end
989
991
  end
990
992
  end
@@ -992,883 +994,883 @@ module Soroban
992
994
  end
993
995
  end
994
996
  end
995
- end
996
997
 
997
- node_cache[:value][start_index] = r0
998
+ node_cache[:value][start_index] = r0
998
999
 
999
- r0
1000
- end
1000
+ r0
1001
+ end
1001
1002
 
1002
- module Function0
1003
- end
1003
+ module Function0
1004
+ end
1004
1005
 
1005
- def _nt_function
1006
- start_index = index
1007
- if node_cache[:function].has_key?(index)
1008
- cached = node_cache[:function][index]
1009
- if cached
1010
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1011
- @index = cached.interval.end
1006
+ def _nt_function
1007
+ start_index = index
1008
+ if node_cache[:function].has_key?(index)
1009
+ cached = node_cache[:function][index]
1010
+ if cached
1011
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1012
+ @index = cached.interval.end
1013
+ end
1014
+ return cached
1012
1015
  end
1013
- return cached
1014
- end
1015
1016
 
1016
- i0, s0 = index, []
1017
- s1, i1 = [], index
1018
- loop do
1019
- if has_terminal?('\G[a-zA-Z]', true, index)
1020
- r2 = true
1021
- @index += 1
1022
- else
1023
- r2 = nil
1017
+ i0, s0 = index, []
1018
+ s1, i1 = [], index
1019
+ loop do
1020
+ if has_terminal?('\G[a-zA-Z]', true, index)
1021
+ r2 = true
1022
+ @index += 1
1023
+ else
1024
+ r2 = nil
1025
+ end
1026
+ if r2
1027
+ s1 << r2
1028
+ else
1029
+ break
1030
+ end
1024
1031
  end
1025
- if r2
1026
- s1 << r2
1032
+ if s1.empty?
1033
+ @index = i1
1034
+ r1 = nil
1027
1035
  else
1028
- break
1036
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1029
1037
  end
1030
- end
1031
- if s1.empty?
1032
- @index = i1
1033
- r1 = nil
1034
- else
1035
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1036
- end
1037
- s0 << r1
1038
- if r1
1039
- if has_terminal?('(', false, index)
1040
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
1041
- @index += 1
1042
- else
1043
- terminal_parse_failure('(')
1044
- r3 = nil
1045
- end
1046
- s0 << r3
1047
- if r3
1048
- r5 = _nt_space
1049
- if r5
1050
- r4 = r5
1038
+ s0 << r1
1039
+ if r1
1040
+ if has_terminal?('(', false, index)
1041
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
1042
+ @index += 1
1051
1043
  else
1052
- r4 = instantiate_node(SyntaxNode,input, index...index)
1044
+ terminal_parse_failure('(')
1045
+ r3 = nil
1053
1046
  end
1054
- s0 << r4
1055
- if r4
1056
- r7 = _nt_arguments
1057
- if r7
1058
- r6 = r7
1047
+ s0 << r3
1048
+ if r3
1049
+ r5 = _nt_space
1050
+ if r5
1051
+ r4 = r5
1059
1052
  else
1060
- r6 = instantiate_node(SyntaxNode,input, index...index)
1053
+ r4 = instantiate_node(SyntaxNode,input, index...index)
1061
1054
  end
1062
- s0 << r6
1063
- if r6
1064
- r9 = _nt_space
1065
- if r9
1066
- r8 = r9
1055
+ s0 << r4
1056
+ if r4
1057
+ r7 = _nt_arguments
1058
+ if r7
1059
+ r6 = r7
1067
1060
  else
1068
- r8 = instantiate_node(SyntaxNode,input, index...index)
1061
+ r6 = instantiate_node(SyntaxNode,input, index...index)
1069
1062
  end
1070
- s0 << r8
1071
- if r8
1072
- if has_terminal?(')', false, index)
1073
- r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
1074
- @index += 1
1063
+ s0 << r6
1064
+ if r6
1065
+ r9 = _nt_space
1066
+ if r9
1067
+ r8 = r9
1075
1068
  else
1076
- terminal_parse_failure(')')
1077
- r10 = nil
1069
+ r8 = instantiate_node(SyntaxNode,input, index...index)
1070
+ end
1071
+ s0 << r8
1072
+ if r8
1073
+ if has_terminal?(')', false, index)
1074
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
1075
+ @index += 1
1076
+ else
1077
+ terminal_parse_failure(')')
1078
+ r10 = nil
1079
+ end
1080
+ s0 << r10
1078
1081
  end
1079
- s0 << r10
1080
1082
  end
1081
1083
  end
1082
1084
  end
1083
1085
  end
1084
- end
1085
- if s0.last
1086
- r0 = instantiate_node(Function,input, i0...index, s0)
1087
- r0.extend(Function0)
1088
- else
1089
- @index = i0
1090
- r0 = nil
1091
- end
1092
-
1093
- node_cache[:function][start_index] = r0
1086
+ if s0.last
1087
+ r0 = instantiate_node(Function,input, i0...index, s0)
1088
+ r0.extend(Function0)
1089
+ else
1090
+ @index = i0
1091
+ r0 = nil
1092
+ end
1094
1093
 
1095
- r0
1096
- end
1094
+ node_cache[:function][start_index] = r0
1097
1095
 
1098
- module Arguments0
1099
- def logical
1100
- elements[3]
1096
+ r0
1101
1097
  end
1102
- end
1103
1098
 
1104
- module Arguments1
1105
- def logical
1106
- elements[0]
1099
+ module Arguments0
1100
+ def logical
1101
+ elements[3]
1102
+ end
1107
1103
  end
1108
1104
 
1109
- end
1110
-
1111
- def _nt_arguments
1112
- start_index = index
1113
- if node_cache[:arguments].has_key?(index)
1114
- cached = node_cache[:arguments][index]
1115
- if cached
1116
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1117
- @index = cached.interval.end
1105
+ module Arguments1
1106
+ def logical
1107
+ elements[0]
1118
1108
  end
1119
- return cached
1109
+
1120
1110
  end
1121
1111
 
1122
- i0, s0 = index, []
1123
- r1 = _nt_logical
1124
- s0 << r1
1125
- if r1
1126
- s2, i2 = [], index
1127
- loop do
1128
- i3, s3 = index, []
1129
- r5 = _nt_space
1130
- if r5
1131
- r4 = r5
1132
- else
1133
- r4 = instantiate_node(SyntaxNode,input, index...index)
1112
+ def _nt_arguments
1113
+ start_index = index
1114
+ if node_cache[:arguments].has_key?(index)
1115
+ cached = node_cache[:arguments][index]
1116
+ if cached
1117
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1118
+ @index = cached.interval.end
1134
1119
  end
1135
- s3 << r4
1136
- if r4
1137
- if has_terminal?(',', false, index)
1138
- r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
1139
- @index += 1
1120
+ return cached
1121
+ end
1122
+
1123
+ i0, s0 = index, []
1124
+ r1 = _nt_logical
1125
+ s0 << r1
1126
+ if r1
1127
+ s2, i2 = [], index
1128
+ loop do
1129
+ i3, s3 = index, []
1130
+ r5 = _nt_space
1131
+ if r5
1132
+ r4 = r5
1140
1133
  else
1141
- terminal_parse_failure(',')
1142
- r6 = nil
1134
+ r4 = instantiate_node(SyntaxNode,input, index...index)
1143
1135
  end
1144
- s3 << r6
1145
- if r6
1146
- r8 = _nt_space
1147
- if r8
1148
- r7 = r8
1136
+ s3 << r4
1137
+ if r4
1138
+ if has_terminal?(',', false, index)
1139
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
1140
+ @index += 1
1149
1141
  else
1150
- r7 = instantiate_node(SyntaxNode,input, index...index)
1142
+ terminal_parse_failure(',')
1143
+ r6 = nil
1151
1144
  end
1152
- s3 << r7
1153
- if r7
1154
- r9 = _nt_logical
1155
- s3 << r9
1145
+ s3 << r6
1146
+ if r6
1147
+ r8 = _nt_space
1148
+ if r8
1149
+ r7 = r8
1150
+ else
1151
+ r7 = instantiate_node(SyntaxNode,input, index...index)
1152
+ end
1153
+ s3 << r7
1154
+ if r7
1155
+ r9 = _nt_logical
1156
+ s3 << r9
1157
+ end
1156
1158
  end
1157
1159
  end
1160
+ if s3.last
1161
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1162
+ r3.extend(Arguments0)
1163
+ else
1164
+ @index = i3
1165
+ r3 = nil
1166
+ end
1167
+ if r3
1168
+ s2 << r3
1169
+ else
1170
+ break
1171
+ end
1158
1172
  end
1159
- if s3.last
1160
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1161
- r3.extend(Arguments0)
1162
- else
1163
- @index = i3
1164
- r3 = nil
1165
- end
1166
- if r3
1167
- s2 << r3
1168
- else
1169
- break
1170
- end
1173
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1174
+ s0 << r2
1175
+ end
1176
+ if s0.last
1177
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1178
+ r0.extend(Arguments1)
1179
+ else
1180
+ @index = i0
1181
+ r0 = nil
1171
1182
  end
1172
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1173
- s0 << r2
1174
- end
1175
- if s0.last
1176
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1177
- r0.extend(Arguments1)
1178
- else
1179
- @index = i0
1180
- r0 = nil
1181
- end
1182
-
1183
- node_cache[:arguments][start_index] = r0
1184
1183
 
1185
- r0
1186
- end
1184
+ node_cache[:arguments][start_index] = r0
1187
1185
 
1188
- module Number0
1189
- def float
1190
- elements[1]
1186
+ r0
1191
1187
  end
1192
- end
1193
1188
 
1194
- module Number1
1195
- def integer
1196
- elements[1]
1189
+ module Number0
1190
+ def float
1191
+ elements[1]
1192
+ end
1197
1193
  end
1198
- end
1199
1194
 
1200
- def _nt_number
1201
- start_index = index
1202
- if node_cache[:number].has_key?(index)
1203
- cached = node_cache[:number][index]
1204
- if cached
1205
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1206
- @index = cached.interval.end
1195
+ module Number1
1196
+ def integer
1197
+ elements[1]
1207
1198
  end
1208
- return cached
1209
1199
  end
1210
1200
 
1211
- i0 = index
1212
- r1 = _nt_float
1213
- if r1
1214
- r0 = r1
1215
- else
1216
- r2 = _nt_integer
1217
- if r2
1218
- r0 = r2
1219
- else
1220
- i3, s3 = index, []
1221
- if has_terminal?('-', false, index)
1222
- r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
1223
- @index += 1
1224
- else
1225
- terminal_parse_failure('-')
1226
- r4 = nil
1227
- end
1228
- s3 << r4
1229
- if r4
1230
- r5 = _nt_float
1231
- s3 << r5
1201
+ def _nt_number
1202
+ start_index = index
1203
+ if node_cache[:number].has_key?(index)
1204
+ cached = node_cache[:number][index]
1205
+ if cached
1206
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1207
+ @index = cached.interval.end
1232
1208
  end
1233
- if s3.last
1234
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1235
- r3.extend(Number0)
1236
- else
1237
- @index = i3
1238
- r3 = nil
1239
- end
1240
- if r3
1241
- r0 = r3
1209
+ return cached
1210
+ end
1211
+
1212
+ i0 = index
1213
+ r1 = _nt_float
1214
+ if r1
1215
+ r0 = r1
1216
+ else
1217
+ r2 = _nt_integer
1218
+ if r2
1219
+ r0 = r2
1242
1220
  else
1243
- i6, s6 = index, []
1221
+ i3, s3 = index, []
1244
1222
  if has_terminal?('-', false, index)
1245
- r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
1223
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
1246
1224
  @index += 1
1247
1225
  else
1248
1226
  terminal_parse_failure('-')
1249
- r7 = nil
1227
+ r4 = nil
1250
1228
  end
1251
- s6 << r7
1252
- if r7
1253
- r8 = _nt_integer
1254
- s6 << r8
1229
+ s3 << r4
1230
+ if r4
1231
+ r5 = _nt_float
1232
+ s3 << r5
1255
1233
  end
1256
- if s6.last
1257
- r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
1258
- r6.extend(Number1)
1234
+ if s3.last
1235
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1236
+ r3.extend(Number0)
1259
1237
  else
1260
- @index = i6
1261
- r6 = nil
1238
+ @index = i3
1239
+ r3 = nil
1262
1240
  end
1263
- if r6
1264
- r0 = r6
1241
+ if r3
1242
+ r0 = r3
1265
1243
  else
1266
- @index = i0
1267
- r0 = nil
1244
+ i6, s6 = index, []
1245
+ if has_terminal?('-', false, index)
1246
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
1247
+ @index += 1
1248
+ else
1249
+ terminal_parse_failure('-')
1250
+ r7 = nil
1251
+ end
1252
+ s6 << r7
1253
+ if r7
1254
+ r8 = _nt_integer
1255
+ s6 << r8
1256
+ end
1257
+ if s6.last
1258
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
1259
+ r6.extend(Number1)
1260
+ else
1261
+ @index = i6
1262
+ r6 = nil
1263
+ end
1264
+ if r6
1265
+ r0 = r6
1266
+ else
1267
+ @index = i0
1268
+ r0 = nil
1269
+ end
1268
1270
  end
1269
1271
  end
1270
1272
  end
1271
- end
1272
-
1273
- node_cache[:number][start_index] = r0
1274
1273
 
1275
- r0
1276
- end
1274
+ node_cache[:number][start_index] = r0
1277
1275
 
1278
- module Float0
1279
- end
1276
+ r0
1277
+ end
1280
1278
 
1281
- def _nt_float
1282
- start_index = index
1283
- if node_cache[:float].has_key?(index)
1284
- cached = node_cache[:float][index]
1285
- if cached
1286
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1287
- @index = cached.interval.end
1288
- end
1289
- return cached
1279
+ module Float0
1290
1280
  end
1291
1281
 
1292
- i0, s0 = index, []
1293
- s1, i1 = [], index
1294
- loop do
1295
- if has_terminal?('\G[0-9]', true, index)
1296
- r2 = true
1297
- @index += 1
1298
- else
1299
- r2 = nil
1300
- end
1301
- if r2
1302
- s1 << r2
1303
- else
1304
- break
1282
+ def _nt_float
1283
+ start_index = index
1284
+ if node_cache[:float].has_key?(index)
1285
+ cached = node_cache[:float][index]
1286
+ if cached
1287
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1288
+ @index = cached.interval.end
1289
+ end
1290
+ return cached
1305
1291
  end
1306
- end
1307
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1308
- s0 << r1
1309
- if r1
1310
- if has_terminal?('.', false, index)
1311
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
1312
- @index += 1
1313
- else
1314
- terminal_parse_failure('.')
1315
- r3 = nil
1292
+
1293
+ i0, s0 = index, []
1294
+ s1, i1 = [], index
1295
+ loop do
1296
+ if has_terminal?('\G[0-9]', true, index)
1297
+ r2 = true
1298
+ @index += 1
1299
+ else
1300
+ r2 = nil
1301
+ end
1302
+ if r2
1303
+ s1 << r2
1304
+ else
1305
+ break
1306
+ end
1316
1307
  end
1317
- s0 << r3
1318
- if r3
1319
- s4, i4 = [], index
1320
- loop do
1321
- if has_terminal?('\G[0-9]', true, index)
1322
- r5 = true
1323
- @index += 1
1324
- else
1325
- r5 = nil
1308
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1309
+ s0 << r1
1310
+ if r1
1311
+ if has_terminal?('.', false, index)
1312
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
1313
+ @index += 1
1314
+ else
1315
+ terminal_parse_failure('.')
1316
+ r3 = nil
1317
+ end
1318
+ s0 << r3
1319
+ if r3
1320
+ s4, i4 = [], index
1321
+ loop do
1322
+ if has_terminal?('\G[0-9]', true, index)
1323
+ r5 = true
1324
+ @index += 1
1325
+ else
1326
+ r5 = nil
1327
+ end
1328
+ if r5
1329
+ s4 << r5
1330
+ else
1331
+ break
1332
+ end
1326
1333
  end
1327
- if r5
1328
- s4 << r5
1334
+ if s4.empty?
1335
+ @index = i4
1336
+ r4 = nil
1329
1337
  else
1330
- break
1338
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
1331
1339
  end
1340
+ s0 << r4
1332
1341
  end
1333
- if s4.empty?
1334
- @index = i4
1335
- r4 = nil
1336
- else
1337
- r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
1338
- end
1339
- s0 << r4
1340
- end
1341
- end
1342
- if s0.last
1343
- r0 = instantiate_node(FloatValue,input, i0...index, s0)
1344
- r0.extend(Float0)
1345
- else
1346
- @index = i0
1347
- r0 = nil
1348
- end
1349
-
1350
- node_cache[:float][start_index] = r0
1351
-
1352
- r0
1353
- end
1354
-
1355
- def _nt_integer
1356
- start_index = index
1357
- if node_cache[:integer].has_key?(index)
1358
- cached = node_cache[:integer][index]
1359
- if cached
1360
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1361
- @index = cached.interval.end
1362
1342
  end
1363
- return cached
1364
- end
1365
-
1366
- s0, i0 = [], index
1367
- loop do
1368
- if has_terminal?('\G[0-9]', true, index)
1369
- r1 = true
1370
- @index += 1
1343
+ if s0.last
1344
+ r0 = instantiate_node(FloatValue,input, i0...index, s0)
1345
+ r0.extend(Float0)
1371
1346
  else
1372
- r1 = nil
1373
- end
1374
- if r1
1375
- s0 << r1
1376
- else
1377
- break
1347
+ @index = i0
1348
+ r0 = nil
1378
1349
  end
1379
- end
1380
- if s0.empty?
1381
- @index = i0
1382
- r0 = nil
1383
- else
1384
- r0 = instantiate_node(IntegerValue,input, i0...index, s0)
1385
- end
1386
1350
 
1387
- node_cache[:integer][start_index] = r0
1388
-
1389
- r0
1390
- end
1351
+ node_cache[:float][start_index] = r0
1391
1352
 
1392
- module Identifier0
1393
- end
1353
+ r0
1354
+ end
1394
1355
 
1395
- def _nt_identifier
1396
- start_index = index
1397
- if node_cache[:identifier].has_key?(index)
1398
- cached = node_cache[:identifier][index]
1399
- if cached
1400
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1401
- @index = cached.interval.end
1356
+ def _nt_integer
1357
+ start_index = index
1358
+ if node_cache[:integer].has_key?(index)
1359
+ cached = node_cache[:integer][index]
1360
+ if cached
1361
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1362
+ @index = cached.interval.end
1363
+ end
1364
+ return cached
1402
1365
  end
1403
- return cached
1404
- end
1405
1366
 
1406
- i0, s0 = index, []
1407
- if has_terminal?('\G[a-zA-Z]', true, index)
1408
- r1 = true
1409
- @index += 1
1410
- else
1411
- r1 = nil
1412
- end
1413
- s0 << r1
1414
- if r1
1415
- s2, i2 = [], index
1367
+ s0, i0 = [], index
1416
1368
  loop do
1417
- if has_terminal?('\G[a-zA-Z0-9]', true, index)
1418
- r3 = true
1369
+ if has_terminal?('\G[0-9]', true, index)
1370
+ r1 = true
1419
1371
  @index += 1
1420
1372
  else
1421
- r3 = nil
1373
+ r1 = nil
1422
1374
  end
1423
- if r3
1424
- s2 << r3
1375
+ if r1
1376
+ s0 << r1
1425
1377
  else
1426
1378
  break
1427
1379
  end
1428
1380
  end
1429
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1430
- s0 << r2
1431
- end
1432
- if s0.last
1433
- r0 = instantiate_node(Identifier,input, i0...index, s0)
1434
- r0.extend(Identifier0)
1435
- else
1436
- @index = i0
1437
- r0 = nil
1438
- end
1439
-
1440
- node_cache[:identifier][start_index] = r0
1441
-
1442
- r0
1443
- end
1381
+ if s0.empty?
1382
+ @index = i0
1383
+ r0 = nil
1384
+ else
1385
+ r0 = instantiate_node(IntegerValue,input, i0...index, s0)
1386
+ end
1444
1387
 
1445
- module Label0
1446
- end
1388
+ node_cache[:integer][start_index] = r0
1447
1389
 
1448
- module Label1
1449
- end
1390
+ r0
1391
+ end
1450
1392
 
1451
- def _nt_label
1452
- start_index = index
1453
- if node_cache[:label].has_key?(index)
1454
- cached = node_cache[:label][index]
1455
- if cached
1456
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1457
- @index = cached.interval.end
1458
- end
1459
- return cached
1393
+ module Identifier0
1460
1394
  end
1461
1395
 
1462
- i0 = index
1463
- i1, s1 = index, []
1464
- s2, i2 = [], index
1465
- loop do
1466
- if has_terminal?('\G[A-Za-z]', true, index)
1467
- r3 = true
1468
- @index += 1
1469
- else
1470
- r3 = nil
1471
- end
1472
- if r3
1473
- s2 << r3
1474
- else
1475
- break
1396
+ def _nt_identifier
1397
+ start_index = index
1398
+ if node_cache[:identifier].has_key?(index)
1399
+ cached = node_cache[:identifier][index]
1400
+ if cached
1401
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1402
+ @index = cached.interval.end
1403
+ end
1404
+ return cached
1476
1405
  end
1477
- end
1478
- if s2.empty?
1479
- @index = i2
1480
- r2 = nil
1481
- else
1482
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1483
- end
1484
- s1 << r2
1485
- if r2
1486
- if has_terminal?('\G[1-9]', true, index)
1487
- r4 = true
1406
+
1407
+ i0, s0 = index, []
1408
+ if has_terminal?('\G[a-zA-Z]', true, index)
1409
+ r1 = true
1488
1410
  @index += 1
1489
1411
  else
1490
- r4 = nil
1412
+ r1 = nil
1491
1413
  end
1492
- s1 << r4
1493
- if r4
1494
- s5, i5 = [], index
1414
+ s0 << r1
1415
+ if r1
1416
+ s2, i2 = [], index
1495
1417
  loop do
1496
- if has_terminal?('\G[0-9]', true, index)
1497
- r6 = true
1418
+ if has_terminal?('\G[a-zA-Z0-9]', true, index)
1419
+ r3 = true
1498
1420
  @index += 1
1499
1421
  else
1500
- r6 = nil
1422
+ r3 = nil
1501
1423
  end
1502
- if r6
1503
- s5 << r6
1424
+ if r3
1425
+ s2 << r3
1504
1426
  else
1505
1427
  break
1506
1428
  end
1507
1429
  end
1508
- r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
1509
- s1 << r5
1430
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1431
+ s0 << r2
1510
1432
  end
1433
+ if s0.last
1434
+ r0 = instantiate_node(Identifier,input, i0...index, s0)
1435
+ r0.extend(Identifier0)
1436
+ else
1437
+ @index = i0
1438
+ r0 = nil
1439
+ end
1440
+
1441
+ node_cache[:identifier][start_index] = r0
1442
+
1443
+ r0
1511
1444
  end
1512
- if s1.last
1513
- r1 = instantiate_node(Label,input, i1...index, s1)
1514
- r1.extend(Label0)
1515
- else
1516
- @index = i1
1517
- r1 = nil
1445
+
1446
+ module Label0
1518
1447
  end
1519
- if r1
1520
- r0 = r1
1521
- else
1522
- i7, s7 = index, []
1523
- if has_terminal?('$', false, index)
1524
- r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
1525
- @index += 1
1526
- else
1527
- terminal_parse_failure('$')
1528
- r8 = nil
1448
+
1449
+ module Label1
1450
+ end
1451
+
1452
+ def _nt_label
1453
+ start_index = index
1454
+ if node_cache[:label].has_key?(index)
1455
+ cached = node_cache[:label][index]
1456
+ if cached
1457
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1458
+ @index = cached.interval.end
1459
+ end
1460
+ return cached
1529
1461
  end
1530
- s7 << r8
1531
- if r8
1532
- s9, i9 = [], index
1533
- loop do
1534
- if has_terminal?('\G[A-Za-z]', true, index)
1535
- r10 = true
1536
- @index += 1
1537
- else
1538
- r10 = nil
1539
- end
1540
- if r10
1541
- s9 << r10
1542
- else
1543
- break
1544
- end
1462
+
1463
+ i0 = index
1464
+ i1, s1 = index, []
1465
+ s2, i2 = [], index
1466
+ loop do
1467
+ if has_terminal?('\G[A-Za-z]', true, index)
1468
+ r3 = true
1469
+ @index += 1
1470
+ else
1471
+ r3 = nil
1545
1472
  end
1546
- if s9.empty?
1547
- @index = i9
1548
- r9 = nil
1473
+ if r3
1474
+ s2 << r3
1549
1475
  else
1550
- r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
1476
+ break
1551
1477
  end
1552
- s7 << r9
1553
- if r9
1554
- if has_terminal?('$', false, index)
1555
- r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
1556
- @index += 1
1557
- else
1558
- terminal_parse_failure('$')
1559
- r11 = nil
1560
- end
1561
- s7 << r11
1562
- if r11
1563
- if has_terminal?('\G[1-9]', true, index)
1564
- r12 = true
1478
+ end
1479
+ if s2.empty?
1480
+ @index = i2
1481
+ r2 = nil
1482
+ else
1483
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1484
+ end
1485
+ s1 << r2
1486
+ if r2
1487
+ if has_terminal?('\G[1-9]', true, index)
1488
+ r4 = true
1489
+ @index += 1
1490
+ else
1491
+ r4 = nil
1492
+ end
1493
+ s1 << r4
1494
+ if r4
1495
+ s5, i5 = [], index
1496
+ loop do
1497
+ if has_terminal?('\G[0-9]', true, index)
1498
+ r6 = true
1565
1499
  @index += 1
1566
1500
  else
1567
- r12 = nil
1501
+ r6 = nil
1568
1502
  end
1569
- s7 << r12
1570
- if r12
1571
- s13, i13 = [], index
1572
- loop do
1573
- if has_terminal?('\G[0-9]', true, index)
1574
- r14 = true
1575
- @index += 1
1576
- else
1577
- r14 = nil
1578
- end
1579
- if r14
1580
- s13 << r14
1581
- else
1582
- break
1583
- end
1584
- end
1585
- r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
1586
- s7 << r13
1503
+ if r6
1504
+ s5 << r6
1505
+ else
1506
+ break
1587
1507
  end
1588
1508
  end
1509
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
1510
+ s1 << r5
1589
1511
  end
1590
1512
  end
1591
- if s7.last
1592
- r7 = instantiate_node(Label,input, i7...index, s7)
1593
- r7.extend(Label1)
1513
+ if s1.last
1514
+ r1 = instantiate_node(Label,input, i1...index, s1)
1515
+ r1.extend(Label0)
1594
1516
  else
1595
- @index = i7
1596
- r7 = nil
1517
+ @index = i1
1518
+ r1 = nil
1597
1519
  end
1598
- if r7
1599
- r0 = r7
1520
+ if r1
1521
+ r0 = r1
1600
1522
  else
1601
- @index = i0
1602
- r0 = nil
1603
- end
1604
- end
1605
-
1606
- node_cache[:label][start_index] = r0
1607
-
1608
- r0
1609
- end
1610
-
1611
- module String0
1612
- end
1613
-
1614
- module String1
1615
- end
1616
-
1617
- module String2
1618
- end
1619
-
1620
- def _nt_string
1621
- start_index = index
1622
- if node_cache[:string].has_key?(index)
1623
- cached = node_cache[:string][index]
1624
- if cached
1625
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1626
- @index = cached.interval.end
1627
- end
1628
- return cached
1629
- end
1630
-
1631
- i0 = index
1632
- i1, s1 = index, []
1633
- if has_terminal?('"', false, index)
1634
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
1635
- @index += 1
1636
- else
1637
- terminal_parse_failure('"')
1638
- r2 = nil
1639
- end
1640
- s1 << r2
1641
- if r2
1642
- s3, i3 = [], index
1643
- loop do
1644
- i4 = index
1645
- if has_terminal?('\"', false, index)
1646
- r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
1647
- @index += 2
1523
+ i7, s7 = index, []
1524
+ if has_terminal?('$', false, index)
1525
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
1526
+ @index += 1
1648
1527
  else
1649
- terminal_parse_failure('\"')
1650
- r5 = nil
1528
+ terminal_parse_failure('$')
1529
+ r8 = nil
1651
1530
  end
1652
- if r5
1653
- r4 = r5
1654
- else
1655
- i6, s6 = index, []
1656
- i7 = index
1657
- if has_terminal?('"', false, index)
1658
- r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
1659
- @index += 1
1660
- else
1661
- terminal_parse_failure('"')
1662
- r8 = nil
1663
- end
1664
- if r8
1665
- r7 = nil
1666
- else
1667
- @index = i7
1668
- r7 = instantiate_node(SyntaxNode,input, index...index)
1669
- end
1670
- s6 << r7
1671
- if r7
1672
- if index < input_length
1673
- r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
1531
+ s7 << r8
1532
+ if r8
1533
+ s9, i9 = [], index
1534
+ loop do
1535
+ if has_terminal?('\G[A-Za-z]', true, index)
1536
+ r10 = true
1674
1537
  @index += 1
1675
1538
  else
1676
- terminal_parse_failure("any character")
1677
- r9 = nil
1539
+ r10 = nil
1540
+ end
1541
+ if r10
1542
+ s9 << r10
1543
+ else
1544
+ break
1678
1545
  end
1679
- s6 << r9
1680
1546
  end
1681
- if s6.last
1682
- r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
1683
- r6.extend(String0)
1547
+ if s9.empty?
1548
+ @index = i9
1549
+ r9 = nil
1684
1550
  else
1685
- @index = i6
1686
- r6 = nil
1551
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
1687
1552
  end
1688
- if r6
1689
- r4 = r6
1690
- else
1691
- @index = i4
1692
- r4 = nil
1553
+ s7 << r9
1554
+ if r9
1555
+ if has_terminal?('$', false, index)
1556
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
1557
+ @index += 1
1558
+ else
1559
+ terminal_parse_failure('$')
1560
+ r11 = nil
1561
+ end
1562
+ s7 << r11
1563
+ if r11
1564
+ if has_terminal?('\G[1-9]', true, index)
1565
+ r12 = true
1566
+ @index += 1
1567
+ else
1568
+ r12 = nil
1569
+ end
1570
+ s7 << r12
1571
+ if r12
1572
+ s13, i13 = [], index
1573
+ loop do
1574
+ if has_terminal?('\G[0-9]', true, index)
1575
+ r14 = true
1576
+ @index += 1
1577
+ else
1578
+ r14 = nil
1579
+ end
1580
+ if r14
1581
+ s13 << r14
1582
+ else
1583
+ break
1584
+ end
1585
+ end
1586
+ r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
1587
+ s7 << r13
1588
+ end
1589
+ end
1693
1590
  end
1694
1591
  end
1695
- if r4
1696
- s3 << r4
1592
+ if s7.last
1593
+ r7 = instantiate_node(Label,input, i7...index, s7)
1594
+ r7.extend(Label1)
1697
1595
  else
1698
- break
1596
+ @index = i7
1597
+ r7 = nil
1699
1598
  end
1700
- end
1701
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1702
- s1 << r3
1703
- if r3
1704
- if has_terminal?('"', false, index)
1705
- r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
1706
- @index += 1
1599
+ if r7
1600
+ r0 = r7
1707
1601
  else
1708
- terminal_parse_failure('"')
1709
- r10 = nil
1602
+ @index = i0
1603
+ r0 = nil
1710
1604
  end
1711
- s1 << r10
1712
1605
  end
1606
+
1607
+ node_cache[:label][start_index] = r0
1608
+
1609
+ r0
1713
1610
  end
1714
- if s1.last
1715
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1716
- r1.extend(String1)
1717
- else
1718
- @index = i1
1719
- r1 = nil
1611
+
1612
+ module String0
1613
+ end
1614
+
1615
+ module String1
1616
+ end
1617
+
1618
+ module String2
1720
1619
  end
1721
- if r1
1722
- r0 = r1
1723
- else
1724
- i11, s11 = index, []
1725
- if has_terminal?("'", false, index)
1726
- r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
1620
+
1621
+ def _nt_string
1622
+ start_index = index
1623
+ if node_cache[:string].has_key?(index)
1624
+ cached = node_cache[:string][index]
1625
+ if cached
1626
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1627
+ @index = cached.interval.end
1628
+ end
1629
+ return cached
1630
+ end
1631
+
1632
+ i0 = index
1633
+ i1, s1 = index, []
1634
+ if has_terminal?('"', false, index)
1635
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
1727
1636
  @index += 1
1728
1637
  else
1729
- terminal_parse_failure("'")
1730
- r12 = nil
1638
+ terminal_parse_failure('"')
1639
+ r2 = nil
1731
1640
  end
1732
- s11 << r12
1733
- if r12
1734
- s13, i13 = [], index
1641
+ s1 << r2
1642
+ if r2
1643
+ s3, i3 = [], index
1735
1644
  loop do
1736
- if has_terminal?('\G[^\']', true, index)
1737
- r14 = true
1738
- @index += 1
1645
+ i4 = index
1646
+ if has_terminal?('\"', false, index)
1647
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
1648
+ @index += 2
1649
+ else
1650
+ terminal_parse_failure('\"')
1651
+ r5 = nil
1652
+ end
1653
+ if r5
1654
+ r4 = r5
1739
1655
  else
1740
- r14 = nil
1656
+ i6, s6 = index, []
1657
+ i7 = index
1658
+ if has_terminal?('"', false, index)
1659
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
1660
+ @index += 1
1661
+ else
1662
+ terminal_parse_failure('"')
1663
+ r8 = nil
1664
+ end
1665
+ if r8
1666
+ r7 = nil
1667
+ else
1668
+ @index = i7
1669
+ r7 = instantiate_node(SyntaxNode,input, index...index)
1670
+ end
1671
+ s6 << r7
1672
+ if r7
1673
+ if index < input_length
1674
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
1675
+ @index += 1
1676
+ else
1677
+ terminal_parse_failure("any character")
1678
+ r9 = nil
1679
+ end
1680
+ s6 << r9
1681
+ end
1682
+ if s6.last
1683
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
1684
+ r6.extend(String0)
1685
+ else
1686
+ @index = i6
1687
+ r6 = nil
1688
+ end
1689
+ if r6
1690
+ r4 = r6
1691
+ else
1692
+ @index = i4
1693
+ r4 = nil
1694
+ end
1741
1695
  end
1742
- if r14
1743
- s13 << r14
1696
+ if r4
1697
+ s3 << r4
1744
1698
  else
1745
1699
  break
1746
1700
  end
1747
1701
  end
1748
- r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
1749
- s11 << r13
1750
- if r13
1751
- if has_terminal?("'", false, index)
1752
- r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
1702
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1703
+ s1 << r3
1704
+ if r3
1705
+ if has_terminal?('"', false, index)
1706
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
1753
1707
  @index += 1
1754
1708
  else
1755
- terminal_parse_failure("'")
1756
- r15 = nil
1709
+ terminal_parse_failure('"')
1710
+ r10 = nil
1757
1711
  end
1758
- s11 << r15
1712
+ s1 << r10
1759
1713
  end
1760
1714
  end
1761
- if s11.last
1762
- r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
1763
- r11.extend(String2)
1715
+ if s1.last
1716
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1717
+ r1.extend(String1)
1764
1718
  else
1765
- @index = i11
1766
- r11 = nil
1719
+ @index = i1
1720
+ r1 = nil
1767
1721
  end
1768
- if r11
1769
- r0 = r11
1722
+ if r1
1723
+ r0 = r1
1770
1724
  else
1771
- @index = i0
1772
- r0 = nil
1725
+ i11, s11 = index, []
1726
+ if has_terminal?("'", false, index)
1727
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
1728
+ @index += 1
1729
+ else
1730
+ terminal_parse_failure("'")
1731
+ r12 = nil
1732
+ end
1733
+ s11 << r12
1734
+ if r12
1735
+ s13, i13 = [], index
1736
+ loop do
1737
+ if has_terminal?('\G[^\']', true, index)
1738
+ r14 = true
1739
+ @index += 1
1740
+ else
1741
+ r14 = nil
1742
+ end
1743
+ if r14
1744
+ s13 << r14
1745
+ else
1746
+ break
1747
+ end
1748
+ end
1749
+ r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
1750
+ s11 << r13
1751
+ if r13
1752
+ if has_terminal?("'", false, index)
1753
+ r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
1754
+ @index += 1
1755
+ else
1756
+ terminal_parse_failure("'")
1757
+ r15 = nil
1758
+ end
1759
+ s11 << r15
1760
+ end
1761
+ end
1762
+ if s11.last
1763
+ r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
1764
+ r11.extend(String2)
1765
+ else
1766
+ @index = i11
1767
+ r11 = nil
1768
+ end
1769
+ if r11
1770
+ r0 = r11
1771
+ else
1772
+ @index = i0
1773
+ r0 = nil
1774
+ end
1773
1775
  end
1774
- end
1775
1776
 
1776
- node_cache[:string][start_index] = r0
1777
+ node_cache[:string][start_index] = r0
1777
1778
 
1778
- r0
1779
- end
1780
-
1781
- module Range0
1782
- def label1
1783
- elements[0]
1779
+ r0
1784
1780
  end
1785
1781
 
1786
- def label2
1787
- elements[2]
1788
- end
1789
- end
1782
+ module Range0
1783
+ def label1
1784
+ elements[0]
1785
+ end
1790
1786
 
1791
- def _nt_range
1792
- start_index = index
1793
- if node_cache[:range].has_key?(index)
1794
- cached = node_cache[:range][index]
1795
- if cached
1796
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1797
- @index = cached.interval.end
1787
+ def label2
1788
+ elements[2]
1798
1789
  end
1799
- return cached
1800
1790
  end
1801
1791
 
1802
- i0, s0 = index, []
1803
- r1 = _nt_label
1804
- s0 << r1
1805
- if r1
1806
- if has_terminal?(':', false, index)
1807
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
1808
- @index += 1
1809
- else
1810
- terminal_parse_failure(':')
1811
- r2 = nil
1792
+ def _nt_range
1793
+ start_index = index
1794
+ if node_cache[:range].has_key?(index)
1795
+ cached = node_cache[:range][index]
1796
+ if cached
1797
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1798
+ @index = cached.interval.end
1799
+ end
1800
+ return cached
1812
1801
  end
1813
- s0 << r2
1814
- if r2
1815
- r3 = _nt_label
1816
- s0 << r3
1802
+
1803
+ i0, s0 = index, []
1804
+ r1 = _nt_label
1805
+ s0 << r1
1806
+ if r1
1807
+ if has_terminal?(':', false, index)
1808
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
1809
+ @index += 1
1810
+ else
1811
+ terminal_parse_failure(':')
1812
+ r2 = nil
1813
+ end
1814
+ s0 << r2
1815
+ if r2
1816
+ r3 = _nt_label
1817
+ s0 << r3
1818
+ end
1819
+ end
1820
+ if s0.last
1821
+ r0 = instantiate_node(Range,input, i0...index, s0)
1822
+ r0.extend(Range0)
1823
+ else
1824
+ @index = i0
1825
+ r0 = nil
1817
1826
  end
1818
- end
1819
- if s0.last
1820
- r0 = instantiate_node(Range,input, i0...index, s0)
1821
- r0.extend(Range0)
1822
- else
1823
- @index = i0
1824
- r0 = nil
1825
- end
1826
1827
 
1827
- node_cache[:range][start_index] = r0
1828
+ node_cache[:range][start_index] = r0
1828
1829
 
1829
- r0
1830
- end
1830
+ r0
1831
+ end
1831
1832
 
1832
- def _nt_space
1833
- start_index = index
1834
- if node_cache[:space].has_key?(index)
1835
- cached = node_cache[:space][index]
1836
- if cached
1837
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1838
- @index = cached.interval.end
1833
+ def _nt_space
1834
+ start_index = index
1835
+ if node_cache[:space].has_key?(index)
1836
+ cached = node_cache[:space][index]
1837
+ if cached
1838
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1839
+ @index = cached.interval.end
1840
+ end
1841
+ return cached
1839
1842
  end
1840
- return cached
1841
- end
1842
1843
 
1843
- s0, i0 = [], index
1844
- loop do
1845
- if has_terminal?('\G[\\s]', true, index)
1846
- r1 = true
1847
- @index += 1
1848
- else
1849
- r1 = nil
1844
+ s0, i0 = [], index
1845
+ loop do
1846
+ if has_terminal?('\G[\\s]', true, index)
1847
+ r1 = true
1848
+ @index += 1
1849
+ else
1850
+ r1 = nil
1851
+ end
1852
+ if r1
1853
+ s0 << r1
1854
+ else
1855
+ break
1856
+ end
1850
1857
  end
1851
- if r1
1852
- s0 << r1
1858
+ if s0.empty?
1859
+ @index = i0
1860
+ r0 = nil
1853
1861
  else
1854
- break
1862
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1855
1863
  end
1856
- end
1857
- if s0.empty?
1858
- @index = i0
1859
- r0 = nil
1860
- else
1861
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1862
- end
1863
1864
 
1864
- node_cache[:space][start_index] = r0
1865
+ node_cache[:space][start_index] = r0
1866
+
1867
+ r0
1868
+ end
1865
1869
 
1866
- r0
1867
1870
  end
1868
1871
 
1869
- end
1872
+ class ExcelParser < Treetop::Runtime::CompiledParser
1873
+ include Excel
1874
+ end
1870
1875
 
1871
- class SorobanParser < Treetop::Runtime::CompiledParser
1872
- include Soroban
1873
1876
  end
1874
-