rasti-db 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/README.md +8 -0
- data/lib/rasti/db.rb +9 -18
- data/lib/rasti/db/collection.rb +1 -1
- data/lib/rasti/db/nql/invalid_expression_error.rb +19 -0
- data/lib/rasti/db/nql/nodes/binary_node.rb +25 -0
- data/lib/rasti/db/nql/nodes/comparisons/base.rb +17 -0
- data/lib/rasti/db/nql/nodes/comparisons/equal.rb +17 -0
- data/lib/rasti/db/nql/nodes/comparisons/greater_than.rb +17 -0
- data/lib/rasti/db/nql/nodes/comparisons/greater_than_or_equal.rb +17 -0
- data/lib/rasti/db/nql/nodes/comparisons/include.rb +17 -0
- data/lib/rasti/db/nql/nodes/comparisons/less_than.rb +17 -0
- data/lib/rasti/db/nql/nodes/comparisons/less_than_or_equal.rb +17 -0
- data/lib/rasti/db/nql/nodes/comparisons/like.rb +17 -0
- data/lib/rasti/db/nql/nodes/comparisons/not_equal.rb +17 -0
- data/lib/rasti/db/nql/nodes/comparisons/not_include.rb +17 -0
- data/lib/rasti/db/nql/nodes/conjunction.rb +15 -0
- data/lib/rasti/db/nql/nodes/constants/false.rb +17 -0
- data/lib/rasti/db/nql/nodes/constants/float.rb +17 -0
- data/lib/rasti/db/nql/nodes/constants/integer.rb +17 -0
- data/lib/rasti/db/nql/nodes/constants/literal_string.rb +17 -0
- data/lib/rasti/db/nql/nodes/constants/string.rb +17 -0
- data/lib/rasti/db/nql/nodes/constants/time.rb +23 -0
- data/lib/rasti/db/nql/nodes/constants/true.rb +17 -0
- data/lib/rasti/db/nql/nodes/disjunction.rb +15 -0
- data/lib/rasti/db/nql/nodes/field.rb +23 -0
- data/lib/rasti/db/nql/nodes/parenthesis_sentence.rb +19 -0
- data/lib/rasti/db/nql/nodes/sentence.rb +19 -0
- data/lib/rasti/db/nql/syntax.rb +2266 -0
- data/lib/rasti/db/nql/syntax.treetop +168 -0
- data/lib/rasti/db/query.rb +15 -0
- data/lib/rasti/db/relations/graph_builder.rb +3 -3
- data/lib/rasti/db/version.rb +1 -1
- data/rasti-db.gemspec +3 -1
- data/spec/coverage_helper.rb +5 -1
- data/spec/nql/dependency_tables_spec.rb +35 -0
- data/spec/nql/filter_condition_spec.rb +146 -0
- data/spec/nql/syntax_parser_spec.rb +209 -0
- data/spec/query_spec.rb +53 -0
- metadata +68 -2
@@ -0,0 +1,23 @@
|
|
1
|
+
module Rasti
|
2
|
+
module DB
|
3
|
+
module NQL
|
4
|
+
module Nodes
|
5
|
+
class Field < Treetop::Runtime::SyntaxNode
|
6
|
+
|
7
|
+
def identifier
|
8
|
+
tables.empty? ? Sequel[column.to_sym] : Sequel[tables.join('__').to_sym][column.to_sym]
|
9
|
+
end
|
10
|
+
|
11
|
+
def tables
|
12
|
+
_tables.elements.map{ |e| e.table.text_value }
|
13
|
+
end
|
14
|
+
|
15
|
+
def column
|
16
|
+
_column.text_value
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Rasti
|
2
|
+
module DB
|
3
|
+
module NQL
|
4
|
+
module Nodes
|
5
|
+
class ParenthesisSentence < Treetop::Runtime::SyntaxNode
|
6
|
+
|
7
|
+
def dependency_tables
|
8
|
+
sentence.dependency_tables
|
9
|
+
end
|
10
|
+
|
11
|
+
def filter_condition
|
12
|
+
sentence.filter_condition
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Rasti
|
2
|
+
module DB
|
3
|
+
module NQL
|
4
|
+
module Nodes
|
5
|
+
class Sentence < Treetop::Runtime::SyntaxNode
|
6
|
+
|
7
|
+
def dependency_tables
|
8
|
+
proposition.dependency_tables
|
9
|
+
end
|
10
|
+
|
11
|
+
def filter_condition
|
12
|
+
proposition.filter_condition
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,2266 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
module Rasti
|
5
|
+
module DB
|
6
|
+
module NQL
|
7
|
+
module Syntax
|
8
|
+
include Treetop::Runtime
|
9
|
+
|
10
|
+
def root
|
11
|
+
@root ||= :sentence
|
12
|
+
end
|
13
|
+
|
14
|
+
module Sentence0
|
15
|
+
def proposition
|
16
|
+
elements[1]
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def _nt_sentence
|
22
|
+
start_index = index
|
23
|
+
if node_cache[:sentence].has_key?(index)
|
24
|
+
cached = node_cache[:sentence][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
|
+
s1, i1 = [], index
|
34
|
+
loop do
|
35
|
+
r2 = _nt_space
|
36
|
+
if r2
|
37
|
+
s1 << r2
|
38
|
+
else
|
39
|
+
break
|
40
|
+
end
|
41
|
+
end
|
42
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
43
|
+
s0 << r1
|
44
|
+
if r1
|
45
|
+
r3 = _nt_proposition
|
46
|
+
s0 << r3
|
47
|
+
if r3
|
48
|
+
s4, i4 = [], index
|
49
|
+
loop do
|
50
|
+
r5 = _nt_space
|
51
|
+
if r5
|
52
|
+
s4 << r5
|
53
|
+
else
|
54
|
+
break
|
55
|
+
end
|
56
|
+
end
|
57
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
58
|
+
s0 << r4
|
59
|
+
end
|
60
|
+
end
|
61
|
+
if s0.last
|
62
|
+
r0 = instantiate_node(Nodes::Sentence,input, i0...index, s0)
|
63
|
+
r0.extend(Sentence0)
|
64
|
+
else
|
65
|
+
@index = i0
|
66
|
+
r0 = nil
|
67
|
+
end
|
68
|
+
|
69
|
+
node_cache[:sentence][start_index] = r0
|
70
|
+
|
71
|
+
r0
|
72
|
+
end
|
73
|
+
|
74
|
+
def _nt_proposition
|
75
|
+
start_index = index
|
76
|
+
if node_cache[:proposition].has_key?(index)
|
77
|
+
cached = node_cache[:proposition][index]
|
78
|
+
if cached
|
79
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
80
|
+
@index = cached.interval.end
|
81
|
+
end
|
82
|
+
return cached
|
83
|
+
end
|
84
|
+
|
85
|
+
i0 = index
|
86
|
+
r1 = _nt_disjunction
|
87
|
+
if r1
|
88
|
+
r0 = r1
|
89
|
+
else
|
90
|
+
r2 = _nt_conjunction
|
91
|
+
if r2
|
92
|
+
r0 = r2
|
93
|
+
else
|
94
|
+
r3 = _nt_statement
|
95
|
+
if r3
|
96
|
+
r0 = r3
|
97
|
+
else
|
98
|
+
@index = i0
|
99
|
+
r0 = nil
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
node_cache[:proposition][start_index] = r0
|
105
|
+
|
106
|
+
r0
|
107
|
+
end
|
108
|
+
|
109
|
+
module Disjunction0
|
110
|
+
def left
|
111
|
+
elements[0]
|
112
|
+
end
|
113
|
+
|
114
|
+
def right
|
115
|
+
elements[4]
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def _nt_disjunction
|
120
|
+
start_index = index
|
121
|
+
if node_cache[:disjunction].has_key?(index)
|
122
|
+
cached = node_cache[:disjunction][index]
|
123
|
+
if cached
|
124
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
125
|
+
@index = cached.interval.end
|
126
|
+
end
|
127
|
+
return cached
|
128
|
+
end
|
129
|
+
|
130
|
+
i0, s0 = index, []
|
131
|
+
i1 = index
|
132
|
+
r2 = _nt_conjunction
|
133
|
+
if r2
|
134
|
+
r1 = r2
|
135
|
+
else
|
136
|
+
r3 = _nt_statement
|
137
|
+
if r3
|
138
|
+
r1 = r3
|
139
|
+
else
|
140
|
+
@index = i1
|
141
|
+
r1 = nil
|
142
|
+
end
|
143
|
+
end
|
144
|
+
s0 << r1
|
145
|
+
if r1
|
146
|
+
s4, i4 = [], index
|
147
|
+
loop do
|
148
|
+
r5 = _nt_space
|
149
|
+
if r5
|
150
|
+
s4 << r5
|
151
|
+
else
|
152
|
+
break
|
153
|
+
end
|
154
|
+
end
|
155
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
156
|
+
s0 << r4
|
157
|
+
if r4
|
158
|
+
if has_terminal?('|', false, index)
|
159
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
160
|
+
@index += 1
|
161
|
+
else
|
162
|
+
terminal_parse_failure('|')
|
163
|
+
r6 = nil
|
164
|
+
end
|
165
|
+
s0 << r6
|
166
|
+
if r6
|
167
|
+
s7, i7 = [], index
|
168
|
+
loop do
|
169
|
+
r8 = _nt_space
|
170
|
+
if r8
|
171
|
+
s7 << r8
|
172
|
+
else
|
173
|
+
break
|
174
|
+
end
|
175
|
+
end
|
176
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
177
|
+
s0 << r7
|
178
|
+
if r7
|
179
|
+
r9 = _nt_proposition
|
180
|
+
s0 << r9
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
if s0.last
|
186
|
+
r0 = instantiate_node(Nodes::Disjunction,input, i0...index, s0)
|
187
|
+
r0.extend(Disjunction0)
|
188
|
+
else
|
189
|
+
@index = i0
|
190
|
+
r0 = nil
|
191
|
+
end
|
192
|
+
|
193
|
+
node_cache[:disjunction][start_index] = r0
|
194
|
+
|
195
|
+
r0
|
196
|
+
end
|
197
|
+
|
198
|
+
module Conjunction0
|
199
|
+
def left
|
200
|
+
elements[0]
|
201
|
+
end
|
202
|
+
|
203
|
+
def right
|
204
|
+
elements[4]
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
def _nt_conjunction
|
209
|
+
start_index = index
|
210
|
+
if node_cache[:conjunction].has_key?(index)
|
211
|
+
cached = node_cache[:conjunction][index]
|
212
|
+
if cached
|
213
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
214
|
+
@index = cached.interval.end
|
215
|
+
end
|
216
|
+
return cached
|
217
|
+
end
|
218
|
+
|
219
|
+
i0, s0 = index, []
|
220
|
+
r1 = _nt_statement
|
221
|
+
s0 << r1
|
222
|
+
if r1
|
223
|
+
s2, i2 = [], index
|
224
|
+
loop do
|
225
|
+
r3 = _nt_space
|
226
|
+
if r3
|
227
|
+
s2 << r3
|
228
|
+
else
|
229
|
+
break
|
230
|
+
end
|
231
|
+
end
|
232
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
233
|
+
s0 << r2
|
234
|
+
if r2
|
235
|
+
if has_terminal?('&', false, index)
|
236
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
237
|
+
@index += 1
|
238
|
+
else
|
239
|
+
terminal_parse_failure('&')
|
240
|
+
r4 = nil
|
241
|
+
end
|
242
|
+
s0 << r4
|
243
|
+
if r4
|
244
|
+
s5, i5 = [], index
|
245
|
+
loop do
|
246
|
+
r6 = _nt_space
|
247
|
+
if r6
|
248
|
+
s5 << r6
|
249
|
+
else
|
250
|
+
break
|
251
|
+
end
|
252
|
+
end
|
253
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
254
|
+
s0 << r5
|
255
|
+
if r5
|
256
|
+
i7 = index
|
257
|
+
r8 = _nt_conjunction
|
258
|
+
if r8
|
259
|
+
r7 = r8
|
260
|
+
else
|
261
|
+
r9 = _nt_statement
|
262
|
+
if r9
|
263
|
+
r7 = r9
|
264
|
+
else
|
265
|
+
@index = i7
|
266
|
+
r7 = nil
|
267
|
+
end
|
268
|
+
end
|
269
|
+
s0 << r7
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
if s0.last
|
275
|
+
r0 = instantiate_node(Nodes::Conjunction,input, i0...index, s0)
|
276
|
+
r0.extend(Conjunction0)
|
277
|
+
else
|
278
|
+
@index = i0
|
279
|
+
r0 = nil
|
280
|
+
end
|
281
|
+
|
282
|
+
node_cache[:conjunction][start_index] = r0
|
283
|
+
|
284
|
+
r0
|
285
|
+
end
|
286
|
+
|
287
|
+
def _nt_statement
|
288
|
+
start_index = index
|
289
|
+
if node_cache[:statement].has_key?(index)
|
290
|
+
cached = node_cache[:statement][index]
|
291
|
+
if cached
|
292
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
293
|
+
@index = cached.interval.end
|
294
|
+
end
|
295
|
+
return cached
|
296
|
+
end
|
297
|
+
|
298
|
+
i0 = index
|
299
|
+
r1 = _nt_parenthesis_sentence
|
300
|
+
if r1
|
301
|
+
r0 = r1
|
302
|
+
else
|
303
|
+
r2 = _nt_comparison
|
304
|
+
if r2
|
305
|
+
r0 = r2
|
306
|
+
else
|
307
|
+
@index = i0
|
308
|
+
r0 = nil
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
node_cache[:statement][start_index] = r0
|
313
|
+
|
314
|
+
r0
|
315
|
+
end
|
316
|
+
|
317
|
+
module ParenthesisSentence0
|
318
|
+
def sentence
|
319
|
+
elements[1]
|
320
|
+
end
|
321
|
+
|
322
|
+
end
|
323
|
+
|
324
|
+
def _nt_parenthesis_sentence
|
325
|
+
start_index = index
|
326
|
+
if node_cache[:parenthesis_sentence].has_key?(index)
|
327
|
+
cached = node_cache[:parenthesis_sentence][index]
|
328
|
+
if cached
|
329
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
330
|
+
@index = cached.interval.end
|
331
|
+
end
|
332
|
+
return cached
|
333
|
+
end
|
334
|
+
|
335
|
+
i0, s0 = index, []
|
336
|
+
if has_terminal?('(', false, index)
|
337
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
338
|
+
@index += 1
|
339
|
+
else
|
340
|
+
terminal_parse_failure('(')
|
341
|
+
r1 = nil
|
342
|
+
end
|
343
|
+
s0 << r1
|
344
|
+
if r1
|
345
|
+
r2 = _nt_sentence
|
346
|
+
s0 << r2
|
347
|
+
if r2
|
348
|
+
if has_terminal?(')', false, index)
|
349
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
350
|
+
@index += 1
|
351
|
+
else
|
352
|
+
terminal_parse_failure(')')
|
353
|
+
r3 = nil
|
354
|
+
end
|
355
|
+
s0 << r3
|
356
|
+
end
|
357
|
+
end
|
358
|
+
if s0.last
|
359
|
+
r0 = instantiate_node(Nodes::ParenthesisSentence,input, i0...index, s0)
|
360
|
+
r0.extend(ParenthesisSentence0)
|
361
|
+
else
|
362
|
+
@index = i0
|
363
|
+
r0 = nil
|
364
|
+
end
|
365
|
+
|
366
|
+
node_cache[:parenthesis_sentence][start_index] = r0
|
367
|
+
|
368
|
+
r0
|
369
|
+
end
|
370
|
+
|
371
|
+
def _nt_comparison
|
372
|
+
start_index = index
|
373
|
+
if node_cache[:comparison].has_key?(index)
|
374
|
+
cached = node_cache[:comparison][index]
|
375
|
+
if cached
|
376
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
377
|
+
@index = cached.interval.end
|
378
|
+
end
|
379
|
+
return cached
|
380
|
+
end
|
381
|
+
|
382
|
+
i0 = index
|
383
|
+
r1 = _nt_comparison_not_include
|
384
|
+
if r1
|
385
|
+
r0 = r1
|
386
|
+
else
|
387
|
+
r2 = _nt_comparison_include
|
388
|
+
if r2
|
389
|
+
r0 = r2
|
390
|
+
else
|
391
|
+
r3 = _nt_comparison_like
|
392
|
+
if r3
|
393
|
+
r0 = r3
|
394
|
+
else
|
395
|
+
r4 = _nt_comparison_greater_than_or_equal
|
396
|
+
if r4
|
397
|
+
r0 = r4
|
398
|
+
else
|
399
|
+
r5 = _nt_comparison_less_than_or_equal
|
400
|
+
if r5
|
401
|
+
r0 = r5
|
402
|
+
else
|
403
|
+
r6 = _nt_comparison_greater_than
|
404
|
+
if r6
|
405
|
+
r0 = r6
|
406
|
+
else
|
407
|
+
r7 = _nt_comparison_less_than
|
408
|
+
if r7
|
409
|
+
r0 = r7
|
410
|
+
else
|
411
|
+
r8 = _nt_comparison_not_equal
|
412
|
+
if r8
|
413
|
+
r0 = r8
|
414
|
+
else
|
415
|
+
r9 = _nt_comparison_equal
|
416
|
+
if r9
|
417
|
+
r0 = r9
|
418
|
+
else
|
419
|
+
@index = i0
|
420
|
+
r0 = nil
|
421
|
+
end
|
422
|
+
end
|
423
|
+
end
|
424
|
+
end
|
425
|
+
end
|
426
|
+
end
|
427
|
+
end
|
428
|
+
end
|
429
|
+
end
|
430
|
+
|
431
|
+
node_cache[:comparison][start_index] = r0
|
432
|
+
|
433
|
+
r0
|
434
|
+
end
|
435
|
+
|
436
|
+
module Field0
|
437
|
+
def table
|
438
|
+
elements[0]
|
439
|
+
end
|
440
|
+
|
441
|
+
end
|
442
|
+
|
443
|
+
module Field1
|
444
|
+
def _tables
|
445
|
+
elements[0]
|
446
|
+
end
|
447
|
+
|
448
|
+
def _column
|
449
|
+
elements[1]
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
def _nt_field
|
454
|
+
start_index = index
|
455
|
+
if node_cache[:field].has_key?(index)
|
456
|
+
cached = node_cache[:field][index]
|
457
|
+
if cached
|
458
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
459
|
+
@index = cached.interval.end
|
460
|
+
end
|
461
|
+
return cached
|
462
|
+
end
|
463
|
+
|
464
|
+
i0, s0 = index, []
|
465
|
+
s1, i1 = [], index
|
466
|
+
loop do
|
467
|
+
i2, s2 = index, []
|
468
|
+
r3 = _nt_field_name
|
469
|
+
s2 << r3
|
470
|
+
if r3
|
471
|
+
if has_terminal?('.', false, index)
|
472
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
473
|
+
@index += 1
|
474
|
+
else
|
475
|
+
terminal_parse_failure('.')
|
476
|
+
r4 = nil
|
477
|
+
end
|
478
|
+
s2 << r4
|
479
|
+
end
|
480
|
+
if s2.last
|
481
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
482
|
+
r2.extend(Field0)
|
483
|
+
else
|
484
|
+
@index = i2
|
485
|
+
r2 = nil
|
486
|
+
end
|
487
|
+
if r2
|
488
|
+
s1 << r2
|
489
|
+
else
|
490
|
+
break
|
491
|
+
end
|
492
|
+
end
|
493
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
494
|
+
s0 << r1
|
495
|
+
if r1
|
496
|
+
r5 = _nt_field_name
|
497
|
+
s0 << r5
|
498
|
+
end
|
499
|
+
if s0.last
|
500
|
+
r0 = instantiate_node(Nodes::Field,input, i0...index, s0)
|
501
|
+
r0.extend(Field1)
|
502
|
+
else
|
503
|
+
@index = i0
|
504
|
+
r0 = nil
|
505
|
+
end
|
506
|
+
|
507
|
+
node_cache[:field][start_index] = r0
|
508
|
+
|
509
|
+
r0
|
510
|
+
end
|
511
|
+
|
512
|
+
module ComparisonInclude0
|
513
|
+
def field
|
514
|
+
elements[0]
|
515
|
+
end
|
516
|
+
|
517
|
+
def comparator
|
518
|
+
elements[2]
|
519
|
+
end
|
520
|
+
|
521
|
+
def argument
|
522
|
+
elements[4]
|
523
|
+
end
|
524
|
+
end
|
525
|
+
|
526
|
+
def _nt_comparison_include
|
527
|
+
start_index = index
|
528
|
+
if node_cache[:comparison_include].has_key?(index)
|
529
|
+
cached = node_cache[:comparison_include][index]
|
530
|
+
if cached
|
531
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
532
|
+
@index = cached.interval.end
|
533
|
+
end
|
534
|
+
return cached
|
535
|
+
end
|
536
|
+
|
537
|
+
i0, s0 = index, []
|
538
|
+
r1 = _nt_field
|
539
|
+
s0 << r1
|
540
|
+
if r1
|
541
|
+
s2, i2 = [], index
|
542
|
+
loop do
|
543
|
+
r3 = _nt_space
|
544
|
+
if r3
|
545
|
+
s2 << r3
|
546
|
+
else
|
547
|
+
break
|
548
|
+
end
|
549
|
+
end
|
550
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
551
|
+
s0 << r2
|
552
|
+
if r2
|
553
|
+
if has_terminal?(':', false, index)
|
554
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
555
|
+
@index += 1
|
556
|
+
else
|
557
|
+
terminal_parse_failure(':')
|
558
|
+
r4 = nil
|
559
|
+
end
|
560
|
+
s0 << r4
|
561
|
+
if r4
|
562
|
+
s5, i5 = [], index
|
563
|
+
loop do
|
564
|
+
r6 = _nt_space
|
565
|
+
if r6
|
566
|
+
s5 << r6
|
567
|
+
else
|
568
|
+
break
|
569
|
+
end
|
570
|
+
end
|
571
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
572
|
+
s0 << r5
|
573
|
+
if r5
|
574
|
+
r7 = _nt_basic
|
575
|
+
s0 << r7
|
576
|
+
end
|
577
|
+
end
|
578
|
+
end
|
579
|
+
end
|
580
|
+
if s0.last
|
581
|
+
r0 = instantiate_node(Nodes::Comparisons::Include,input, i0...index, s0)
|
582
|
+
r0.extend(ComparisonInclude0)
|
583
|
+
else
|
584
|
+
@index = i0
|
585
|
+
r0 = nil
|
586
|
+
end
|
587
|
+
|
588
|
+
node_cache[:comparison_include][start_index] = r0
|
589
|
+
|
590
|
+
r0
|
591
|
+
end
|
592
|
+
|
593
|
+
module ComparisonNotInclude0
|
594
|
+
def field
|
595
|
+
elements[0]
|
596
|
+
end
|
597
|
+
|
598
|
+
def comparator
|
599
|
+
elements[2]
|
600
|
+
end
|
601
|
+
|
602
|
+
def argument
|
603
|
+
elements[4]
|
604
|
+
end
|
605
|
+
end
|
606
|
+
|
607
|
+
def _nt_comparison_not_include
|
608
|
+
start_index = index
|
609
|
+
if node_cache[:comparison_not_include].has_key?(index)
|
610
|
+
cached = node_cache[:comparison_not_include][index]
|
611
|
+
if cached
|
612
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
613
|
+
@index = cached.interval.end
|
614
|
+
end
|
615
|
+
return cached
|
616
|
+
end
|
617
|
+
|
618
|
+
i0, s0 = index, []
|
619
|
+
r1 = _nt_field
|
620
|
+
s0 << r1
|
621
|
+
if r1
|
622
|
+
s2, i2 = [], index
|
623
|
+
loop do
|
624
|
+
r3 = _nt_space
|
625
|
+
if r3
|
626
|
+
s2 << r3
|
627
|
+
else
|
628
|
+
break
|
629
|
+
end
|
630
|
+
end
|
631
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
632
|
+
s0 << r2
|
633
|
+
if r2
|
634
|
+
if has_terminal?('!:', false, index)
|
635
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
636
|
+
@index += 2
|
637
|
+
else
|
638
|
+
terminal_parse_failure('!:')
|
639
|
+
r4 = nil
|
640
|
+
end
|
641
|
+
s0 << r4
|
642
|
+
if r4
|
643
|
+
s5, i5 = [], index
|
644
|
+
loop do
|
645
|
+
r6 = _nt_space
|
646
|
+
if r6
|
647
|
+
s5 << r6
|
648
|
+
else
|
649
|
+
break
|
650
|
+
end
|
651
|
+
end
|
652
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
653
|
+
s0 << r5
|
654
|
+
if r5
|
655
|
+
r7 = _nt_basic
|
656
|
+
s0 << r7
|
657
|
+
end
|
658
|
+
end
|
659
|
+
end
|
660
|
+
end
|
661
|
+
if s0.last
|
662
|
+
r0 = instantiate_node(Nodes::Comparisons::NotInclude,input, i0...index, s0)
|
663
|
+
r0.extend(ComparisonNotInclude0)
|
664
|
+
else
|
665
|
+
@index = i0
|
666
|
+
r0 = nil
|
667
|
+
end
|
668
|
+
|
669
|
+
node_cache[:comparison_not_include][start_index] = r0
|
670
|
+
|
671
|
+
r0
|
672
|
+
end
|
673
|
+
|
674
|
+
module ComparisonLike0
|
675
|
+
def field
|
676
|
+
elements[0]
|
677
|
+
end
|
678
|
+
|
679
|
+
def comparator
|
680
|
+
elements[2]
|
681
|
+
end
|
682
|
+
|
683
|
+
def argument
|
684
|
+
elements[4]
|
685
|
+
end
|
686
|
+
end
|
687
|
+
|
688
|
+
def _nt_comparison_like
|
689
|
+
start_index = index
|
690
|
+
if node_cache[:comparison_like].has_key?(index)
|
691
|
+
cached = node_cache[:comparison_like][index]
|
692
|
+
if cached
|
693
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
694
|
+
@index = cached.interval.end
|
695
|
+
end
|
696
|
+
return cached
|
697
|
+
end
|
698
|
+
|
699
|
+
i0, s0 = index, []
|
700
|
+
r1 = _nt_field
|
701
|
+
s0 << r1
|
702
|
+
if r1
|
703
|
+
s2, i2 = [], index
|
704
|
+
loop do
|
705
|
+
r3 = _nt_space
|
706
|
+
if r3
|
707
|
+
s2 << r3
|
708
|
+
else
|
709
|
+
break
|
710
|
+
end
|
711
|
+
end
|
712
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
713
|
+
s0 << r2
|
714
|
+
if r2
|
715
|
+
if has_terminal?('~', false, index)
|
716
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
717
|
+
@index += 1
|
718
|
+
else
|
719
|
+
terminal_parse_failure('~')
|
720
|
+
r4 = nil
|
721
|
+
end
|
722
|
+
s0 << r4
|
723
|
+
if r4
|
724
|
+
s5, i5 = [], index
|
725
|
+
loop do
|
726
|
+
r6 = _nt_space
|
727
|
+
if r6
|
728
|
+
s5 << r6
|
729
|
+
else
|
730
|
+
break
|
731
|
+
end
|
732
|
+
end
|
733
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
734
|
+
s0 << r5
|
735
|
+
if r5
|
736
|
+
r7 = _nt_basic
|
737
|
+
s0 << r7
|
738
|
+
end
|
739
|
+
end
|
740
|
+
end
|
741
|
+
end
|
742
|
+
if s0.last
|
743
|
+
r0 = instantiate_node(Nodes::Comparisons::Like,input, i0...index, s0)
|
744
|
+
r0.extend(ComparisonLike0)
|
745
|
+
else
|
746
|
+
@index = i0
|
747
|
+
r0 = nil
|
748
|
+
end
|
749
|
+
|
750
|
+
node_cache[:comparison_like][start_index] = r0
|
751
|
+
|
752
|
+
r0
|
753
|
+
end
|
754
|
+
|
755
|
+
module ComparisonGreaterThan0
|
756
|
+
def field
|
757
|
+
elements[0]
|
758
|
+
end
|
759
|
+
|
760
|
+
def comparator
|
761
|
+
elements[2]
|
762
|
+
end
|
763
|
+
|
764
|
+
def argument
|
765
|
+
elements[4]
|
766
|
+
end
|
767
|
+
end
|
768
|
+
|
769
|
+
def _nt_comparison_greater_than
|
770
|
+
start_index = index
|
771
|
+
if node_cache[:comparison_greater_than].has_key?(index)
|
772
|
+
cached = node_cache[:comparison_greater_than][index]
|
773
|
+
if cached
|
774
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
775
|
+
@index = cached.interval.end
|
776
|
+
end
|
777
|
+
return cached
|
778
|
+
end
|
779
|
+
|
780
|
+
i0, s0 = index, []
|
781
|
+
r1 = _nt_field
|
782
|
+
s0 << r1
|
783
|
+
if r1
|
784
|
+
s2, i2 = [], index
|
785
|
+
loop do
|
786
|
+
r3 = _nt_space
|
787
|
+
if r3
|
788
|
+
s2 << r3
|
789
|
+
else
|
790
|
+
break
|
791
|
+
end
|
792
|
+
end
|
793
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
794
|
+
s0 << r2
|
795
|
+
if r2
|
796
|
+
if has_terminal?('>', false, index)
|
797
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
798
|
+
@index += 1
|
799
|
+
else
|
800
|
+
terminal_parse_failure('>')
|
801
|
+
r4 = nil
|
802
|
+
end
|
803
|
+
s0 << r4
|
804
|
+
if r4
|
805
|
+
s5, i5 = [], index
|
806
|
+
loop do
|
807
|
+
r6 = _nt_space
|
808
|
+
if r6
|
809
|
+
s5 << r6
|
810
|
+
else
|
811
|
+
break
|
812
|
+
end
|
813
|
+
end
|
814
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
815
|
+
s0 << r5
|
816
|
+
if r5
|
817
|
+
r7 = _nt_basic
|
818
|
+
s0 << r7
|
819
|
+
end
|
820
|
+
end
|
821
|
+
end
|
822
|
+
end
|
823
|
+
if s0.last
|
824
|
+
r0 = instantiate_node(Nodes::Comparisons::GreaterThan,input, i0...index, s0)
|
825
|
+
r0.extend(ComparisonGreaterThan0)
|
826
|
+
else
|
827
|
+
@index = i0
|
828
|
+
r0 = nil
|
829
|
+
end
|
830
|
+
|
831
|
+
node_cache[:comparison_greater_than][start_index] = r0
|
832
|
+
|
833
|
+
r0
|
834
|
+
end
|
835
|
+
|
836
|
+
module ComparisonGreaterThanOrEqual0
|
837
|
+
def field
|
838
|
+
elements[0]
|
839
|
+
end
|
840
|
+
|
841
|
+
def comparator
|
842
|
+
elements[2]
|
843
|
+
end
|
844
|
+
|
845
|
+
def argument
|
846
|
+
elements[4]
|
847
|
+
end
|
848
|
+
end
|
849
|
+
|
850
|
+
def _nt_comparison_greater_than_or_equal
|
851
|
+
start_index = index
|
852
|
+
if node_cache[:comparison_greater_than_or_equal].has_key?(index)
|
853
|
+
cached = node_cache[:comparison_greater_than_or_equal][index]
|
854
|
+
if cached
|
855
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
856
|
+
@index = cached.interval.end
|
857
|
+
end
|
858
|
+
return cached
|
859
|
+
end
|
860
|
+
|
861
|
+
i0, s0 = index, []
|
862
|
+
r1 = _nt_field
|
863
|
+
s0 << r1
|
864
|
+
if r1
|
865
|
+
s2, i2 = [], index
|
866
|
+
loop do
|
867
|
+
r3 = _nt_space
|
868
|
+
if r3
|
869
|
+
s2 << r3
|
870
|
+
else
|
871
|
+
break
|
872
|
+
end
|
873
|
+
end
|
874
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
875
|
+
s0 << r2
|
876
|
+
if r2
|
877
|
+
if has_terminal?('>=', false, index)
|
878
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
879
|
+
@index += 2
|
880
|
+
else
|
881
|
+
terminal_parse_failure('>=')
|
882
|
+
r4 = nil
|
883
|
+
end
|
884
|
+
s0 << r4
|
885
|
+
if r4
|
886
|
+
s5, i5 = [], index
|
887
|
+
loop do
|
888
|
+
r6 = _nt_space
|
889
|
+
if r6
|
890
|
+
s5 << r6
|
891
|
+
else
|
892
|
+
break
|
893
|
+
end
|
894
|
+
end
|
895
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
896
|
+
s0 << r5
|
897
|
+
if r5
|
898
|
+
r7 = _nt_basic
|
899
|
+
s0 << r7
|
900
|
+
end
|
901
|
+
end
|
902
|
+
end
|
903
|
+
end
|
904
|
+
if s0.last
|
905
|
+
r0 = instantiate_node(Nodes::Comparisons::GreaterThanOrEqual,input, i0...index, s0)
|
906
|
+
r0.extend(ComparisonGreaterThanOrEqual0)
|
907
|
+
else
|
908
|
+
@index = i0
|
909
|
+
r0 = nil
|
910
|
+
end
|
911
|
+
|
912
|
+
node_cache[:comparison_greater_than_or_equal][start_index] = r0
|
913
|
+
|
914
|
+
r0
|
915
|
+
end
|
916
|
+
|
917
|
+
module ComparisonLessThan0
|
918
|
+
def field
|
919
|
+
elements[0]
|
920
|
+
end
|
921
|
+
|
922
|
+
def comparator
|
923
|
+
elements[2]
|
924
|
+
end
|
925
|
+
|
926
|
+
def argument
|
927
|
+
elements[4]
|
928
|
+
end
|
929
|
+
end
|
930
|
+
|
931
|
+
def _nt_comparison_less_than
|
932
|
+
start_index = index
|
933
|
+
if node_cache[:comparison_less_than].has_key?(index)
|
934
|
+
cached = node_cache[:comparison_less_than][index]
|
935
|
+
if cached
|
936
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
937
|
+
@index = cached.interval.end
|
938
|
+
end
|
939
|
+
return cached
|
940
|
+
end
|
941
|
+
|
942
|
+
i0, s0 = index, []
|
943
|
+
r1 = _nt_field
|
944
|
+
s0 << r1
|
945
|
+
if r1
|
946
|
+
s2, i2 = [], index
|
947
|
+
loop do
|
948
|
+
r3 = _nt_space
|
949
|
+
if r3
|
950
|
+
s2 << r3
|
951
|
+
else
|
952
|
+
break
|
953
|
+
end
|
954
|
+
end
|
955
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
956
|
+
s0 << r2
|
957
|
+
if r2
|
958
|
+
if has_terminal?('<', false, index)
|
959
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
960
|
+
@index += 1
|
961
|
+
else
|
962
|
+
terminal_parse_failure('<')
|
963
|
+
r4 = nil
|
964
|
+
end
|
965
|
+
s0 << r4
|
966
|
+
if r4
|
967
|
+
s5, i5 = [], index
|
968
|
+
loop do
|
969
|
+
r6 = _nt_space
|
970
|
+
if r6
|
971
|
+
s5 << r6
|
972
|
+
else
|
973
|
+
break
|
974
|
+
end
|
975
|
+
end
|
976
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
977
|
+
s0 << r5
|
978
|
+
if r5
|
979
|
+
r7 = _nt_basic
|
980
|
+
s0 << r7
|
981
|
+
end
|
982
|
+
end
|
983
|
+
end
|
984
|
+
end
|
985
|
+
if s0.last
|
986
|
+
r0 = instantiate_node(Nodes::Comparisons::LessThan,input, i0...index, s0)
|
987
|
+
r0.extend(ComparisonLessThan0)
|
988
|
+
else
|
989
|
+
@index = i0
|
990
|
+
r0 = nil
|
991
|
+
end
|
992
|
+
|
993
|
+
node_cache[:comparison_less_than][start_index] = r0
|
994
|
+
|
995
|
+
r0
|
996
|
+
end
|
997
|
+
|
998
|
+
module ComparisonLessThanOrEqual0
|
999
|
+
def field
|
1000
|
+
elements[0]
|
1001
|
+
end
|
1002
|
+
|
1003
|
+
def comparator
|
1004
|
+
elements[2]
|
1005
|
+
end
|
1006
|
+
|
1007
|
+
def argument
|
1008
|
+
elements[4]
|
1009
|
+
end
|
1010
|
+
end
|
1011
|
+
|
1012
|
+
def _nt_comparison_less_than_or_equal
|
1013
|
+
start_index = index
|
1014
|
+
if node_cache[:comparison_less_than_or_equal].has_key?(index)
|
1015
|
+
cached = node_cache[:comparison_less_than_or_equal][index]
|
1016
|
+
if cached
|
1017
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1018
|
+
@index = cached.interval.end
|
1019
|
+
end
|
1020
|
+
return cached
|
1021
|
+
end
|
1022
|
+
|
1023
|
+
i0, s0 = index, []
|
1024
|
+
r1 = _nt_field
|
1025
|
+
s0 << r1
|
1026
|
+
if r1
|
1027
|
+
s2, i2 = [], index
|
1028
|
+
loop do
|
1029
|
+
r3 = _nt_space
|
1030
|
+
if r3
|
1031
|
+
s2 << r3
|
1032
|
+
else
|
1033
|
+
break
|
1034
|
+
end
|
1035
|
+
end
|
1036
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1037
|
+
s0 << r2
|
1038
|
+
if r2
|
1039
|
+
if has_terminal?('<=', false, index)
|
1040
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1041
|
+
@index += 2
|
1042
|
+
else
|
1043
|
+
terminal_parse_failure('<=')
|
1044
|
+
r4 = nil
|
1045
|
+
end
|
1046
|
+
s0 << r4
|
1047
|
+
if r4
|
1048
|
+
s5, i5 = [], index
|
1049
|
+
loop do
|
1050
|
+
r6 = _nt_space
|
1051
|
+
if r6
|
1052
|
+
s5 << r6
|
1053
|
+
else
|
1054
|
+
break
|
1055
|
+
end
|
1056
|
+
end
|
1057
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1058
|
+
s0 << r5
|
1059
|
+
if r5
|
1060
|
+
r7 = _nt_basic
|
1061
|
+
s0 << r7
|
1062
|
+
end
|
1063
|
+
end
|
1064
|
+
end
|
1065
|
+
end
|
1066
|
+
if s0.last
|
1067
|
+
r0 = instantiate_node(Nodes::Comparisons::LessThanOrEqual,input, i0...index, s0)
|
1068
|
+
r0.extend(ComparisonLessThanOrEqual0)
|
1069
|
+
else
|
1070
|
+
@index = i0
|
1071
|
+
r0 = nil
|
1072
|
+
end
|
1073
|
+
|
1074
|
+
node_cache[:comparison_less_than_or_equal][start_index] = r0
|
1075
|
+
|
1076
|
+
r0
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
module ComparisonNotEqual0
|
1080
|
+
def field
|
1081
|
+
elements[0]
|
1082
|
+
end
|
1083
|
+
|
1084
|
+
def comparator
|
1085
|
+
elements[2]
|
1086
|
+
end
|
1087
|
+
|
1088
|
+
def argument
|
1089
|
+
elements[4]
|
1090
|
+
end
|
1091
|
+
end
|
1092
|
+
|
1093
|
+
def _nt_comparison_not_equal
|
1094
|
+
start_index = index
|
1095
|
+
if node_cache[:comparison_not_equal].has_key?(index)
|
1096
|
+
cached = node_cache[:comparison_not_equal][index]
|
1097
|
+
if cached
|
1098
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1099
|
+
@index = cached.interval.end
|
1100
|
+
end
|
1101
|
+
return cached
|
1102
|
+
end
|
1103
|
+
|
1104
|
+
i0, s0 = index, []
|
1105
|
+
r1 = _nt_field
|
1106
|
+
s0 << r1
|
1107
|
+
if r1
|
1108
|
+
s2, i2 = [], index
|
1109
|
+
loop do
|
1110
|
+
r3 = _nt_space
|
1111
|
+
if r3
|
1112
|
+
s2 << r3
|
1113
|
+
else
|
1114
|
+
break
|
1115
|
+
end
|
1116
|
+
end
|
1117
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1118
|
+
s0 << r2
|
1119
|
+
if r2
|
1120
|
+
if has_terminal?('!=', false, index)
|
1121
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1122
|
+
@index += 2
|
1123
|
+
else
|
1124
|
+
terminal_parse_failure('!=')
|
1125
|
+
r4 = nil
|
1126
|
+
end
|
1127
|
+
s0 << r4
|
1128
|
+
if r4
|
1129
|
+
s5, i5 = [], index
|
1130
|
+
loop do
|
1131
|
+
r6 = _nt_space
|
1132
|
+
if r6
|
1133
|
+
s5 << r6
|
1134
|
+
else
|
1135
|
+
break
|
1136
|
+
end
|
1137
|
+
end
|
1138
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1139
|
+
s0 << r5
|
1140
|
+
if r5
|
1141
|
+
r7 = _nt_basic
|
1142
|
+
s0 << r7
|
1143
|
+
end
|
1144
|
+
end
|
1145
|
+
end
|
1146
|
+
end
|
1147
|
+
if s0.last
|
1148
|
+
r0 = instantiate_node(Nodes::Comparisons::NotEqual,input, i0...index, s0)
|
1149
|
+
r0.extend(ComparisonNotEqual0)
|
1150
|
+
else
|
1151
|
+
@index = i0
|
1152
|
+
r0 = nil
|
1153
|
+
end
|
1154
|
+
|
1155
|
+
node_cache[:comparison_not_equal][start_index] = r0
|
1156
|
+
|
1157
|
+
r0
|
1158
|
+
end
|
1159
|
+
|
1160
|
+
module ComparisonEqual0
|
1161
|
+
def field
|
1162
|
+
elements[0]
|
1163
|
+
end
|
1164
|
+
|
1165
|
+
def comparator
|
1166
|
+
elements[2]
|
1167
|
+
end
|
1168
|
+
|
1169
|
+
def argument
|
1170
|
+
elements[4]
|
1171
|
+
end
|
1172
|
+
end
|
1173
|
+
|
1174
|
+
def _nt_comparison_equal
|
1175
|
+
start_index = index
|
1176
|
+
if node_cache[:comparison_equal].has_key?(index)
|
1177
|
+
cached = node_cache[:comparison_equal][index]
|
1178
|
+
if cached
|
1179
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1180
|
+
@index = cached.interval.end
|
1181
|
+
end
|
1182
|
+
return cached
|
1183
|
+
end
|
1184
|
+
|
1185
|
+
i0, s0 = index, []
|
1186
|
+
r1 = _nt_field
|
1187
|
+
s0 << r1
|
1188
|
+
if r1
|
1189
|
+
s2, i2 = [], index
|
1190
|
+
loop do
|
1191
|
+
r3 = _nt_space
|
1192
|
+
if r3
|
1193
|
+
s2 << r3
|
1194
|
+
else
|
1195
|
+
break
|
1196
|
+
end
|
1197
|
+
end
|
1198
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1199
|
+
s0 << r2
|
1200
|
+
if r2
|
1201
|
+
if has_terminal?('=', false, index)
|
1202
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1203
|
+
@index += 1
|
1204
|
+
else
|
1205
|
+
terminal_parse_failure('=')
|
1206
|
+
r4 = nil
|
1207
|
+
end
|
1208
|
+
s0 << r4
|
1209
|
+
if r4
|
1210
|
+
s5, i5 = [], index
|
1211
|
+
loop do
|
1212
|
+
r6 = _nt_space
|
1213
|
+
if r6
|
1214
|
+
s5 << r6
|
1215
|
+
else
|
1216
|
+
break
|
1217
|
+
end
|
1218
|
+
end
|
1219
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1220
|
+
s0 << r5
|
1221
|
+
if r5
|
1222
|
+
r7 = _nt_basic
|
1223
|
+
s0 << r7
|
1224
|
+
end
|
1225
|
+
end
|
1226
|
+
end
|
1227
|
+
end
|
1228
|
+
if s0.last
|
1229
|
+
r0 = instantiate_node(Nodes::Comparisons::Equal,input, i0...index, s0)
|
1230
|
+
r0.extend(ComparisonEqual0)
|
1231
|
+
else
|
1232
|
+
@index = i0
|
1233
|
+
r0 = nil
|
1234
|
+
end
|
1235
|
+
|
1236
|
+
node_cache[:comparison_equal][start_index] = r0
|
1237
|
+
|
1238
|
+
r0
|
1239
|
+
end
|
1240
|
+
|
1241
|
+
def _nt_basic
|
1242
|
+
start_index = index
|
1243
|
+
if node_cache[:basic].has_key?(index)
|
1244
|
+
cached = node_cache[:basic][index]
|
1245
|
+
if cached
|
1246
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1247
|
+
@index = cached.interval.end
|
1248
|
+
end
|
1249
|
+
return cached
|
1250
|
+
end
|
1251
|
+
|
1252
|
+
i0 = index
|
1253
|
+
r1 = _nt_boolean
|
1254
|
+
if r1
|
1255
|
+
r0 = r1
|
1256
|
+
else
|
1257
|
+
r2 = _nt_time
|
1258
|
+
if r2
|
1259
|
+
r0 = r2
|
1260
|
+
else
|
1261
|
+
r3 = _nt_float
|
1262
|
+
if r3
|
1263
|
+
r0 = r3
|
1264
|
+
else
|
1265
|
+
r4 = _nt_integer
|
1266
|
+
if r4
|
1267
|
+
r0 = r4
|
1268
|
+
else
|
1269
|
+
r5 = _nt_literal_string
|
1270
|
+
if r5
|
1271
|
+
r0 = r5
|
1272
|
+
else
|
1273
|
+
r6 = _nt_string
|
1274
|
+
if r6
|
1275
|
+
r0 = r6
|
1276
|
+
else
|
1277
|
+
@index = i0
|
1278
|
+
r0 = nil
|
1279
|
+
end
|
1280
|
+
end
|
1281
|
+
end
|
1282
|
+
end
|
1283
|
+
end
|
1284
|
+
end
|
1285
|
+
|
1286
|
+
node_cache[:basic][start_index] = r0
|
1287
|
+
|
1288
|
+
r0
|
1289
|
+
end
|
1290
|
+
|
1291
|
+
def _nt_space
|
1292
|
+
start_index = index
|
1293
|
+
if node_cache[:space].has_key?(index)
|
1294
|
+
cached = node_cache[:space][index]
|
1295
|
+
if cached
|
1296
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1297
|
+
@index = cached.interval.end
|
1298
|
+
end
|
1299
|
+
return cached
|
1300
|
+
end
|
1301
|
+
|
1302
|
+
if has_terminal?('\G[\\s\\t\\n]', true, index)
|
1303
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1304
|
+
@index += 1
|
1305
|
+
else
|
1306
|
+
r0 = nil
|
1307
|
+
end
|
1308
|
+
|
1309
|
+
node_cache[:space][start_index] = r0
|
1310
|
+
|
1311
|
+
r0
|
1312
|
+
end
|
1313
|
+
|
1314
|
+
def _nt_field_name
|
1315
|
+
start_index = index
|
1316
|
+
if node_cache[:field_name].has_key?(index)
|
1317
|
+
cached = node_cache[:field_name][index]
|
1318
|
+
if cached
|
1319
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1320
|
+
@index = cached.interval.end
|
1321
|
+
end
|
1322
|
+
return cached
|
1323
|
+
end
|
1324
|
+
|
1325
|
+
s0, i0 = [], index
|
1326
|
+
loop do
|
1327
|
+
if has_terminal?('\G[a-z_]', true, index)
|
1328
|
+
r1 = true
|
1329
|
+
@index += 1
|
1330
|
+
else
|
1331
|
+
r1 = nil
|
1332
|
+
end
|
1333
|
+
if r1
|
1334
|
+
s0 << r1
|
1335
|
+
else
|
1336
|
+
break
|
1337
|
+
end
|
1338
|
+
end
|
1339
|
+
if s0.empty?
|
1340
|
+
@index = i0
|
1341
|
+
r0 = nil
|
1342
|
+
else
|
1343
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1344
|
+
end
|
1345
|
+
|
1346
|
+
node_cache[:field_name][start_index] = r0
|
1347
|
+
|
1348
|
+
r0
|
1349
|
+
end
|
1350
|
+
|
1351
|
+
module Time0
|
1352
|
+
def value
|
1353
|
+
elements[0]
|
1354
|
+
end
|
1355
|
+
|
1356
|
+
end
|
1357
|
+
|
1358
|
+
module Time1
|
1359
|
+
def digit1
|
1360
|
+
elements[0]
|
1361
|
+
end
|
1362
|
+
|
1363
|
+
def digit2
|
1364
|
+
elements[1]
|
1365
|
+
end
|
1366
|
+
end
|
1367
|
+
|
1368
|
+
module Time2
|
1369
|
+
def digit1
|
1370
|
+
elements[0]
|
1371
|
+
end
|
1372
|
+
|
1373
|
+
def digit2
|
1374
|
+
elements[1]
|
1375
|
+
end
|
1376
|
+
end
|
1377
|
+
|
1378
|
+
module Time3
|
1379
|
+
def digit1
|
1380
|
+
elements[0]
|
1381
|
+
end
|
1382
|
+
|
1383
|
+
def digit2
|
1384
|
+
elements[1]
|
1385
|
+
end
|
1386
|
+
end
|
1387
|
+
|
1388
|
+
module Time4
|
1389
|
+
def value
|
1390
|
+
elements[1]
|
1391
|
+
end
|
1392
|
+
end
|
1393
|
+
|
1394
|
+
module Time5
|
1395
|
+
def value
|
1396
|
+
elements[0]
|
1397
|
+
end
|
1398
|
+
end
|
1399
|
+
|
1400
|
+
module Time6
|
1401
|
+
def date
|
1402
|
+
elements[0]
|
1403
|
+
end
|
1404
|
+
|
1405
|
+
def hour
|
1406
|
+
elements[1]
|
1407
|
+
end
|
1408
|
+
|
1409
|
+
def minutes
|
1410
|
+
elements[3]
|
1411
|
+
end
|
1412
|
+
|
1413
|
+
def seconds
|
1414
|
+
elements[4]
|
1415
|
+
end
|
1416
|
+
|
1417
|
+
def timezone
|
1418
|
+
elements[5]
|
1419
|
+
end
|
1420
|
+
end
|
1421
|
+
|
1422
|
+
def _nt_time
|
1423
|
+
start_index = index
|
1424
|
+
if node_cache[:time].has_key?(index)
|
1425
|
+
cached = node_cache[:time][index]
|
1426
|
+
if cached
|
1427
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1428
|
+
@index = cached.interval.end
|
1429
|
+
end
|
1430
|
+
return cached
|
1431
|
+
end
|
1432
|
+
|
1433
|
+
i0, s0 = index, []
|
1434
|
+
i2, s2 = index, []
|
1435
|
+
r3 = _nt_date
|
1436
|
+
s2 << r3
|
1437
|
+
if r3
|
1438
|
+
if has_terminal?('T', false, index)
|
1439
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1440
|
+
@index += 1
|
1441
|
+
else
|
1442
|
+
terminal_parse_failure('T')
|
1443
|
+
r4 = nil
|
1444
|
+
end
|
1445
|
+
s2 << r4
|
1446
|
+
end
|
1447
|
+
if s2.last
|
1448
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1449
|
+
r2.extend(Time0)
|
1450
|
+
else
|
1451
|
+
@index = i2
|
1452
|
+
r2 = nil
|
1453
|
+
end
|
1454
|
+
if r2
|
1455
|
+
r1 = r2
|
1456
|
+
else
|
1457
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
1458
|
+
end
|
1459
|
+
s0 << r1
|
1460
|
+
if r1
|
1461
|
+
i5, s5 = index, []
|
1462
|
+
r6 = _nt_digit
|
1463
|
+
s5 << r6
|
1464
|
+
if r6
|
1465
|
+
r7 = _nt_digit
|
1466
|
+
s5 << r7
|
1467
|
+
end
|
1468
|
+
if s5.last
|
1469
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1470
|
+
r5.extend(Time1)
|
1471
|
+
else
|
1472
|
+
@index = i5
|
1473
|
+
r5 = nil
|
1474
|
+
end
|
1475
|
+
s0 << r5
|
1476
|
+
if r5
|
1477
|
+
if has_terminal?(':', false, index)
|
1478
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1479
|
+
@index += 1
|
1480
|
+
else
|
1481
|
+
terminal_parse_failure(':')
|
1482
|
+
r8 = nil
|
1483
|
+
end
|
1484
|
+
s0 << r8
|
1485
|
+
if r8
|
1486
|
+
i9, s9 = index, []
|
1487
|
+
r10 = _nt_digit
|
1488
|
+
s9 << r10
|
1489
|
+
if r10
|
1490
|
+
r11 = _nt_digit
|
1491
|
+
s9 << r11
|
1492
|
+
end
|
1493
|
+
if s9.last
|
1494
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
1495
|
+
r9.extend(Time2)
|
1496
|
+
else
|
1497
|
+
@index = i9
|
1498
|
+
r9 = nil
|
1499
|
+
end
|
1500
|
+
s0 << r9
|
1501
|
+
if r9
|
1502
|
+
i13, s13 = index, []
|
1503
|
+
if has_terminal?(':', false, index)
|
1504
|
+
r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1505
|
+
@index += 1
|
1506
|
+
else
|
1507
|
+
terminal_parse_failure(':')
|
1508
|
+
r14 = nil
|
1509
|
+
end
|
1510
|
+
s13 << r14
|
1511
|
+
if r14
|
1512
|
+
i15, s15 = index, []
|
1513
|
+
r16 = _nt_digit
|
1514
|
+
s15 << r16
|
1515
|
+
if r16
|
1516
|
+
r17 = _nt_digit
|
1517
|
+
s15 << r17
|
1518
|
+
end
|
1519
|
+
if s15.last
|
1520
|
+
r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
|
1521
|
+
r15.extend(Time3)
|
1522
|
+
else
|
1523
|
+
@index = i15
|
1524
|
+
r15 = nil
|
1525
|
+
end
|
1526
|
+
s13 << r15
|
1527
|
+
end
|
1528
|
+
if s13.last
|
1529
|
+
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
1530
|
+
r13.extend(Time4)
|
1531
|
+
else
|
1532
|
+
@index = i13
|
1533
|
+
r13 = nil
|
1534
|
+
end
|
1535
|
+
if r13
|
1536
|
+
r12 = r13
|
1537
|
+
else
|
1538
|
+
r12 = instantiate_node(SyntaxNode,input, index...index)
|
1539
|
+
end
|
1540
|
+
s0 << r12
|
1541
|
+
if r12
|
1542
|
+
i19, s19 = index, []
|
1543
|
+
r20 = _nt_timezone
|
1544
|
+
s19 << r20
|
1545
|
+
if s19.last
|
1546
|
+
r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
|
1547
|
+
r19.extend(Time5)
|
1548
|
+
else
|
1549
|
+
@index = i19
|
1550
|
+
r19 = nil
|
1551
|
+
end
|
1552
|
+
if r19
|
1553
|
+
r18 = r19
|
1554
|
+
else
|
1555
|
+
r18 = instantiate_node(SyntaxNode,input, index...index)
|
1556
|
+
end
|
1557
|
+
s0 << r18
|
1558
|
+
end
|
1559
|
+
end
|
1560
|
+
end
|
1561
|
+
end
|
1562
|
+
end
|
1563
|
+
if s0.last
|
1564
|
+
r0 = instantiate_node(Nodes::Constants::Time,input, i0...index, s0)
|
1565
|
+
r0.extend(Time6)
|
1566
|
+
else
|
1567
|
+
@index = i0
|
1568
|
+
r0 = nil
|
1569
|
+
end
|
1570
|
+
|
1571
|
+
node_cache[:time][start_index] = r0
|
1572
|
+
|
1573
|
+
r0
|
1574
|
+
end
|
1575
|
+
|
1576
|
+
module Date0
|
1577
|
+
def digit1
|
1578
|
+
elements[0]
|
1579
|
+
end
|
1580
|
+
|
1581
|
+
def digit2
|
1582
|
+
elements[1]
|
1583
|
+
end
|
1584
|
+
|
1585
|
+
def digit3
|
1586
|
+
elements[2]
|
1587
|
+
end
|
1588
|
+
|
1589
|
+
def digit4
|
1590
|
+
elements[3]
|
1591
|
+
end
|
1592
|
+
end
|
1593
|
+
|
1594
|
+
module Date1
|
1595
|
+
def digit1
|
1596
|
+
elements[0]
|
1597
|
+
end
|
1598
|
+
|
1599
|
+
def digit2
|
1600
|
+
elements[1]
|
1601
|
+
end
|
1602
|
+
end
|
1603
|
+
|
1604
|
+
module Date2
|
1605
|
+
def digit1
|
1606
|
+
elements[0]
|
1607
|
+
end
|
1608
|
+
|
1609
|
+
def digit2
|
1610
|
+
elements[1]
|
1611
|
+
end
|
1612
|
+
end
|
1613
|
+
|
1614
|
+
module Date3
|
1615
|
+
def year
|
1616
|
+
elements[0]
|
1617
|
+
end
|
1618
|
+
|
1619
|
+
def month
|
1620
|
+
elements[2]
|
1621
|
+
end
|
1622
|
+
|
1623
|
+
def day
|
1624
|
+
elements[4]
|
1625
|
+
end
|
1626
|
+
end
|
1627
|
+
|
1628
|
+
def _nt_date
|
1629
|
+
start_index = index
|
1630
|
+
if node_cache[:date].has_key?(index)
|
1631
|
+
cached = node_cache[:date][index]
|
1632
|
+
if cached
|
1633
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1634
|
+
@index = cached.interval.end
|
1635
|
+
end
|
1636
|
+
return cached
|
1637
|
+
end
|
1638
|
+
|
1639
|
+
i0, s0 = index, []
|
1640
|
+
i1, s1 = index, []
|
1641
|
+
r2 = _nt_digit
|
1642
|
+
s1 << r2
|
1643
|
+
if r2
|
1644
|
+
r3 = _nt_digit
|
1645
|
+
s1 << r3
|
1646
|
+
if r3
|
1647
|
+
r4 = _nt_digit
|
1648
|
+
s1 << r4
|
1649
|
+
if r4
|
1650
|
+
r5 = _nt_digit
|
1651
|
+
s1 << r5
|
1652
|
+
end
|
1653
|
+
end
|
1654
|
+
end
|
1655
|
+
if s1.last
|
1656
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1657
|
+
r1.extend(Date0)
|
1658
|
+
else
|
1659
|
+
@index = i1
|
1660
|
+
r1 = nil
|
1661
|
+
end
|
1662
|
+
s0 << r1
|
1663
|
+
if r1
|
1664
|
+
if has_terminal?('-', false, index)
|
1665
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1666
|
+
@index += 1
|
1667
|
+
else
|
1668
|
+
terminal_parse_failure('-')
|
1669
|
+
r6 = nil
|
1670
|
+
end
|
1671
|
+
s0 << r6
|
1672
|
+
if r6
|
1673
|
+
i7, s7 = index, []
|
1674
|
+
r8 = _nt_digit
|
1675
|
+
s7 << r8
|
1676
|
+
if r8
|
1677
|
+
r9 = _nt_digit
|
1678
|
+
s7 << r9
|
1679
|
+
end
|
1680
|
+
if s7.last
|
1681
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
1682
|
+
r7.extend(Date1)
|
1683
|
+
else
|
1684
|
+
@index = i7
|
1685
|
+
r7 = nil
|
1686
|
+
end
|
1687
|
+
s0 << r7
|
1688
|
+
if r7
|
1689
|
+
if has_terminal?('-', false, index)
|
1690
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1691
|
+
@index += 1
|
1692
|
+
else
|
1693
|
+
terminal_parse_failure('-')
|
1694
|
+
r10 = nil
|
1695
|
+
end
|
1696
|
+
s0 << r10
|
1697
|
+
if r10
|
1698
|
+
i11, s11 = index, []
|
1699
|
+
r12 = _nt_digit
|
1700
|
+
s11 << r12
|
1701
|
+
if r12
|
1702
|
+
r13 = _nt_digit
|
1703
|
+
s11 << r13
|
1704
|
+
end
|
1705
|
+
if s11.last
|
1706
|
+
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
1707
|
+
r11.extend(Date2)
|
1708
|
+
else
|
1709
|
+
@index = i11
|
1710
|
+
r11 = nil
|
1711
|
+
end
|
1712
|
+
s0 << r11
|
1713
|
+
end
|
1714
|
+
end
|
1715
|
+
end
|
1716
|
+
end
|
1717
|
+
if s0.last
|
1718
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1719
|
+
r0.extend(Date3)
|
1720
|
+
else
|
1721
|
+
@index = i0
|
1722
|
+
r0 = nil
|
1723
|
+
end
|
1724
|
+
|
1725
|
+
node_cache[:date][start_index] = r0
|
1726
|
+
|
1727
|
+
r0
|
1728
|
+
end
|
1729
|
+
|
1730
|
+
module Timezone0
|
1731
|
+
def digit1
|
1732
|
+
elements[0]
|
1733
|
+
end
|
1734
|
+
|
1735
|
+
def digit2
|
1736
|
+
elements[1]
|
1737
|
+
end
|
1738
|
+
end
|
1739
|
+
|
1740
|
+
module Timezone1
|
1741
|
+
def digit1
|
1742
|
+
elements[0]
|
1743
|
+
end
|
1744
|
+
|
1745
|
+
def digit2
|
1746
|
+
elements[1]
|
1747
|
+
end
|
1748
|
+
end
|
1749
|
+
|
1750
|
+
module Timezone2
|
1751
|
+
def sign
|
1752
|
+
elements[0]
|
1753
|
+
end
|
1754
|
+
|
1755
|
+
def hour
|
1756
|
+
elements[1]
|
1757
|
+
end
|
1758
|
+
|
1759
|
+
def minutes
|
1760
|
+
elements[3]
|
1761
|
+
end
|
1762
|
+
end
|
1763
|
+
|
1764
|
+
def _nt_timezone
|
1765
|
+
start_index = index
|
1766
|
+
if node_cache[:timezone].has_key?(index)
|
1767
|
+
cached = node_cache[:timezone][index]
|
1768
|
+
if cached
|
1769
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1770
|
+
@index = cached.interval.end
|
1771
|
+
end
|
1772
|
+
return cached
|
1773
|
+
end
|
1774
|
+
|
1775
|
+
i0, s0 = index, []
|
1776
|
+
r1 = _nt_sign
|
1777
|
+
s0 << r1
|
1778
|
+
if r1
|
1779
|
+
i2, s2 = index, []
|
1780
|
+
r3 = _nt_digit
|
1781
|
+
s2 << r3
|
1782
|
+
if r3
|
1783
|
+
r4 = _nt_digit
|
1784
|
+
s2 << r4
|
1785
|
+
end
|
1786
|
+
if s2.last
|
1787
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1788
|
+
r2.extend(Timezone0)
|
1789
|
+
else
|
1790
|
+
@index = i2
|
1791
|
+
r2 = nil
|
1792
|
+
end
|
1793
|
+
s0 << r2
|
1794
|
+
if r2
|
1795
|
+
if has_terminal?(':', false, index)
|
1796
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1797
|
+
@index += 1
|
1798
|
+
else
|
1799
|
+
terminal_parse_failure(':')
|
1800
|
+
r5 = nil
|
1801
|
+
end
|
1802
|
+
s0 << r5
|
1803
|
+
if r5
|
1804
|
+
i6, s6 = index, []
|
1805
|
+
r7 = _nt_digit
|
1806
|
+
s6 << r7
|
1807
|
+
if r7
|
1808
|
+
r8 = _nt_digit
|
1809
|
+
s6 << r8
|
1810
|
+
end
|
1811
|
+
if s6.last
|
1812
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
1813
|
+
r6.extend(Timezone1)
|
1814
|
+
else
|
1815
|
+
@index = i6
|
1816
|
+
r6 = nil
|
1817
|
+
end
|
1818
|
+
s0 << r6
|
1819
|
+
end
|
1820
|
+
end
|
1821
|
+
end
|
1822
|
+
if s0.last
|
1823
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1824
|
+
r0.extend(Timezone2)
|
1825
|
+
else
|
1826
|
+
@index = i0
|
1827
|
+
r0 = nil
|
1828
|
+
end
|
1829
|
+
|
1830
|
+
node_cache[:timezone][start_index] = r0
|
1831
|
+
|
1832
|
+
r0
|
1833
|
+
end
|
1834
|
+
|
1835
|
+
def _nt_sign
|
1836
|
+
start_index = index
|
1837
|
+
if node_cache[:sign].has_key?(index)
|
1838
|
+
cached = node_cache[:sign][index]
|
1839
|
+
if cached
|
1840
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1841
|
+
@index = cached.interval.end
|
1842
|
+
end
|
1843
|
+
return cached
|
1844
|
+
end
|
1845
|
+
|
1846
|
+
i0 = index
|
1847
|
+
if has_terminal?('+', false, index)
|
1848
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1849
|
+
@index += 1
|
1850
|
+
else
|
1851
|
+
terminal_parse_failure('+')
|
1852
|
+
r1 = nil
|
1853
|
+
end
|
1854
|
+
if r1
|
1855
|
+
r0 = r1
|
1856
|
+
else
|
1857
|
+
if has_terminal?('-', false, index)
|
1858
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1859
|
+
@index += 1
|
1860
|
+
else
|
1861
|
+
terminal_parse_failure('-')
|
1862
|
+
r2 = nil
|
1863
|
+
end
|
1864
|
+
if r2
|
1865
|
+
r0 = r2
|
1866
|
+
else
|
1867
|
+
@index = i0
|
1868
|
+
r0 = nil
|
1869
|
+
end
|
1870
|
+
end
|
1871
|
+
|
1872
|
+
node_cache[:sign][start_index] = r0
|
1873
|
+
|
1874
|
+
r0
|
1875
|
+
end
|
1876
|
+
|
1877
|
+
module LiteralString0
|
1878
|
+
def string
|
1879
|
+
elements[1]
|
1880
|
+
end
|
1881
|
+
|
1882
|
+
end
|
1883
|
+
|
1884
|
+
def _nt_literal_string
|
1885
|
+
start_index = index
|
1886
|
+
if node_cache[:literal_string].has_key?(index)
|
1887
|
+
cached = node_cache[:literal_string][index]
|
1888
|
+
if cached
|
1889
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1890
|
+
@index = cached.interval.end
|
1891
|
+
end
|
1892
|
+
return cached
|
1893
|
+
end
|
1894
|
+
|
1895
|
+
i0, s0 = index, []
|
1896
|
+
if has_terminal?('"', false, index)
|
1897
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1898
|
+
@index += 1
|
1899
|
+
else
|
1900
|
+
terminal_parse_failure('"')
|
1901
|
+
r1 = nil
|
1902
|
+
end
|
1903
|
+
s0 << r1
|
1904
|
+
if r1
|
1905
|
+
s2, i2 = [], index
|
1906
|
+
loop do
|
1907
|
+
r3 = _nt_any_character
|
1908
|
+
if r3
|
1909
|
+
s2 << r3
|
1910
|
+
else
|
1911
|
+
break
|
1912
|
+
end
|
1913
|
+
end
|
1914
|
+
if s2.empty?
|
1915
|
+
@index = i2
|
1916
|
+
r2 = nil
|
1917
|
+
else
|
1918
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1919
|
+
end
|
1920
|
+
s0 << r2
|
1921
|
+
if r2
|
1922
|
+
if has_terminal?('"', false, index)
|
1923
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1924
|
+
@index += 1
|
1925
|
+
else
|
1926
|
+
terminal_parse_failure('"')
|
1927
|
+
r4 = nil
|
1928
|
+
end
|
1929
|
+
s0 << r4
|
1930
|
+
end
|
1931
|
+
end
|
1932
|
+
if s0.last
|
1933
|
+
r0 = instantiate_node(Nodes::Constants::LiteralString,input, i0...index, s0)
|
1934
|
+
r0.extend(LiteralString0)
|
1935
|
+
else
|
1936
|
+
@index = i0
|
1937
|
+
r0 = nil
|
1938
|
+
end
|
1939
|
+
|
1940
|
+
node_cache[:literal_string][start_index] = r0
|
1941
|
+
|
1942
|
+
r0
|
1943
|
+
end
|
1944
|
+
|
1945
|
+
def _nt_string
|
1946
|
+
start_index = index
|
1947
|
+
if node_cache[:string].has_key?(index)
|
1948
|
+
cached = node_cache[:string][index]
|
1949
|
+
if cached
|
1950
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1951
|
+
@index = cached.interval.end
|
1952
|
+
end
|
1953
|
+
return cached
|
1954
|
+
end
|
1955
|
+
|
1956
|
+
s0, i0 = [], index
|
1957
|
+
loop do
|
1958
|
+
r1 = _nt_valid_character
|
1959
|
+
if r1
|
1960
|
+
s0 << r1
|
1961
|
+
else
|
1962
|
+
break
|
1963
|
+
end
|
1964
|
+
end
|
1965
|
+
if s0.empty?
|
1966
|
+
@index = i0
|
1967
|
+
r0 = nil
|
1968
|
+
else
|
1969
|
+
r0 = instantiate_node(Nodes::Constants::String,input, i0...index, s0)
|
1970
|
+
end
|
1971
|
+
|
1972
|
+
node_cache[:string][start_index] = r0
|
1973
|
+
|
1974
|
+
r0
|
1975
|
+
end
|
1976
|
+
|
1977
|
+
def _nt_any_character
|
1978
|
+
start_index = index
|
1979
|
+
if node_cache[:any_character].has_key?(index)
|
1980
|
+
cached = node_cache[:any_character][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 = index
|
1989
|
+
r1 = _nt_valid_character
|
1990
|
+
if r1
|
1991
|
+
r0 = r1
|
1992
|
+
else
|
1993
|
+
r2 = _nt_reserved_character
|
1994
|
+
if r2
|
1995
|
+
r0 = r2
|
1996
|
+
else
|
1997
|
+
@index = i0
|
1998
|
+
r0 = nil
|
1999
|
+
end
|
2000
|
+
end
|
2001
|
+
|
2002
|
+
node_cache[:any_character][start_index] = r0
|
2003
|
+
|
2004
|
+
r0
|
2005
|
+
end
|
2006
|
+
|
2007
|
+
def _nt_valid_character
|
2008
|
+
start_index = index
|
2009
|
+
if node_cache[:valid_character].has_key?(index)
|
2010
|
+
cached = node_cache[:valid_character][index]
|
2011
|
+
if cached
|
2012
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2013
|
+
@index = cached.interval.end
|
2014
|
+
end
|
2015
|
+
return cached
|
2016
|
+
end
|
2017
|
+
|
2018
|
+
if has_terminal?('\G[0-9a-zA-ZÁÀÄÂÃÅĀĂǍáàäâãåāăǎÉÈËÊĒĔĖĚéèëêēĕėěÍÌÏÎĨĬǏíìïîĩĭǐÓÒÖÔÕŌŎŐǑóòöôõōŏőǒÚÙÜÛŨŪŬŮŰǓúùüûũūŭůűǔÑñçÇ%@#+-_\'?!$*/\\s]', true, index)
|
2019
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2020
|
+
@index += 1
|
2021
|
+
else
|
2022
|
+
r0 = nil
|
2023
|
+
end
|
2024
|
+
|
2025
|
+
node_cache[:valid_character][start_index] = r0
|
2026
|
+
|
2027
|
+
r0
|
2028
|
+
end
|
2029
|
+
|
2030
|
+
def _nt_boolean
|
2031
|
+
start_index = index
|
2032
|
+
if node_cache[:boolean].has_key?(index)
|
2033
|
+
cached = node_cache[:boolean][index]
|
2034
|
+
if cached
|
2035
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2036
|
+
@index = cached.interval.end
|
2037
|
+
end
|
2038
|
+
return cached
|
2039
|
+
end
|
2040
|
+
|
2041
|
+
i0 = index
|
2042
|
+
r1 = _nt_true
|
2043
|
+
if r1
|
2044
|
+
r0 = r1
|
2045
|
+
else
|
2046
|
+
r2 = _nt_false
|
2047
|
+
if r2
|
2048
|
+
r0 = r2
|
2049
|
+
else
|
2050
|
+
@index = i0
|
2051
|
+
r0 = nil
|
2052
|
+
end
|
2053
|
+
end
|
2054
|
+
|
2055
|
+
node_cache[:boolean][start_index] = r0
|
2056
|
+
|
2057
|
+
r0
|
2058
|
+
end
|
2059
|
+
|
2060
|
+
def _nt_true
|
2061
|
+
start_index = index
|
2062
|
+
if node_cache[:true].has_key?(index)
|
2063
|
+
cached = node_cache[:true][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
|
+
if has_terminal?('true', false, index)
|
2072
|
+
r0 = instantiate_node(Nodes::Constants::True,input, index...(index + 4))
|
2073
|
+
@index += 4
|
2074
|
+
else
|
2075
|
+
terminal_parse_failure('true')
|
2076
|
+
r0 = nil
|
2077
|
+
end
|
2078
|
+
|
2079
|
+
node_cache[:true][start_index] = r0
|
2080
|
+
|
2081
|
+
r0
|
2082
|
+
end
|
2083
|
+
|
2084
|
+
def _nt_false
|
2085
|
+
start_index = index
|
2086
|
+
if node_cache[:false].has_key?(index)
|
2087
|
+
cached = node_cache[:false][index]
|
2088
|
+
if cached
|
2089
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2090
|
+
@index = cached.interval.end
|
2091
|
+
end
|
2092
|
+
return cached
|
2093
|
+
end
|
2094
|
+
|
2095
|
+
if has_terminal?('false', false, index)
|
2096
|
+
r0 = instantiate_node(Nodes::Constants::False,input, index...(index + 5))
|
2097
|
+
@index += 5
|
2098
|
+
else
|
2099
|
+
terminal_parse_failure('false')
|
2100
|
+
r0 = nil
|
2101
|
+
end
|
2102
|
+
|
2103
|
+
node_cache[:false][start_index] = r0
|
2104
|
+
|
2105
|
+
r0
|
2106
|
+
end
|
2107
|
+
|
2108
|
+
module Float0
|
2109
|
+
end
|
2110
|
+
|
2111
|
+
def _nt_float
|
2112
|
+
start_index = index
|
2113
|
+
if node_cache[:float].has_key?(index)
|
2114
|
+
cached = node_cache[:float][index]
|
2115
|
+
if cached
|
2116
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2117
|
+
@index = cached.interval.end
|
2118
|
+
end
|
2119
|
+
return cached
|
2120
|
+
end
|
2121
|
+
|
2122
|
+
i0, s0 = index, []
|
2123
|
+
s1, i1 = [], index
|
2124
|
+
loop do
|
2125
|
+
r2 = _nt_digit
|
2126
|
+
if r2
|
2127
|
+
s1 << r2
|
2128
|
+
else
|
2129
|
+
break
|
2130
|
+
end
|
2131
|
+
end
|
2132
|
+
if s1.empty?
|
2133
|
+
@index = i1
|
2134
|
+
r1 = nil
|
2135
|
+
else
|
2136
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
2137
|
+
end
|
2138
|
+
s0 << r1
|
2139
|
+
if r1
|
2140
|
+
if has_terminal?('.', false, index)
|
2141
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2142
|
+
@index += 1
|
2143
|
+
else
|
2144
|
+
terminal_parse_failure('.')
|
2145
|
+
r3 = nil
|
2146
|
+
end
|
2147
|
+
s0 << r3
|
2148
|
+
if r3
|
2149
|
+
s4, i4 = [], index
|
2150
|
+
loop do
|
2151
|
+
r5 = _nt_digit
|
2152
|
+
if r5
|
2153
|
+
s4 << r5
|
2154
|
+
else
|
2155
|
+
break
|
2156
|
+
end
|
2157
|
+
end
|
2158
|
+
if s4.empty?
|
2159
|
+
@index = i4
|
2160
|
+
r4 = nil
|
2161
|
+
else
|
2162
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
2163
|
+
end
|
2164
|
+
s0 << r4
|
2165
|
+
end
|
2166
|
+
end
|
2167
|
+
if s0.last
|
2168
|
+
r0 = instantiate_node(Nodes::Constants::Float,input, i0...index, s0)
|
2169
|
+
r0.extend(Float0)
|
2170
|
+
else
|
2171
|
+
@index = i0
|
2172
|
+
r0 = nil
|
2173
|
+
end
|
2174
|
+
|
2175
|
+
node_cache[:float][start_index] = r0
|
2176
|
+
|
2177
|
+
r0
|
2178
|
+
end
|
2179
|
+
|
2180
|
+
def _nt_integer
|
2181
|
+
start_index = index
|
2182
|
+
if node_cache[:integer].has_key?(index)
|
2183
|
+
cached = node_cache[:integer][index]
|
2184
|
+
if cached
|
2185
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2186
|
+
@index = cached.interval.end
|
2187
|
+
end
|
2188
|
+
return cached
|
2189
|
+
end
|
2190
|
+
|
2191
|
+
s0, i0 = [], index
|
2192
|
+
loop do
|
2193
|
+
r1 = _nt_digit
|
2194
|
+
if r1
|
2195
|
+
s0 << r1
|
2196
|
+
else
|
2197
|
+
break
|
2198
|
+
end
|
2199
|
+
end
|
2200
|
+
if s0.empty?
|
2201
|
+
@index = i0
|
2202
|
+
r0 = nil
|
2203
|
+
else
|
2204
|
+
r0 = instantiate_node(Nodes::Constants::Integer,input, i0...index, s0)
|
2205
|
+
end
|
2206
|
+
|
2207
|
+
node_cache[:integer][start_index] = r0
|
2208
|
+
|
2209
|
+
r0
|
2210
|
+
end
|
2211
|
+
|
2212
|
+
def _nt_digit
|
2213
|
+
start_index = index
|
2214
|
+
if node_cache[:digit].has_key?(index)
|
2215
|
+
cached = node_cache[:digit][index]
|
2216
|
+
if cached
|
2217
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2218
|
+
@index = cached.interval.end
|
2219
|
+
end
|
2220
|
+
return cached
|
2221
|
+
end
|
2222
|
+
|
2223
|
+
if has_terminal?('\G[0-9]', true, index)
|
2224
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2225
|
+
@index += 1
|
2226
|
+
else
|
2227
|
+
r0 = nil
|
2228
|
+
end
|
2229
|
+
|
2230
|
+
node_cache[:digit][start_index] = r0
|
2231
|
+
|
2232
|
+
r0
|
2233
|
+
end
|
2234
|
+
|
2235
|
+
def _nt_reserved_character
|
2236
|
+
start_index = index
|
2237
|
+
if node_cache[:reserved_character].has_key?(index)
|
2238
|
+
cached = node_cache[:reserved_character][index]
|
2239
|
+
if cached
|
2240
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2241
|
+
@index = cached.interval.end
|
2242
|
+
end
|
2243
|
+
return cached
|
2244
|
+
end
|
2245
|
+
|
2246
|
+
if has_terminal?('\G[&|.():!=<>~]', true, index)
|
2247
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2248
|
+
@index += 1
|
2249
|
+
else
|
2250
|
+
r0 = nil
|
2251
|
+
end
|
2252
|
+
|
2253
|
+
node_cache[:reserved_character][start_index] = r0
|
2254
|
+
|
2255
|
+
r0
|
2256
|
+
end
|
2257
|
+
|
2258
|
+
end
|
2259
|
+
|
2260
|
+
class SyntaxParser < Treetop::Runtime::CompiledParser
|
2261
|
+
include Syntax
|
2262
|
+
end
|
2263
|
+
|
2264
|
+
end
|
2265
|
+
end
|
2266
|
+
end
|