personify 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/.rvmrc +1 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/personify/parser/personify.rb +178 -122
- data/lib/personify.rb +1 -1
- data/test/context_test.rb +3 -3
- data/test/parse_runner.rb +1 -2
- data/test/parser_test.rb +3 -3
- metadata +42 -120
- data/vendor/treetop/.gitignore +0 -5
- data/vendor/treetop/History.txt +0 -9
- data/vendor/treetop/README +0 -164
- data/vendor/treetop/Rakefile +0 -20
- data/vendor/treetop/Treetop.tmbundle/Snippets/grammar ___ end.tmSnippet +0 -20
- data/vendor/treetop/Treetop.tmbundle/Snippets/rule ___ end.tmSnippet +0 -18
- data/vendor/treetop/Treetop.tmbundle/Syntaxes/Treetop Grammar.tmLanguage +0 -251
- data/vendor/treetop/Treetop.tmbundle/info.plist +0 -10
- data/vendor/treetop/bin/tt +0 -28
- data/vendor/treetop/doc/contributing_and_planned_features.markdown +0 -103
- data/vendor/treetop/doc/grammar_composition.markdown +0 -65
- data/vendor/treetop/doc/index.markdown +0 -90
- data/vendor/treetop/doc/pitfalls_and_advanced_techniques.markdown +0 -51
- data/vendor/treetop/doc/semantic_interpretation.markdown +0 -189
- data/vendor/treetop/doc/site.rb +0 -110
- data/vendor/treetop/doc/sitegen.rb +0 -60
- data/vendor/treetop/doc/syntactic_recognition.markdown +0 -100
- data/vendor/treetop/doc/using_in_ruby.markdown +0 -21
- data/vendor/treetop/examples/lambda_calculus/arithmetic.rb +0 -551
- data/vendor/treetop/examples/lambda_calculus/arithmetic.treetop +0 -97
- data/vendor/treetop/examples/lambda_calculus/arithmetic_node_classes.rb +0 -7
- data/vendor/treetop/examples/lambda_calculus/arithmetic_test.rb +0 -54
- data/vendor/treetop/examples/lambda_calculus/lambda_calculus +0 -0
- data/vendor/treetop/examples/lambda_calculus/lambda_calculus.rb +0 -718
- data/vendor/treetop/examples/lambda_calculus/lambda_calculus.treetop +0 -132
- data/vendor/treetop/examples/lambda_calculus/lambda_calculus_node_classes.rb +0 -5
- data/vendor/treetop/examples/lambda_calculus/lambda_calculus_test.rb +0 -89
- data/vendor/treetop/examples/lambda_calculus/test_helper.rb +0 -18
- data/vendor/treetop/lib/treetop/bootstrap_gen_1_metagrammar.rb +0 -45
- data/vendor/treetop/lib/treetop/compiler/grammar_compiler.rb +0 -40
- data/vendor/treetop/lib/treetop/compiler/lexical_address_space.rb +0 -17
- data/vendor/treetop/lib/treetop/compiler/metagrammar.rb +0 -2955
- data/vendor/treetop/lib/treetop/compiler/metagrammar.treetop +0 -404
- data/vendor/treetop/lib/treetop/compiler/node_classes/anything_symbol.rb +0 -20
- data/vendor/treetop/lib/treetop/compiler/node_classes/atomic_expression.rb +0 -14
- data/vendor/treetop/lib/treetop/compiler/node_classes/character_class.rb +0 -22
- data/vendor/treetop/lib/treetop/compiler/node_classes/choice.rb +0 -31
- data/vendor/treetop/lib/treetop/compiler/node_classes/declaration_sequence.rb +0 -24
- data/vendor/treetop/lib/treetop/compiler/node_classes/grammar.rb +0 -28
- data/vendor/treetop/lib/treetop/compiler/node_classes/inline_module.rb +0 -27
- data/vendor/treetop/lib/treetop/compiler/node_classes/nonterminal.rb +0 -13
- data/vendor/treetop/lib/treetop/compiler/node_classes/optional.rb +0 -19
- data/vendor/treetop/lib/treetop/compiler/node_classes/parenthesized_expression.rb +0 -9
- data/vendor/treetop/lib/treetop/compiler/node_classes/parsing_expression.rb +0 -138
- data/vendor/treetop/lib/treetop/compiler/node_classes/parsing_rule.rb +0 -55
- data/vendor/treetop/lib/treetop/compiler/node_classes/predicate.rb +0 -45
- data/vendor/treetop/lib/treetop/compiler/node_classes/repetition.rb +0 -55
- data/vendor/treetop/lib/treetop/compiler/node_classes/sequence.rb +0 -68
- data/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb +0 -20
- data/vendor/treetop/lib/treetop/compiler/node_classes/transient_prefix.rb +0 -9
- data/vendor/treetop/lib/treetop/compiler/node_classes/treetop_file.rb +0 -9
- data/vendor/treetop/lib/treetop/compiler/node_classes.rb +0 -19
- data/vendor/treetop/lib/treetop/compiler/ruby_builder.rb +0 -113
- data/vendor/treetop/lib/treetop/compiler.rb +0 -6
- data/vendor/treetop/lib/treetop/ruby_extensions/string.rb +0 -42
- data/vendor/treetop/lib/treetop/ruby_extensions.rb +0 -2
- data/vendor/treetop/lib/treetop/runtime/compiled_parser.rb +0 -95
- data/vendor/treetop/lib/treetop/runtime/interval_skip_list/head_node.rb +0 -15
- data/vendor/treetop/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb +0 -200
- data/vendor/treetop/lib/treetop/runtime/interval_skip_list/node.rb +0 -164
- data/vendor/treetop/lib/treetop/runtime/interval_skip_list.rb +0 -4
- data/vendor/treetop/lib/treetop/runtime/syntax_node.rb +0 -72
- data/vendor/treetop/lib/treetop/runtime/terminal_parse_failure.rb +0 -16
- data/vendor/treetop/lib/treetop/runtime/terminal_syntax_node.rb +0 -17
- data/vendor/treetop/lib/treetop/runtime.rb +0 -5
- data/vendor/treetop/lib/treetop/version.rb +0 -9
- data/vendor/treetop/lib/treetop.rb +0 -11
- data/vendor/treetop/script/generate_metagrammar.rb +0 -14
- data/vendor/treetop/script/svnadd +0 -11
- data/vendor/treetop/script/svnrm +0 -11
- data/vendor/treetop/spec/compiler/and_predicate_spec.rb +0 -36
- data/vendor/treetop/spec/compiler/anything_symbol_spec.rb +0 -52
- data/vendor/treetop/spec/compiler/character_class_spec.rb +0 -188
- data/vendor/treetop/spec/compiler/choice_spec.rb +0 -80
- data/vendor/treetop/spec/compiler/circular_compilation_spec.rb +0 -28
- data/vendor/treetop/spec/compiler/failure_propagation_functional_spec.rb +0 -21
- data/vendor/treetop/spec/compiler/grammar_compiler_spec.rb +0 -84
- data/vendor/treetop/spec/compiler/grammar_spec.rb +0 -41
- data/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb +0 -40
- data/vendor/treetop/spec/compiler/not_predicate_spec.rb +0 -38
- data/vendor/treetop/spec/compiler/one_or_more_spec.rb +0 -35
- data/vendor/treetop/spec/compiler/optional_spec.rb +0 -37
- data/vendor/treetop/spec/compiler/parenthesized_expression_spec.rb +0 -19
- data/vendor/treetop/spec/compiler/parsing_rule_spec.rb +0 -32
- data/vendor/treetop/spec/compiler/sequence_spec.rb +0 -115
- data/vendor/treetop/spec/compiler/terminal_spec.rb +0 -81
- data/vendor/treetop/spec/compiler/terminal_symbol_spec.rb +0 -37
- data/vendor/treetop/spec/compiler/test_grammar.treetop +0 -7
- data/vendor/treetop/spec/compiler/test_grammar.tt +0 -7
- data/vendor/treetop/spec/compiler/test_grammar_do.treetop +0 -7
- data/vendor/treetop/spec/compiler/zero_or_more_spec.rb +0 -56
- data/vendor/treetop/spec/composition/a.treetop +0 -11
- data/vendor/treetop/spec/composition/b.treetop +0 -11
- data/vendor/treetop/spec/composition/c.treetop +0 -10
- data/vendor/treetop/spec/composition/d.treetop +0 -10
- data/vendor/treetop/spec/composition/grammar_composition_spec.rb +0 -26
- data/vendor/treetop/spec/ruby_extensions/string_spec.rb +0 -32
- data/vendor/treetop/spec/runtime/compiled_parser_spec.rb +0 -101
- data/vendor/treetop/spec/runtime/interval_skip_list/delete_spec.rb +0 -147
- data/vendor/treetop/spec/runtime/interval_skip_list/expire_range_spec.rb +0 -349
- data/vendor/treetop/spec/runtime/interval_skip_list/insert_and_delete_node.rb +0 -385
- data/vendor/treetop/spec/runtime/interval_skip_list/insert_spec.rb +0 -660
- data/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle +0 -6175
- data/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.rb +0 -58
- data/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture.rb +0 -23
- data/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb +0 -164
- data/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb +0 -84
- data/vendor/treetop/spec/runtime/syntax_node_spec.rb +0 -53
- data/vendor/treetop/spec/spec_helper.rb +0 -106
- data/vendor/treetop/spec/spec_suite.rb +0 -4
- data/vendor/treetop/treetop.gemspec +0 -18
@@ -1,15 +1,21 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
1
4
|
module PersonifyLanguage
|
2
5
|
include Treetop::Runtime
|
3
6
|
|
4
7
|
def root
|
5
|
-
@root
|
8
|
+
@root ||= :template
|
6
9
|
end
|
7
10
|
|
8
11
|
def _nt_template
|
9
12
|
start_index = index
|
10
13
|
if node_cache[:template].has_key?(index)
|
11
14
|
cached = node_cache[:template][index]
|
12
|
-
|
15
|
+
if cached
|
16
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
17
|
+
@index = cached.interval.end
|
18
|
+
end
|
13
19
|
return cached
|
14
20
|
end
|
15
21
|
|
@@ -26,14 +32,17 @@ module PersonifyLanguage
|
|
26
32
|
|
27
33
|
node_cache[:template][start_index] = r0
|
28
34
|
|
29
|
-
|
35
|
+
r0
|
30
36
|
end
|
31
37
|
|
32
38
|
def _nt_parts_including_tail
|
33
39
|
start_index = index
|
34
40
|
if node_cache[:parts_including_tail].has_key?(index)
|
35
41
|
cached = node_cache[:parts_including_tail][index]
|
36
|
-
|
42
|
+
if cached
|
43
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
44
|
+
@index = cached.interval.end
|
45
|
+
end
|
37
46
|
return cached
|
38
47
|
end
|
39
48
|
|
@@ -46,21 +55,24 @@ module PersonifyLanguage
|
|
46
55
|
if r2
|
47
56
|
r0 = r2
|
48
57
|
else
|
49
|
-
|
58
|
+
@index = i0
|
50
59
|
r0 = nil
|
51
60
|
end
|
52
61
|
end
|
53
62
|
|
54
63
|
node_cache[:parts_including_tail][start_index] = r0
|
55
64
|
|
56
|
-
|
65
|
+
r0
|
57
66
|
end
|
58
67
|
|
59
68
|
def _nt_part
|
60
69
|
start_index = index
|
61
70
|
if node_cache[:part].has_key?(index)
|
62
71
|
cached = node_cache[:part][index]
|
63
|
-
|
72
|
+
if cached
|
73
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
74
|
+
@index = cached.interval.end
|
75
|
+
end
|
64
76
|
return cached
|
65
77
|
end
|
66
78
|
|
@@ -73,14 +85,14 @@ module PersonifyLanguage
|
|
73
85
|
if r2
|
74
86
|
r0 = r2
|
75
87
|
else
|
76
|
-
|
88
|
+
@index = i0
|
77
89
|
r0 = nil
|
78
90
|
end
|
79
91
|
end
|
80
92
|
|
81
93
|
node_cache[:part][start_index] = r0
|
82
94
|
|
83
|
-
|
95
|
+
r0
|
84
96
|
end
|
85
97
|
|
86
98
|
module TailPart0
|
@@ -93,12 +105,15 @@ module PersonifyLanguage
|
|
93
105
|
start_index = index
|
94
106
|
if node_cache[:tail_part].has_key?(index)
|
95
107
|
cached = node_cache[:tail_part][index]
|
96
|
-
|
108
|
+
if cached
|
109
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
110
|
+
@index = cached.interval.end
|
111
|
+
end
|
97
112
|
return cached
|
98
113
|
end
|
99
114
|
|
100
115
|
i0, s0 = index, []
|
101
|
-
if
|
116
|
+
if has_terminal?('[', false, index)
|
102
117
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
103
118
|
@index += 1
|
104
119
|
else
|
@@ -114,17 +129,17 @@ module PersonifyLanguage
|
|
114
129
|
r0 = instantiate_node(TailPart,input, i0...index, s0)
|
115
130
|
r0.extend(TailPart0)
|
116
131
|
else
|
117
|
-
|
132
|
+
@index = i0
|
118
133
|
r0 = nil
|
119
134
|
end
|
120
135
|
|
121
136
|
node_cache[:tail_part][start_index] = r0
|
122
137
|
|
123
|
-
|
138
|
+
r0
|
124
139
|
end
|
125
140
|
|
126
141
|
module Substitutable0
|
127
|
-
def
|
142
|
+
def space1
|
128
143
|
elements[1]
|
129
144
|
end
|
130
145
|
|
@@ -132,7 +147,7 @@ module PersonifyLanguage
|
|
132
147
|
elements[2]
|
133
148
|
end
|
134
149
|
|
135
|
-
def
|
150
|
+
def space2
|
136
151
|
elements[3]
|
137
152
|
end
|
138
153
|
|
@@ -142,12 +157,15 @@ module PersonifyLanguage
|
|
142
157
|
start_index = index
|
143
158
|
if node_cache[:substitutable].has_key?(index)
|
144
159
|
cached = node_cache[:substitutable][index]
|
145
|
-
|
160
|
+
if cached
|
161
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
162
|
+
@index = cached.interval.end
|
163
|
+
end
|
146
164
|
return cached
|
147
165
|
end
|
148
166
|
|
149
167
|
i0, s0 = index, []
|
150
|
-
if
|
168
|
+
if has_terminal?('[', false, index)
|
151
169
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
152
170
|
@index += 1
|
153
171
|
else
|
@@ -165,7 +183,7 @@ module PersonifyLanguage
|
|
165
183
|
r4 = _nt_space
|
166
184
|
s0 << r4
|
167
185
|
if r4
|
168
|
-
if
|
186
|
+
if has_terminal?(']', false, index)
|
169
187
|
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
170
188
|
@index += 1
|
171
189
|
else
|
@@ -181,17 +199,17 @@ module PersonifyLanguage
|
|
181
199
|
r0 = instantiate_node(Substitutable,input, i0...index, s0)
|
182
200
|
r0.extend(Substitutable0)
|
183
201
|
else
|
184
|
-
|
202
|
+
@index = i0
|
185
203
|
r0 = nil
|
186
204
|
end
|
187
205
|
|
188
206
|
node_cache[:substitutable][start_index] = r0
|
189
207
|
|
190
|
-
|
208
|
+
r0
|
191
209
|
end
|
192
210
|
|
193
211
|
module Block0
|
194
|
-
def
|
212
|
+
def space1
|
195
213
|
elements[1]
|
196
214
|
end
|
197
215
|
|
@@ -199,7 +217,7 @@ module PersonifyLanguage
|
|
199
217
|
elements[3]
|
200
218
|
end
|
201
219
|
|
202
|
-
def
|
220
|
+
def space2
|
203
221
|
elements[5]
|
204
222
|
end
|
205
223
|
|
@@ -209,12 +227,15 @@ module PersonifyLanguage
|
|
209
227
|
start_index = index
|
210
228
|
if node_cache[:block].has_key?(index)
|
211
229
|
cached = node_cache[:block][index]
|
212
|
-
|
230
|
+
if cached
|
231
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
232
|
+
@index = cached.interval.end
|
233
|
+
end
|
213
234
|
return cached
|
214
235
|
end
|
215
236
|
|
216
237
|
i0, s0 = index, []
|
217
|
-
if
|
238
|
+
if has_terminal?('DO', false, index)
|
218
239
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
219
240
|
@index += 2
|
220
241
|
else
|
@@ -226,7 +247,7 @@ module PersonifyLanguage
|
|
226
247
|
r2 = _nt_space
|
227
248
|
s0 << r2
|
228
249
|
if r2
|
229
|
-
if
|
250
|
+
if has_terminal?(']', false, index)
|
230
251
|
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
231
252
|
@index += 1
|
232
253
|
else
|
@@ -238,7 +259,7 @@ module PersonifyLanguage
|
|
238
259
|
r4 = _nt_block_content
|
239
260
|
s0 << r4
|
240
261
|
if r4
|
241
|
-
if
|
262
|
+
if has_terminal?('[', false, index)
|
242
263
|
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
243
264
|
@index += 1
|
244
265
|
else
|
@@ -250,7 +271,7 @@ module PersonifyLanguage
|
|
250
271
|
r6 = _nt_space
|
251
272
|
s0 << r6
|
252
273
|
if r6
|
253
|
-
if
|
274
|
+
if has_terminal?('END', false, index)
|
254
275
|
r7 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
255
276
|
@index += 3
|
256
277
|
else
|
@@ -268,20 +289,23 @@ module PersonifyLanguage
|
|
268
289
|
r0 = instantiate_node(Block,input, i0...index, s0)
|
269
290
|
r0.extend(Block0)
|
270
291
|
else
|
271
|
-
|
292
|
+
@index = i0
|
272
293
|
r0 = nil
|
273
294
|
end
|
274
295
|
|
275
296
|
node_cache[:block][start_index] = r0
|
276
297
|
|
277
|
-
|
298
|
+
r0
|
278
299
|
end
|
279
300
|
|
280
301
|
def _nt_block_content
|
281
302
|
start_index = index
|
282
303
|
if node_cache[:block_content].has_key?(index)
|
283
304
|
cached = node_cache[:block_content][index]
|
284
|
-
|
305
|
+
if cached
|
306
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
307
|
+
@index = cached.interval.end
|
308
|
+
end
|
285
309
|
return cached
|
286
310
|
end
|
287
311
|
|
@@ -298,15 +322,15 @@ module PersonifyLanguage
|
|
298
322
|
|
299
323
|
node_cache[:block_content][start_index] = r0
|
300
324
|
|
301
|
-
|
325
|
+
r0
|
302
326
|
end
|
303
327
|
|
304
328
|
module Expressions0
|
305
|
-
def
|
329
|
+
def space1
|
306
330
|
elements[0]
|
307
331
|
end
|
308
332
|
|
309
|
-
def
|
333
|
+
def space2
|
310
334
|
elements[2]
|
311
335
|
end
|
312
336
|
|
@@ -329,7 +353,10 @@ module PersonifyLanguage
|
|
329
353
|
start_index = index
|
330
354
|
if node_cache[:expressions].has_key?(index)
|
331
355
|
cached = node_cache[:expressions][index]
|
332
|
-
|
356
|
+
if cached
|
357
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
358
|
+
@index = cached.interval.end
|
359
|
+
end
|
333
360
|
return cached
|
334
361
|
end
|
335
362
|
|
@@ -343,7 +370,7 @@ module PersonifyLanguage
|
|
343
370
|
r4 = _nt_space
|
344
371
|
s3 << r4
|
345
372
|
if r4
|
346
|
-
if
|
373
|
+
if has_terminal?("|", false, index)
|
347
374
|
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
348
375
|
@index += 1
|
349
376
|
else
|
@@ -364,7 +391,7 @@ module PersonifyLanguage
|
|
364
391
|
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
365
392
|
r3.extend(Expressions0)
|
366
393
|
else
|
367
|
-
|
394
|
+
@index = i3
|
368
395
|
r3 = nil
|
369
396
|
end
|
370
397
|
if r3
|
@@ -380,20 +407,23 @@ module PersonifyLanguage
|
|
380
407
|
r0 = instantiate_node(Expressions,input, i0...index, s0)
|
381
408
|
r0.extend(Expressions1)
|
382
409
|
else
|
383
|
-
|
410
|
+
@index = i0
|
384
411
|
r0 = nil
|
385
412
|
end
|
386
413
|
|
387
414
|
node_cache[:expressions][start_index] = r0
|
388
415
|
|
389
|
-
|
416
|
+
r0
|
390
417
|
end
|
391
418
|
|
392
419
|
def _nt_expression
|
393
420
|
start_index = index
|
394
421
|
if node_cache[:expression].has_key?(index)
|
395
422
|
cached = node_cache[:expression][index]
|
396
|
-
|
423
|
+
if cached
|
424
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
425
|
+
@index = cached.interval.end
|
426
|
+
end
|
397
427
|
return cached
|
398
428
|
end
|
399
429
|
|
@@ -414,7 +444,7 @@ module PersonifyLanguage
|
|
414
444
|
if r4
|
415
445
|
r0 = r4
|
416
446
|
else
|
417
|
-
|
447
|
+
@index = i0
|
418
448
|
r0 = nil
|
419
449
|
end
|
420
450
|
end
|
@@ -423,14 +453,17 @@ module PersonifyLanguage
|
|
423
453
|
|
424
454
|
node_cache[:expression][start_index] = r0
|
425
455
|
|
426
|
-
|
456
|
+
r0
|
427
457
|
end
|
428
458
|
|
429
459
|
def _nt_expression_or_string
|
430
460
|
start_index = index
|
431
461
|
if node_cache[:expression_or_string].has_key?(index)
|
432
462
|
cached = node_cache[:expression_or_string][index]
|
433
|
-
|
463
|
+
if cached
|
464
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
465
|
+
@index = cached.interval.end
|
466
|
+
end
|
434
467
|
return cached
|
435
468
|
end
|
436
469
|
|
@@ -443,14 +476,14 @@ module PersonifyLanguage
|
|
443
476
|
if r2
|
444
477
|
r0 = r2
|
445
478
|
else
|
446
|
-
|
479
|
+
@index = i0
|
447
480
|
r0 = nil
|
448
481
|
end
|
449
482
|
end
|
450
483
|
|
451
484
|
node_cache[:expression_or_string][start_index] = r0
|
452
485
|
|
453
|
-
|
486
|
+
r0
|
454
487
|
end
|
455
488
|
|
456
489
|
module Function0
|
@@ -458,11 +491,11 @@ module PersonifyLanguage
|
|
458
491
|
elements[0]
|
459
492
|
end
|
460
493
|
|
461
|
-
def
|
494
|
+
def space1
|
462
495
|
elements[1]
|
463
496
|
end
|
464
497
|
|
465
|
-
def
|
498
|
+
def space2
|
466
499
|
elements[3]
|
467
500
|
end
|
468
501
|
|
@@ -470,11 +503,11 @@ module PersonifyLanguage
|
|
470
503
|
elements[4]
|
471
504
|
end
|
472
505
|
|
473
|
-
def
|
506
|
+
def space3
|
474
507
|
elements[5]
|
475
508
|
end
|
476
509
|
|
477
|
-
def
|
510
|
+
def space4
|
478
511
|
elements[7]
|
479
512
|
end
|
480
513
|
|
@@ -487,7 +520,10 @@ module PersonifyLanguage
|
|
487
520
|
start_index = index
|
488
521
|
if node_cache[:function].has_key?(index)
|
489
522
|
cached = node_cache[:function][index]
|
490
|
-
|
523
|
+
if cached
|
524
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
525
|
+
@index = cached.interval.end
|
526
|
+
end
|
491
527
|
return cached
|
492
528
|
end
|
493
529
|
|
@@ -498,7 +534,7 @@ module PersonifyLanguage
|
|
498
534
|
r2 = _nt_space
|
499
535
|
s0 << r2
|
500
536
|
if r2
|
501
|
-
if
|
537
|
+
if has_terminal?("(", false, index)
|
502
538
|
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
503
539
|
@index += 1
|
504
540
|
else
|
@@ -516,7 +552,7 @@ module PersonifyLanguage
|
|
516
552
|
r6 = _nt_space
|
517
553
|
s0 << r6
|
518
554
|
if r6
|
519
|
-
if
|
555
|
+
if has_terminal?(")", false, index)
|
520
556
|
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
521
557
|
@index += 1
|
522
558
|
else
|
@@ -547,21 +583,21 @@ module PersonifyLanguage
|
|
547
583
|
r0 = instantiate_node(Function,input, i0...index, s0)
|
548
584
|
r0.extend(Function0)
|
549
585
|
else
|
550
|
-
|
586
|
+
@index = i0
|
551
587
|
r0 = nil
|
552
588
|
end
|
553
589
|
|
554
590
|
node_cache[:function][start_index] = r0
|
555
591
|
|
556
|
-
|
592
|
+
r0
|
557
593
|
end
|
558
594
|
|
559
595
|
module Parameters0
|
560
|
-
def
|
596
|
+
def space1
|
561
597
|
elements[0]
|
562
598
|
end
|
563
599
|
|
564
|
-
def
|
600
|
+
def space2
|
565
601
|
elements[2]
|
566
602
|
end
|
567
603
|
|
@@ -584,7 +620,10 @@ module PersonifyLanguage
|
|
584
620
|
start_index = index
|
585
621
|
if node_cache[:parameters].has_key?(index)
|
586
622
|
cached = node_cache[:parameters][index]
|
587
|
-
|
623
|
+
if cached
|
624
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
625
|
+
@index = cached.interval.end
|
626
|
+
end
|
588
627
|
return cached
|
589
628
|
end
|
590
629
|
|
@@ -603,7 +642,7 @@ module PersonifyLanguage
|
|
603
642
|
r5 = _nt_space
|
604
643
|
s4 << r5
|
605
644
|
if r5
|
606
|
-
if
|
645
|
+
if has_terminal?(",", false, index)
|
607
646
|
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
608
647
|
@index += 1
|
609
648
|
else
|
@@ -624,7 +663,7 @@ module PersonifyLanguage
|
|
624
663
|
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
625
664
|
r4.extend(Parameters0)
|
626
665
|
else
|
627
|
-
|
666
|
+
@index = i4
|
628
667
|
r4 = nil
|
629
668
|
end
|
630
669
|
if r4
|
@@ -640,13 +679,13 @@ module PersonifyLanguage
|
|
640
679
|
r0 = instantiate_node(Parameter,input, i0...index, s0)
|
641
680
|
r0.extend(Parameters1)
|
642
681
|
else
|
643
|
-
|
682
|
+
@index = i0
|
644
683
|
r0 = nil
|
645
684
|
end
|
646
685
|
|
647
686
|
node_cache[:parameters][start_index] = r0
|
648
687
|
|
649
|
-
|
688
|
+
r0
|
650
689
|
end
|
651
690
|
|
652
691
|
module Logical0
|
@@ -654,7 +693,7 @@ module PersonifyLanguage
|
|
654
693
|
elements[0]
|
655
694
|
end
|
656
695
|
|
657
|
-
def
|
696
|
+
def space1
|
658
697
|
elements[1]
|
659
698
|
end
|
660
699
|
|
@@ -662,7 +701,7 @@ module PersonifyLanguage
|
|
662
701
|
elements[2]
|
663
702
|
end
|
664
703
|
|
665
|
-
def
|
704
|
+
def space2
|
666
705
|
elements[3]
|
667
706
|
end
|
668
707
|
|
@@ -675,7 +714,10 @@ module PersonifyLanguage
|
|
675
714
|
start_index = index
|
676
715
|
if node_cache[:logical].has_key?(index)
|
677
716
|
cached = node_cache[:logical][index]
|
678
|
-
|
717
|
+
if cached
|
718
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
719
|
+
@index = cached.interval.end
|
720
|
+
end
|
679
721
|
return cached
|
680
722
|
end
|
681
723
|
|
@@ -693,7 +735,7 @@ module PersonifyLanguage
|
|
693
735
|
if r4
|
694
736
|
r1 = r4
|
695
737
|
else
|
696
|
-
|
738
|
+
@index = i1
|
697
739
|
r1 = nil
|
698
740
|
end
|
699
741
|
end
|
@@ -704,7 +746,7 @@ module PersonifyLanguage
|
|
704
746
|
s0 << r5
|
705
747
|
if r5
|
706
748
|
i6 = index
|
707
|
-
if
|
749
|
+
if has_terminal?("||", false, index)
|
708
750
|
r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
709
751
|
@index += 2
|
710
752
|
else
|
@@ -714,7 +756,7 @@ module PersonifyLanguage
|
|
714
756
|
if r7
|
715
757
|
r6 = r7
|
716
758
|
else
|
717
|
-
if
|
759
|
+
if has_terminal?("&&", false, index)
|
718
760
|
r8 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
719
761
|
@index += 2
|
720
762
|
else
|
@@ -724,7 +766,7 @@ module PersonifyLanguage
|
|
724
766
|
if r8
|
725
767
|
r6 = r8
|
726
768
|
else
|
727
|
-
|
769
|
+
@index = i6
|
728
770
|
r6 = nil
|
729
771
|
end
|
730
772
|
end
|
@@ -743,13 +785,13 @@ module PersonifyLanguage
|
|
743
785
|
r0 = instantiate_node(Logical,input, i0...index, s0)
|
744
786
|
r0.extend(Logical0)
|
745
787
|
else
|
746
|
-
|
788
|
+
@index = i0
|
747
789
|
r0 = nil
|
748
790
|
end
|
749
791
|
|
750
792
|
node_cache[:logical][start_index] = r0
|
751
793
|
|
752
|
-
|
794
|
+
r0
|
753
795
|
end
|
754
796
|
|
755
797
|
module Key0
|
@@ -762,7 +804,10 @@ module PersonifyLanguage
|
|
762
804
|
start_index = index
|
763
805
|
if node_cache[:key].has_key?(index)
|
764
806
|
cached = node_cache[:key][index]
|
765
|
-
|
807
|
+
if cached
|
808
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
809
|
+
@index = cached.interval.end
|
810
|
+
end
|
766
811
|
return cached
|
767
812
|
end
|
768
813
|
|
@@ -772,16 +817,15 @@ module PersonifyLanguage
|
|
772
817
|
if r2
|
773
818
|
r1 = nil
|
774
819
|
else
|
775
|
-
|
820
|
+
@index = i1
|
776
821
|
r1 = instantiate_node(SyntaxNode,input, index...index)
|
777
822
|
end
|
778
823
|
s0 << r1
|
779
824
|
if r1
|
780
825
|
i3, s3 = index, []
|
781
|
-
if
|
782
|
-
|
783
|
-
|
784
|
-
@index = next_character
|
826
|
+
if has_terminal?('\G[A-Z0-9]', true, index)
|
827
|
+
r4 = true
|
828
|
+
@index += 1
|
785
829
|
else
|
786
830
|
r4 = nil
|
787
831
|
end
|
@@ -789,10 +833,9 @@ module PersonifyLanguage
|
|
789
833
|
if r4
|
790
834
|
s5, i5 = [], index
|
791
835
|
loop do
|
792
|
-
if
|
793
|
-
|
794
|
-
|
795
|
-
@index = next_character
|
836
|
+
if has_terminal?('\G[A-Z0-9._]', true, index)
|
837
|
+
r6 = true
|
838
|
+
@index += 1
|
796
839
|
else
|
797
840
|
r6 = nil
|
798
841
|
end
|
@@ -809,7 +852,7 @@ module PersonifyLanguage
|
|
809
852
|
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
810
853
|
r3.extend(Key0)
|
811
854
|
else
|
812
|
-
|
855
|
+
@index = i3
|
813
856
|
r3 = nil
|
814
857
|
end
|
815
858
|
s0 << r3
|
@@ -818,25 +861,28 @@ module PersonifyLanguage
|
|
818
861
|
r0 = instantiate_node(Key,input, i0...index, s0)
|
819
862
|
r0.extend(Key1)
|
820
863
|
else
|
821
|
-
|
864
|
+
@index = i0
|
822
865
|
r0 = nil
|
823
866
|
end
|
824
867
|
|
825
868
|
node_cache[:key][start_index] = r0
|
826
869
|
|
827
|
-
|
870
|
+
r0
|
828
871
|
end
|
829
872
|
|
830
873
|
def _nt_reserved
|
831
874
|
start_index = index
|
832
875
|
if node_cache[:reserved].has_key?(index)
|
833
876
|
cached = node_cache[:reserved][index]
|
834
|
-
|
877
|
+
if cached
|
878
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
879
|
+
@index = cached.interval.end
|
880
|
+
end
|
835
881
|
return cached
|
836
882
|
end
|
837
883
|
|
838
884
|
i0 = index
|
839
|
-
if
|
885
|
+
if has_terminal?("END", false, index)
|
840
886
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
841
887
|
@index += 3
|
842
888
|
else
|
@@ -846,7 +892,7 @@ module PersonifyLanguage
|
|
846
892
|
if r1
|
847
893
|
r0 = r1
|
848
894
|
else
|
849
|
-
if
|
895
|
+
if has_terminal?("DO", false, index)
|
850
896
|
r2 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
851
897
|
@index += 2
|
852
898
|
else
|
@@ -856,14 +902,14 @@ module PersonifyLanguage
|
|
856
902
|
if r2
|
857
903
|
r0 = r2
|
858
904
|
else
|
859
|
-
|
905
|
+
@index = i0
|
860
906
|
r0 = nil
|
861
907
|
end
|
862
908
|
end
|
863
909
|
|
864
910
|
node_cache[:reserved][start_index] = r0
|
865
911
|
|
866
|
-
|
912
|
+
r0
|
867
913
|
end
|
868
914
|
|
869
915
|
module String0
|
@@ -877,12 +923,15 @@ module PersonifyLanguage
|
|
877
923
|
start_index = index
|
878
924
|
if node_cache[:string].has_key?(index)
|
879
925
|
cached = node_cache[:string][index]
|
880
|
-
|
926
|
+
if cached
|
927
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
928
|
+
@index = cached.interval.end
|
929
|
+
end
|
881
930
|
return cached
|
882
931
|
end
|
883
932
|
|
884
933
|
i0, s0 = index, []
|
885
|
-
if
|
934
|
+
if has_terminal?('"', false, index)
|
886
935
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
887
936
|
@index += 1
|
888
937
|
else
|
@@ -894,7 +943,7 @@ module PersonifyLanguage
|
|
894
943
|
r2 = _nt_string_value
|
895
944
|
s0 << r2
|
896
945
|
if r2
|
897
|
-
if
|
946
|
+
if has_terminal?('"', false, index)
|
898
947
|
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
899
948
|
@index += 1
|
900
949
|
else
|
@@ -908,29 +957,31 @@ module PersonifyLanguage
|
|
908
957
|
r0 = instantiate_node(PString,input, i0...index, s0)
|
909
958
|
r0.extend(String0)
|
910
959
|
else
|
911
|
-
|
960
|
+
@index = i0
|
912
961
|
r0 = nil
|
913
962
|
end
|
914
963
|
|
915
964
|
node_cache[:string][start_index] = r0
|
916
965
|
|
917
|
-
|
966
|
+
r0
|
918
967
|
end
|
919
968
|
|
920
969
|
def _nt_implicit_string
|
921
970
|
start_index = index
|
922
971
|
if node_cache[:implicit_string].has_key?(index)
|
923
972
|
cached = node_cache[:implicit_string][index]
|
924
|
-
|
973
|
+
if cached
|
974
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
975
|
+
@index = cached.interval.end
|
976
|
+
end
|
925
977
|
return cached
|
926
978
|
end
|
927
979
|
|
928
980
|
s0, i0 = [], index
|
929
981
|
loop do
|
930
|
-
if
|
931
|
-
|
932
|
-
|
933
|
-
@index = next_character
|
982
|
+
if has_terminal?('\G[^|\\],)]', true, index)
|
983
|
+
r1 = true
|
984
|
+
@index += 1
|
934
985
|
else
|
935
986
|
r1 = nil
|
936
987
|
end
|
@@ -941,7 +992,7 @@ module PersonifyLanguage
|
|
941
992
|
end
|
942
993
|
end
|
943
994
|
if s0.empty?
|
944
|
-
|
995
|
+
@index = i0
|
945
996
|
r0 = nil
|
946
997
|
else
|
947
998
|
r0 = instantiate_node(Literal,input, i0...index, s0)
|
@@ -949,23 +1000,25 @@ module PersonifyLanguage
|
|
949
1000
|
|
950
1001
|
node_cache[:implicit_string][start_index] = r0
|
951
1002
|
|
952
|
-
|
1003
|
+
r0
|
953
1004
|
end
|
954
1005
|
|
955
1006
|
def _nt_string_value
|
956
1007
|
start_index = index
|
957
1008
|
if node_cache[:string_value].has_key?(index)
|
958
1009
|
cached = node_cache[:string_value][index]
|
959
|
-
|
1010
|
+
if cached
|
1011
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1012
|
+
@index = cached.interval.end
|
1013
|
+
end
|
960
1014
|
return cached
|
961
1015
|
end
|
962
1016
|
|
963
1017
|
s0, i0 = [], index
|
964
1018
|
loop do
|
965
|
-
if
|
966
|
-
|
967
|
-
|
968
|
-
@index = next_character
|
1019
|
+
if has_terminal?('\G[^"]', true, index)
|
1020
|
+
r1 = true
|
1021
|
+
@index += 1
|
969
1022
|
else
|
970
1023
|
r1 = nil
|
971
1024
|
end
|
@@ -979,7 +1032,7 @@ module PersonifyLanguage
|
|
979
1032
|
|
980
1033
|
node_cache[:string_value][start_index] = r0
|
981
1034
|
|
982
|
-
|
1035
|
+
r0
|
983
1036
|
end
|
984
1037
|
|
985
1038
|
module Text0
|
@@ -989,15 +1042,17 @@ module PersonifyLanguage
|
|
989
1042
|
start_index = index
|
990
1043
|
if node_cache[:text].has_key?(index)
|
991
1044
|
cached = node_cache[:text][index]
|
992
|
-
|
1045
|
+
if cached
|
1046
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1047
|
+
@index = cached.interval.end
|
1048
|
+
end
|
993
1049
|
return cached
|
994
1050
|
end
|
995
1051
|
|
996
1052
|
i0, s0 = index, []
|
997
|
-
if
|
998
|
-
|
999
|
-
|
1000
|
-
@index = next_character
|
1053
|
+
if has_terminal?('\G[^\\[]', true, index)
|
1054
|
+
r1 = true
|
1055
|
+
@index += 1
|
1001
1056
|
else
|
1002
1057
|
r1 = nil
|
1003
1058
|
end
|
@@ -1005,10 +1060,9 @@ module PersonifyLanguage
|
|
1005
1060
|
if r1
|
1006
1061
|
s2, i2 = [], index
|
1007
1062
|
loop do
|
1008
|
-
if
|
1009
|
-
|
1010
|
-
|
1011
|
-
@index = next_character
|
1063
|
+
if has_terminal?('\G[^\\[]', true, index)
|
1064
|
+
r3 = true
|
1065
|
+
@index += 1
|
1012
1066
|
else
|
1013
1067
|
r3 = nil
|
1014
1068
|
end
|
@@ -1025,29 +1079,31 @@ module PersonifyLanguage
|
|
1025
1079
|
r0 = instantiate_node(Literal,input, i0...index, s0)
|
1026
1080
|
r0.extend(Text0)
|
1027
1081
|
else
|
1028
|
-
|
1082
|
+
@index = i0
|
1029
1083
|
r0 = nil
|
1030
1084
|
end
|
1031
1085
|
|
1032
1086
|
node_cache[:text][start_index] = r0
|
1033
1087
|
|
1034
|
-
|
1088
|
+
r0
|
1035
1089
|
end
|
1036
1090
|
|
1037
1091
|
def _nt_space
|
1038
1092
|
start_index = index
|
1039
1093
|
if node_cache[:space].has_key?(index)
|
1040
1094
|
cached = node_cache[:space][index]
|
1041
|
-
|
1095
|
+
if cached
|
1096
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1097
|
+
@index = cached.interval.end
|
1098
|
+
end
|
1042
1099
|
return cached
|
1043
1100
|
end
|
1044
1101
|
|
1045
1102
|
s0, i0 = [], index
|
1046
1103
|
loop do
|
1047
|
-
if
|
1048
|
-
|
1049
|
-
|
1050
|
-
@index = next_character
|
1104
|
+
if has_terminal?('\G[ \\n]', true, index)
|
1105
|
+
r1 = true
|
1106
|
+
@index += 1
|
1051
1107
|
else
|
1052
1108
|
r1 = nil
|
1053
1109
|
end
|
@@ -1061,7 +1117,7 @@ module PersonifyLanguage
|
|
1061
1117
|
|
1062
1118
|
node_cache[:space][start_index] = r0
|
1063
1119
|
|
1064
|
-
|
1120
|
+
r0
|
1065
1121
|
end
|
1066
1122
|
|
1067
1123
|
end
|