weskit 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +25 -10
- data/Rakefile +8 -1
- data/lib/weskit/version.rb +1 -1
- data/lib/weskit/wml.rb +1 -1
- data/lib/weskit/wml/attribute.rb +0 -4
- data/lib/weskit/wml/grammars/wml.kpeg +91 -0
- data/lib/weskit/wml/kpeg_parser.rb +1521 -0
- data/lib/weskit/wml/parser.rb +6 -13
- data/spec/wml/parser_spec.rb +16 -7
- data/weskit.gemspec +4 -6
- metadata +93 -111
- data/lib/weskit/wml/grammars/wml.treetop +0 -195
- data/lib/weskit/wml/wml.rb +0 -1580
data/lib/weskit/wml/wml.rb
DELETED
@@ -1,1580 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
|
3
|
-
# Autogenerated from a Treetop grammar. Edits may be lost.
|
4
|
-
|
5
|
-
require 'treetop'
|
6
|
-
require 'weskit/wml'
|
7
|
-
|
8
|
-
module WesnothMarkupLanguage
|
9
|
-
include Treetop::Runtime
|
10
|
-
|
11
|
-
def root
|
12
|
-
@root ||= :document
|
13
|
-
end
|
14
|
-
|
15
|
-
module Document0
|
16
|
-
def wml
|
17
|
-
::Weskit::WML::Root.new.push *::Weskit::WML::Mixins::Grammar.reject_non_wml(elements)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def _nt_document
|
22
|
-
start_index = index
|
23
|
-
if node_cache[:document].has_key?(index)
|
24
|
-
cached = node_cache[:document][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
|
-
r0 = _nt_contents
|
33
|
-
r0.extend(Document0)
|
34
|
-
|
35
|
-
node_cache[:document][start_index] = r0
|
36
|
-
|
37
|
-
r0
|
38
|
-
end
|
39
|
-
|
40
|
-
module Identifier0
|
41
|
-
end
|
42
|
-
|
43
|
-
module Identifier1
|
44
|
-
def name
|
45
|
-
text_value
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def _nt_identifier
|
50
|
-
start_index = index
|
51
|
-
if node_cache[:identifier].has_key?(index)
|
52
|
-
cached = node_cache[:identifier][index]
|
53
|
-
if cached
|
54
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
55
|
-
@index = cached.interval.end
|
56
|
-
end
|
57
|
-
return cached
|
58
|
-
end
|
59
|
-
|
60
|
-
i0, s0 = index, []
|
61
|
-
if has_terminal?('\G[a-z]', true, index)
|
62
|
-
r1 = true
|
63
|
-
@index += 1
|
64
|
-
else
|
65
|
-
r1 = nil
|
66
|
-
end
|
67
|
-
s0 << r1
|
68
|
-
if r1
|
69
|
-
s2, i2 = [], index
|
70
|
-
loop do
|
71
|
-
if has_terminal?('\G[a-z_]', true, index)
|
72
|
-
r3 = true
|
73
|
-
@index += 1
|
74
|
-
else
|
75
|
-
r3 = nil
|
76
|
-
end
|
77
|
-
if r3
|
78
|
-
s2 << r3
|
79
|
-
else
|
80
|
-
break
|
81
|
-
end
|
82
|
-
end
|
83
|
-
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
84
|
-
s0 << r2
|
85
|
-
end
|
86
|
-
if s0.last
|
87
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
88
|
-
r0.extend(Identifier0)
|
89
|
-
r0.extend(Identifier1)
|
90
|
-
else
|
91
|
-
@index = i0
|
92
|
-
r0 = nil
|
93
|
-
end
|
94
|
-
|
95
|
-
node_cache[:identifier][start_index] = r0
|
96
|
-
|
97
|
-
r0
|
98
|
-
end
|
99
|
-
|
100
|
-
module RawString0
|
101
|
-
end
|
102
|
-
|
103
|
-
module RawString1
|
104
|
-
def data
|
105
|
-
text_value
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def _nt_raw_string
|
110
|
-
start_index = index
|
111
|
-
if node_cache[:raw_string].has_key?(index)
|
112
|
-
cached = node_cache[:raw_string][index]
|
113
|
-
if cached
|
114
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
115
|
-
@index = cached.interval.end
|
116
|
-
end
|
117
|
-
return cached
|
118
|
-
end
|
119
|
-
|
120
|
-
s0, i0 = [], index
|
121
|
-
loop do
|
122
|
-
i1, s1 = index, []
|
123
|
-
i2 = index
|
124
|
-
r3 = _nt_eol
|
125
|
-
if r3
|
126
|
-
r2 = nil
|
127
|
-
else
|
128
|
-
@index = i2
|
129
|
-
r2 = instantiate_node(SyntaxNode,input, index...index)
|
130
|
-
end
|
131
|
-
s1 << r2
|
132
|
-
if r2
|
133
|
-
if index < input_length
|
134
|
-
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
135
|
-
@index += 1
|
136
|
-
else
|
137
|
-
terminal_parse_failure("any character")
|
138
|
-
r4 = nil
|
139
|
-
end
|
140
|
-
s1 << r4
|
141
|
-
end
|
142
|
-
if s1.last
|
143
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
144
|
-
r1.extend(RawString0)
|
145
|
-
else
|
146
|
-
@index = i1
|
147
|
-
r1 = nil
|
148
|
-
end
|
149
|
-
if r1
|
150
|
-
s0 << r1
|
151
|
-
else
|
152
|
-
break
|
153
|
-
end
|
154
|
-
end
|
155
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
156
|
-
r0.extend(RawString1)
|
157
|
-
|
158
|
-
node_cache[:raw_string][start_index] = r0
|
159
|
-
|
160
|
-
r0
|
161
|
-
end
|
162
|
-
|
163
|
-
module CodeContent0
|
164
|
-
def content
|
165
|
-
elements[1]
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
module CodeContent1
|
170
|
-
def contents
|
171
|
-
text_value
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
def _nt_code_content
|
176
|
-
start_index = index
|
177
|
-
if node_cache[:code_content].has_key?(index)
|
178
|
-
cached = node_cache[:code_content][index]
|
179
|
-
if cached
|
180
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
181
|
-
@index = cached.interval.end
|
182
|
-
end
|
183
|
-
return cached
|
184
|
-
end
|
185
|
-
|
186
|
-
s0, i0 = [], index
|
187
|
-
loop do
|
188
|
-
i1, s1 = index, []
|
189
|
-
i2 = index
|
190
|
-
if has_terminal?('>>', false, index)
|
191
|
-
r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
192
|
-
@index += 2
|
193
|
-
else
|
194
|
-
terminal_parse_failure('>>')
|
195
|
-
r3 = nil
|
196
|
-
end
|
197
|
-
if r3
|
198
|
-
r2 = nil
|
199
|
-
else
|
200
|
-
@index = i2
|
201
|
-
r2 = instantiate_node(SyntaxNode,input, index...index)
|
202
|
-
end
|
203
|
-
s1 << r2
|
204
|
-
if r2
|
205
|
-
r4 = _nt_content
|
206
|
-
s1 << r4
|
207
|
-
end
|
208
|
-
if s1.last
|
209
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
210
|
-
r1.extend(CodeContent0)
|
211
|
-
else
|
212
|
-
@index = i1
|
213
|
-
r1 = nil
|
214
|
-
end
|
215
|
-
if r1
|
216
|
-
s0 << r1
|
217
|
-
else
|
218
|
-
break
|
219
|
-
end
|
220
|
-
end
|
221
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
222
|
-
r0.extend(CodeContent1)
|
223
|
-
|
224
|
-
node_cache[:code_content][start_index] = r0
|
225
|
-
|
226
|
-
r0
|
227
|
-
end
|
228
|
-
|
229
|
-
module CodeString0
|
230
|
-
def string
|
231
|
-
elements[1]
|
232
|
-
end
|
233
|
-
|
234
|
-
end
|
235
|
-
|
236
|
-
module CodeString1
|
237
|
-
def data
|
238
|
-
string.contents
|
239
|
-
end
|
240
|
-
end
|
241
|
-
|
242
|
-
def _nt_code_string
|
243
|
-
start_index = index
|
244
|
-
if node_cache[:code_string].has_key?(index)
|
245
|
-
cached = node_cache[:code_string][index]
|
246
|
-
if cached
|
247
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
248
|
-
@index = cached.interval.end
|
249
|
-
end
|
250
|
-
return cached
|
251
|
-
end
|
252
|
-
|
253
|
-
i0, s0 = index, []
|
254
|
-
if has_terminal?('<<', false, index)
|
255
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
256
|
-
@index += 2
|
257
|
-
else
|
258
|
-
terminal_parse_failure('<<')
|
259
|
-
r1 = nil
|
260
|
-
end
|
261
|
-
s0 << r1
|
262
|
-
if r1
|
263
|
-
r2 = _nt_code_content
|
264
|
-
s0 << r2
|
265
|
-
if r2
|
266
|
-
if has_terminal?('>>', false, index)
|
267
|
-
r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
268
|
-
@index += 2
|
269
|
-
else
|
270
|
-
terminal_parse_failure('>>')
|
271
|
-
r3 = nil
|
272
|
-
end
|
273
|
-
s0 << r3
|
274
|
-
end
|
275
|
-
end
|
276
|
-
if s0.last
|
277
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
278
|
-
r0.extend(CodeString0)
|
279
|
-
r0.extend(CodeString1)
|
280
|
-
else
|
281
|
-
@index = i0
|
282
|
-
r0 = nil
|
283
|
-
end
|
284
|
-
|
285
|
-
node_cache[:code_string][start_index] = r0
|
286
|
-
|
287
|
-
r0
|
288
|
-
end
|
289
|
-
|
290
|
-
module MultilineContent0
|
291
|
-
def content
|
292
|
-
elements[1]
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
module MultilineContent1
|
297
|
-
def contents
|
298
|
-
text_value
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
def _nt_multiline_content
|
303
|
-
start_index = index
|
304
|
-
if node_cache[:multiline_content].has_key?(index)
|
305
|
-
cached = node_cache[:multiline_content][index]
|
306
|
-
if cached
|
307
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
308
|
-
@index = cached.interval.end
|
309
|
-
end
|
310
|
-
return cached
|
311
|
-
end
|
312
|
-
|
313
|
-
s0, i0 = [], index
|
314
|
-
loop do
|
315
|
-
i1, s1 = index, []
|
316
|
-
i2 = index
|
317
|
-
r3 = _nt_quote
|
318
|
-
if r3
|
319
|
-
r2 = nil
|
320
|
-
else
|
321
|
-
@index = i2
|
322
|
-
r2 = instantiate_node(SyntaxNode,input, index...index)
|
323
|
-
end
|
324
|
-
s1 << r2
|
325
|
-
if r2
|
326
|
-
r4 = _nt_content
|
327
|
-
s1 << r4
|
328
|
-
end
|
329
|
-
if s1.last
|
330
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
331
|
-
r1.extend(MultilineContent0)
|
332
|
-
else
|
333
|
-
@index = i1
|
334
|
-
r1 = nil
|
335
|
-
end
|
336
|
-
if r1
|
337
|
-
s0 << r1
|
338
|
-
else
|
339
|
-
break
|
340
|
-
end
|
341
|
-
end
|
342
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
343
|
-
r0.extend(MultilineContent1)
|
344
|
-
|
345
|
-
node_cache[:multiline_content][start_index] = r0
|
346
|
-
|
347
|
-
r0
|
348
|
-
end
|
349
|
-
|
350
|
-
module MultilineString0
|
351
|
-
def quote1
|
352
|
-
elements[0]
|
353
|
-
end
|
354
|
-
|
355
|
-
def string
|
356
|
-
elements[1]
|
357
|
-
end
|
358
|
-
|
359
|
-
def quote2
|
360
|
-
elements[2]
|
361
|
-
end
|
362
|
-
end
|
363
|
-
|
364
|
-
module MultilineString1
|
365
|
-
def data
|
366
|
-
elements.collect(&:string).collect(&:contents).join '"'
|
367
|
-
end
|
368
|
-
end
|
369
|
-
|
370
|
-
def _nt_multiline_string
|
371
|
-
start_index = index
|
372
|
-
if node_cache[:multiline_string].has_key?(index)
|
373
|
-
cached = node_cache[:multiline_string][index]
|
374
|
-
if cached
|
375
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
376
|
-
@index = cached.interval.end
|
377
|
-
end
|
378
|
-
return cached
|
379
|
-
end
|
380
|
-
|
381
|
-
s0, i0 = [], index
|
382
|
-
loop do
|
383
|
-
i1, s1 = index, []
|
384
|
-
r2 = _nt_quote
|
385
|
-
s1 << r2
|
386
|
-
if r2
|
387
|
-
r3 = _nt_multiline_content
|
388
|
-
s1 << r3
|
389
|
-
if r3
|
390
|
-
r4 = _nt_quote
|
391
|
-
s1 << r4
|
392
|
-
end
|
393
|
-
end
|
394
|
-
if s1.last
|
395
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
396
|
-
r1.extend(MultilineString0)
|
397
|
-
else
|
398
|
-
@index = i1
|
399
|
-
r1 = nil
|
400
|
-
end
|
401
|
-
if r1
|
402
|
-
s0 << r1
|
403
|
-
else
|
404
|
-
break
|
405
|
-
end
|
406
|
-
end
|
407
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
408
|
-
r0.extend(MultilineString1)
|
409
|
-
|
410
|
-
node_cache[:multiline_string][start_index] = r0
|
411
|
-
|
412
|
-
r0
|
413
|
-
end
|
414
|
-
|
415
|
-
module TranslatableString0
|
416
|
-
def lws
|
417
|
-
elements[1]
|
418
|
-
end
|
419
|
-
|
420
|
-
def string
|
421
|
-
elements[2]
|
422
|
-
end
|
423
|
-
end
|
424
|
-
|
425
|
-
module TranslatableString1
|
426
|
-
def data
|
427
|
-
string.contents
|
428
|
-
end
|
429
|
-
end
|
430
|
-
|
431
|
-
def _nt_translatable_string
|
432
|
-
start_index = index
|
433
|
-
if node_cache[:translatable_string].has_key?(index)
|
434
|
-
cached = node_cache[:translatable_string][index]
|
435
|
-
if cached
|
436
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
437
|
-
@index = cached.interval.end
|
438
|
-
end
|
439
|
-
return cached
|
440
|
-
end
|
441
|
-
|
442
|
-
i0, s0 = index, []
|
443
|
-
if has_terminal?('_', false, index)
|
444
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
445
|
-
@index += 1
|
446
|
-
else
|
447
|
-
terminal_parse_failure('_')
|
448
|
-
r1 = nil
|
449
|
-
end
|
450
|
-
s0 << r1
|
451
|
-
if r1
|
452
|
-
r2 = _nt_lws
|
453
|
-
s0 << r2
|
454
|
-
if r2
|
455
|
-
r3 = _nt_multiline_string
|
456
|
-
s0 << r3
|
457
|
-
end
|
458
|
-
end
|
459
|
-
if s0.last
|
460
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
461
|
-
r0.extend(TranslatableString0)
|
462
|
-
r0.extend(TranslatableString1)
|
463
|
-
else
|
464
|
-
@index = i0
|
465
|
-
r0 = nil
|
466
|
-
end
|
467
|
-
|
468
|
-
node_cache[:translatable_string][start_index] = r0
|
469
|
-
|
470
|
-
r0
|
471
|
-
end
|
472
|
-
|
473
|
-
module OpeningTag0
|
474
|
-
def lws
|
475
|
-
elements[0]
|
476
|
-
end
|
477
|
-
|
478
|
-
def tag
|
479
|
-
elements[2]
|
480
|
-
end
|
481
|
-
|
482
|
-
def fws
|
483
|
-
elements[4]
|
484
|
-
end
|
485
|
-
end
|
486
|
-
|
487
|
-
module OpeningTag1
|
488
|
-
def name
|
489
|
-
tag.name
|
490
|
-
end
|
491
|
-
end
|
492
|
-
|
493
|
-
def _nt_opening_tag
|
494
|
-
start_index = index
|
495
|
-
if node_cache[:opening_tag].has_key?(index)
|
496
|
-
cached = node_cache[:opening_tag][index]
|
497
|
-
if cached
|
498
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
499
|
-
@index = cached.interval.end
|
500
|
-
end
|
501
|
-
return cached
|
502
|
-
end
|
503
|
-
|
504
|
-
i0, s0 = index, []
|
505
|
-
r1 = _nt_lws
|
506
|
-
s0 << r1
|
507
|
-
if r1
|
508
|
-
if has_terminal?('[', false, index)
|
509
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
510
|
-
@index += 1
|
511
|
-
else
|
512
|
-
terminal_parse_failure('[')
|
513
|
-
r2 = nil
|
514
|
-
end
|
515
|
-
s0 << r2
|
516
|
-
if r2
|
517
|
-
r3 = _nt_identifier
|
518
|
-
s0 << r3
|
519
|
-
if r3
|
520
|
-
if has_terminal?(']', false, index)
|
521
|
-
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
522
|
-
@index += 1
|
523
|
-
else
|
524
|
-
terminal_parse_failure(']')
|
525
|
-
r4 = nil
|
526
|
-
end
|
527
|
-
s0 << r4
|
528
|
-
if r4
|
529
|
-
r5 = _nt_fws
|
530
|
-
s0 << r5
|
531
|
-
end
|
532
|
-
end
|
533
|
-
end
|
534
|
-
end
|
535
|
-
if s0.last
|
536
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
537
|
-
r0.extend(OpeningTag0)
|
538
|
-
r0.extend(OpeningTag1)
|
539
|
-
else
|
540
|
-
@index = i0
|
541
|
-
r0 = nil
|
542
|
-
end
|
543
|
-
|
544
|
-
node_cache[:opening_tag][start_index] = r0
|
545
|
-
|
546
|
-
r0
|
547
|
-
end
|
548
|
-
|
549
|
-
module AmendingTag0
|
550
|
-
def lws
|
551
|
-
elements[0]
|
552
|
-
end
|
553
|
-
|
554
|
-
def tag
|
555
|
-
elements[2]
|
556
|
-
end
|
557
|
-
|
558
|
-
def fws
|
559
|
-
elements[4]
|
560
|
-
end
|
561
|
-
end
|
562
|
-
|
563
|
-
module AmendingTag1
|
564
|
-
def name
|
565
|
-
tag.name
|
566
|
-
end
|
567
|
-
end
|
568
|
-
|
569
|
-
def _nt_amending_tag
|
570
|
-
start_index = index
|
571
|
-
if node_cache[:amending_tag].has_key?(index)
|
572
|
-
cached = node_cache[:amending_tag][index]
|
573
|
-
if cached
|
574
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
575
|
-
@index = cached.interval.end
|
576
|
-
end
|
577
|
-
return cached
|
578
|
-
end
|
579
|
-
|
580
|
-
i0, s0 = index, []
|
581
|
-
r1 = _nt_lws
|
582
|
-
s0 << r1
|
583
|
-
if r1
|
584
|
-
if has_terminal?('[+', false, index)
|
585
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
586
|
-
@index += 2
|
587
|
-
else
|
588
|
-
terminal_parse_failure('[+')
|
589
|
-
r2 = nil
|
590
|
-
end
|
591
|
-
s0 << r2
|
592
|
-
if r2
|
593
|
-
r3 = _nt_identifier
|
594
|
-
s0 << r3
|
595
|
-
if r3
|
596
|
-
if has_terminal?(']', false, index)
|
597
|
-
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
598
|
-
@index += 1
|
599
|
-
else
|
600
|
-
terminal_parse_failure(']')
|
601
|
-
r4 = nil
|
602
|
-
end
|
603
|
-
s0 << r4
|
604
|
-
if r4
|
605
|
-
r5 = _nt_fws
|
606
|
-
s0 << r5
|
607
|
-
end
|
608
|
-
end
|
609
|
-
end
|
610
|
-
end
|
611
|
-
if s0.last
|
612
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
613
|
-
r0.extend(AmendingTag0)
|
614
|
-
r0.extend(AmendingTag1)
|
615
|
-
else
|
616
|
-
@index = i0
|
617
|
-
r0 = nil
|
618
|
-
end
|
619
|
-
|
620
|
-
node_cache[:amending_tag][start_index] = r0
|
621
|
-
|
622
|
-
r0
|
623
|
-
end
|
624
|
-
|
625
|
-
module ClosingTag0
|
626
|
-
def lws
|
627
|
-
elements[0]
|
628
|
-
end
|
629
|
-
|
630
|
-
def tag
|
631
|
-
elements[2]
|
632
|
-
end
|
633
|
-
|
634
|
-
def fws
|
635
|
-
elements[4]
|
636
|
-
end
|
637
|
-
end
|
638
|
-
|
639
|
-
module ClosingTag1
|
640
|
-
def name
|
641
|
-
tag.name
|
642
|
-
end
|
643
|
-
end
|
644
|
-
|
645
|
-
def _nt_closing_tag
|
646
|
-
start_index = index
|
647
|
-
if node_cache[:closing_tag].has_key?(index)
|
648
|
-
cached = node_cache[:closing_tag][index]
|
649
|
-
if cached
|
650
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
651
|
-
@index = cached.interval.end
|
652
|
-
end
|
653
|
-
return cached
|
654
|
-
end
|
655
|
-
|
656
|
-
i0, s0 = index, []
|
657
|
-
r1 = _nt_lws
|
658
|
-
s0 << r1
|
659
|
-
if r1
|
660
|
-
if has_terminal?('[/', false, index)
|
661
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
662
|
-
@index += 2
|
663
|
-
else
|
664
|
-
terminal_parse_failure('[/')
|
665
|
-
r2 = nil
|
666
|
-
end
|
667
|
-
s0 << r2
|
668
|
-
if r2
|
669
|
-
r3 = _nt_identifier
|
670
|
-
s0 << r3
|
671
|
-
if r3
|
672
|
-
if has_terminal?(']', false, index)
|
673
|
-
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
674
|
-
@index += 1
|
675
|
-
else
|
676
|
-
terminal_parse_failure(']')
|
677
|
-
r4 = nil
|
678
|
-
end
|
679
|
-
s0 << r4
|
680
|
-
if r4
|
681
|
-
r5 = _nt_fws
|
682
|
-
s0 << r5
|
683
|
-
end
|
684
|
-
end
|
685
|
-
end
|
686
|
-
end
|
687
|
-
if s0.last
|
688
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
689
|
-
r0.extend(ClosingTag0)
|
690
|
-
r0.extend(ClosingTag1)
|
691
|
-
else
|
692
|
-
@index = i0
|
693
|
-
r0 = nil
|
694
|
-
end
|
695
|
-
|
696
|
-
node_cache[:closing_tag][start_index] = r0
|
697
|
-
|
698
|
-
r0
|
699
|
-
end
|
700
|
-
|
701
|
-
module BlankLine0
|
702
|
-
end
|
703
|
-
|
704
|
-
def _nt_blank_line
|
705
|
-
start_index = index
|
706
|
-
if node_cache[:blank_line].has_key?(index)
|
707
|
-
cached = node_cache[:blank_line][index]
|
708
|
-
if cached
|
709
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
710
|
-
@index = cached.interval.end
|
711
|
-
end
|
712
|
-
return cached
|
713
|
-
end
|
714
|
-
|
715
|
-
i0, s0 = index, []
|
716
|
-
s1, i1 = [], index
|
717
|
-
loop do
|
718
|
-
r2 = _nt_ws
|
719
|
-
if r2
|
720
|
-
s1 << r2
|
721
|
-
else
|
722
|
-
break
|
723
|
-
end
|
724
|
-
end
|
725
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
726
|
-
s0 << r1
|
727
|
-
if r1
|
728
|
-
if has_terminal?("\n", false, index)
|
729
|
-
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
730
|
-
@index += 1
|
731
|
-
else
|
732
|
-
terminal_parse_failure("\n")
|
733
|
-
r3 = nil
|
734
|
-
end
|
735
|
-
s0 << r3
|
736
|
-
end
|
737
|
-
if s0.last
|
738
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
739
|
-
r0.extend(BlankLine0)
|
740
|
-
else
|
741
|
-
@index = i0
|
742
|
-
r0 = nil
|
743
|
-
end
|
744
|
-
|
745
|
-
node_cache[:blank_line][start_index] = r0
|
746
|
-
|
747
|
-
r0
|
748
|
-
end
|
749
|
-
|
750
|
-
def _nt_item
|
751
|
-
start_index = index
|
752
|
-
if node_cache[:item].has_key?(index)
|
753
|
-
cached = node_cache[:item][index]
|
754
|
-
if cached
|
755
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
756
|
-
@index = cached.interval.end
|
757
|
-
end
|
758
|
-
return cached
|
759
|
-
end
|
760
|
-
|
761
|
-
i0 = index
|
762
|
-
r1 = _nt_code_attribute
|
763
|
-
if r1
|
764
|
-
r0 = r1
|
765
|
-
else
|
766
|
-
r2 = _nt_multiline_attribute
|
767
|
-
if r2
|
768
|
-
r0 = r2
|
769
|
-
else
|
770
|
-
r3 = _nt_translatable_attribute
|
771
|
-
if r3
|
772
|
-
r0 = r3
|
773
|
-
else
|
774
|
-
r4 = _nt_attribute
|
775
|
-
if r4
|
776
|
-
r0 = r4
|
777
|
-
else
|
778
|
-
r5 = _nt_amending_element
|
779
|
-
if r5
|
780
|
-
r0 = r5
|
781
|
-
else
|
782
|
-
r6 = _nt_element
|
783
|
-
if r6
|
784
|
-
r0 = r6
|
785
|
-
else
|
786
|
-
@index = i0
|
787
|
-
r0 = nil
|
788
|
-
end
|
789
|
-
end
|
790
|
-
end
|
791
|
-
end
|
792
|
-
end
|
793
|
-
end
|
794
|
-
|
795
|
-
node_cache[:item][start_index] = r0
|
796
|
-
|
797
|
-
r0
|
798
|
-
end
|
799
|
-
|
800
|
-
module Contents0
|
801
|
-
def items
|
802
|
-
::Weskit::WML::Mixins::Grammar.reject_non_wml elements
|
803
|
-
end
|
804
|
-
end
|
805
|
-
|
806
|
-
def _nt_contents
|
807
|
-
start_index = index
|
808
|
-
if node_cache[:contents].has_key?(index)
|
809
|
-
cached = node_cache[:contents][index]
|
810
|
-
if cached
|
811
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
812
|
-
@index = cached.interval.end
|
813
|
-
end
|
814
|
-
return cached
|
815
|
-
end
|
816
|
-
|
817
|
-
s0, i0 = [], index
|
818
|
-
loop do
|
819
|
-
i1 = index
|
820
|
-
r2 = _nt_blank_line
|
821
|
-
if r2
|
822
|
-
r1 = r2
|
823
|
-
else
|
824
|
-
r3 = _nt_item
|
825
|
-
if r3
|
826
|
-
r1 = r3
|
827
|
-
else
|
828
|
-
@index = i1
|
829
|
-
r1 = nil
|
830
|
-
end
|
831
|
-
end
|
832
|
-
if r1
|
833
|
-
s0 << r1
|
834
|
-
else
|
835
|
-
break
|
836
|
-
end
|
837
|
-
end
|
838
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
839
|
-
r0.extend(Contents0)
|
840
|
-
|
841
|
-
node_cache[:contents][start_index] = r0
|
842
|
-
|
843
|
-
r0
|
844
|
-
end
|
845
|
-
|
846
|
-
module Attribute0
|
847
|
-
def lws1
|
848
|
-
elements[0]
|
849
|
-
end
|
850
|
-
|
851
|
-
def id
|
852
|
-
elements[1]
|
853
|
-
end
|
854
|
-
|
855
|
-
def lws2
|
856
|
-
elements[2]
|
857
|
-
end
|
858
|
-
|
859
|
-
def equals
|
860
|
-
elements[3]
|
861
|
-
end
|
862
|
-
|
863
|
-
def value
|
864
|
-
elements[4]
|
865
|
-
end
|
866
|
-
|
867
|
-
def eol
|
868
|
-
elements[5]
|
869
|
-
end
|
870
|
-
end
|
871
|
-
|
872
|
-
module Attribute1
|
873
|
-
def item
|
874
|
-
::Weskit::WML::Attribute.new id.name, value.data
|
875
|
-
end
|
876
|
-
end
|
877
|
-
|
878
|
-
def _nt_attribute
|
879
|
-
start_index = index
|
880
|
-
if node_cache[:attribute].has_key?(index)
|
881
|
-
cached = node_cache[:attribute][index]
|
882
|
-
if cached
|
883
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
884
|
-
@index = cached.interval.end
|
885
|
-
end
|
886
|
-
return cached
|
887
|
-
end
|
888
|
-
|
889
|
-
i0, s0 = index, []
|
890
|
-
r1 = _nt_lws
|
891
|
-
s0 << r1
|
892
|
-
if r1
|
893
|
-
r2 = _nt_identifier
|
894
|
-
s0 << r2
|
895
|
-
if r2
|
896
|
-
r3 = _nt_lws
|
897
|
-
s0 << r3
|
898
|
-
if r3
|
899
|
-
r4 = _nt_equals
|
900
|
-
s0 << r4
|
901
|
-
if r4
|
902
|
-
r5 = _nt_raw_string
|
903
|
-
s0 << r5
|
904
|
-
if r5
|
905
|
-
r6 = _nt_eol
|
906
|
-
s0 << r6
|
907
|
-
end
|
908
|
-
end
|
909
|
-
end
|
910
|
-
end
|
911
|
-
end
|
912
|
-
if s0.last
|
913
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
914
|
-
r0.extend(Attribute0)
|
915
|
-
r0.extend(Attribute1)
|
916
|
-
else
|
917
|
-
@index = i0
|
918
|
-
r0 = nil
|
919
|
-
end
|
920
|
-
|
921
|
-
node_cache[:attribute][start_index] = r0
|
922
|
-
|
923
|
-
r0
|
924
|
-
end
|
925
|
-
|
926
|
-
module CodeAttribute0
|
927
|
-
def lws1
|
928
|
-
elements[0]
|
929
|
-
end
|
930
|
-
|
931
|
-
def id
|
932
|
-
elements[1]
|
933
|
-
end
|
934
|
-
|
935
|
-
def lws2
|
936
|
-
elements[2]
|
937
|
-
end
|
938
|
-
|
939
|
-
def equals
|
940
|
-
elements[3]
|
941
|
-
end
|
942
|
-
|
943
|
-
def lws3
|
944
|
-
elements[4]
|
945
|
-
end
|
946
|
-
|
947
|
-
def value
|
948
|
-
elements[5]
|
949
|
-
end
|
950
|
-
|
951
|
-
def fws
|
952
|
-
elements[6]
|
953
|
-
end
|
954
|
-
end
|
955
|
-
|
956
|
-
module CodeAttribute1
|
957
|
-
def item
|
958
|
-
::Weskit::WML::Attribute.new id.name, value.data, :code => true
|
959
|
-
end
|
960
|
-
end
|
961
|
-
|
962
|
-
def _nt_code_attribute
|
963
|
-
start_index = index
|
964
|
-
if node_cache[:code_attribute].has_key?(index)
|
965
|
-
cached = node_cache[:code_attribute][index]
|
966
|
-
if cached
|
967
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
968
|
-
@index = cached.interval.end
|
969
|
-
end
|
970
|
-
return cached
|
971
|
-
end
|
972
|
-
|
973
|
-
i0, s0 = index, []
|
974
|
-
r1 = _nt_lws
|
975
|
-
s0 << r1
|
976
|
-
if r1
|
977
|
-
r2 = _nt_identifier
|
978
|
-
s0 << r2
|
979
|
-
if r2
|
980
|
-
r3 = _nt_lws
|
981
|
-
s0 << r3
|
982
|
-
if r3
|
983
|
-
r4 = _nt_equals
|
984
|
-
s0 << r4
|
985
|
-
if r4
|
986
|
-
r5 = _nt_lws
|
987
|
-
s0 << r5
|
988
|
-
if r5
|
989
|
-
r6 = _nt_code_string
|
990
|
-
s0 << r6
|
991
|
-
if r6
|
992
|
-
r7 = _nt_fws
|
993
|
-
s0 << r7
|
994
|
-
end
|
995
|
-
end
|
996
|
-
end
|
997
|
-
end
|
998
|
-
end
|
999
|
-
end
|
1000
|
-
if s0.last
|
1001
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1002
|
-
r0.extend(CodeAttribute0)
|
1003
|
-
r0.extend(CodeAttribute1)
|
1004
|
-
else
|
1005
|
-
@index = i0
|
1006
|
-
r0 = nil
|
1007
|
-
end
|
1008
|
-
|
1009
|
-
node_cache[:code_attribute][start_index] = r0
|
1010
|
-
|
1011
|
-
r0
|
1012
|
-
end
|
1013
|
-
|
1014
|
-
module MultilineAttribute0
|
1015
|
-
def lws1
|
1016
|
-
elements[0]
|
1017
|
-
end
|
1018
|
-
|
1019
|
-
def id
|
1020
|
-
elements[1]
|
1021
|
-
end
|
1022
|
-
|
1023
|
-
def lws2
|
1024
|
-
elements[2]
|
1025
|
-
end
|
1026
|
-
|
1027
|
-
def equals
|
1028
|
-
elements[3]
|
1029
|
-
end
|
1030
|
-
|
1031
|
-
def lws3
|
1032
|
-
elements[4]
|
1033
|
-
end
|
1034
|
-
|
1035
|
-
def value
|
1036
|
-
elements[5]
|
1037
|
-
end
|
1038
|
-
|
1039
|
-
def fws
|
1040
|
-
elements[6]
|
1041
|
-
end
|
1042
|
-
end
|
1043
|
-
|
1044
|
-
module MultilineAttribute1
|
1045
|
-
def item
|
1046
|
-
::Weskit::WML::Attribute.new id.name, value.data
|
1047
|
-
end
|
1048
|
-
end
|
1049
|
-
|
1050
|
-
def _nt_multiline_attribute
|
1051
|
-
start_index = index
|
1052
|
-
if node_cache[:multiline_attribute].has_key?(index)
|
1053
|
-
cached = node_cache[:multiline_attribute][index]
|
1054
|
-
if cached
|
1055
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1056
|
-
@index = cached.interval.end
|
1057
|
-
end
|
1058
|
-
return cached
|
1059
|
-
end
|
1060
|
-
|
1061
|
-
i0, s0 = index, []
|
1062
|
-
r1 = _nt_lws
|
1063
|
-
s0 << r1
|
1064
|
-
if r1
|
1065
|
-
r2 = _nt_identifier
|
1066
|
-
s0 << r2
|
1067
|
-
if r2
|
1068
|
-
r3 = _nt_lws
|
1069
|
-
s0 << r3
|
1070
|
-
if r3
|
1071
|
-
r4 = _nt_equals
|
1072
|
-
s0 << r4
|
1073
|
-
if r4
|
1074
|
-
r5 = _nt_lws
|
1075
|
-
s0 << r5
|
1076
|
-
if r5
|
1077
|
-
r6 = _nt_multiline_string
|
1078
|
-
s0 << r6
|
1079
|
-
if r6
|
1080
|
-
r7 = _nt_fws
|
1081
|
-
s0 << r7
|
1082
|
-
end
|
1083
|
-
end
|
1084
|
-
end
|
1085
|
-
end
|
1086
|
-
end
|
1087
|
-
end
|
1088
|
-
if s0.last
|
1089
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1090
|
-
r0.extend(MultilineAttribute0)
|
1091
|
-
r0.extend(MultilineAttribute1)
|
1092
|
-
else
|
1093
|
-
@index = i0
|
1094
|
-
r0 = nil
|
1095
|
-
end
|
1096
|
-
|
1097
|
-
node_cache[:multiline_attribute][start_index] = r0
|
1098
|
-
|
1099
|
-
r0
|
1100
|
-
end
|
1101
|
-
|
1102
|
-
module TranslatableAttribute0
|
1103
|
-
def lws1
|
1104
|
-
elements[0]
|
1105
|
-
end
|
1106
|
-
|
1107
|
-
def id
|
1108
|
-
elements[1]
|
1109
|
-
end
|
1110
|
-
|
1111
|
-
def lws2
|
1112
|
-
elements[2]
|
1113
|
-
end
|
1114
|
-
|
1115
|
-
def equals
|
1116
|
-
elements[3]
|
1117
|
-
end
|
1118
|
-
|
1119
|
-
def lws3
|
1120
|
-
elements[4]
|
1121
|
-
end
|
1122
|
-
|
1123
|
-
def lws4
|
1124
|
-
elements[6]
|
1125
|
-
end
|
1126
|
-
|
1127
|
-
def value
|
1128
|
-
elements[7]
|
1129
|
-
end
|
1130
|
-
|
1131
|
-
def fws
|
1132
|
-
elements[8]
|
1133
|
-
end
|
1134
|
-
end
|
1135
|
-
|
1136
|
-
module TranslatableAttribute1
|
1137
|
-
def item
|
1138
|
-
::Weskit::WML::Attribute.new id.name, value.data, :translatable => true
|
1139
|
-
end
|
1140
|
-
end
|
1141
|
-
|
1142
|
-
def _nt_translatable_attribute
|
1143
|
-
start_index = index
|
1144
|
-
if node_cache[:translatable_attribute].has_key?(index)
|
1145
|
-
cached = node_cache[:translatable_attribute][index]
|
1146
|
-
if cached
|
1147
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1148
|
-
@index = cached.interval.end
|
1149
|
-
end
|
1150
|
-
return cached
|
1151
|
-
end
|
1152
|
-
|
1153
|
-
i0, s0 = index, []
|
1154
|
-
r1 = _nt_lws
|
1155
|
-
s0 << r1
|
1156
|
-
if r1
|
1157
|
-
r2 = _nt_identifier
|
1158
|
-
s0 << r2
|
1159
|
-
if r2
|
1160
|
-
r3 = _nt_lws
|
1161
|
-
s0 << r3
|
1162
|
-
if r3
|
1163
|
-
r4 = _nt_equals
|
1164
|
-
s0 << r4
|
1165
|
-
if r4
|
1166
|
-
r5 = _nt_lws
|
1167
|
-
s0 << r5
|
1168
|
-
if r5
|
1169
|
-
if has_terminal?('_', false, index)
|
1170
|
-
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1171
|
-
@index += 1
|
1172
|
-
else
|
1173
|
-
terminal_parse_failure('_')
|
1174
|
-
r6 = nil
|
1175
|
-
end
|
1176
|
-
s0 << r6
|
1177
|
-
if r6
|
1178
|
-
r7 = _nt_lws
|
1179
|
-
s0 << r7
|
1180
|
-
if r7
|
1181
|
-
r8 = _nt_multiline_string
|
1182
|
-
s0 << r8
|
1183
|
-
if r8
|
1184
|
-
r9 = _nt_fws
|
1185
|
-
s0 << r9
|
1186
|
-
end
|
1187
|
-
end
|
1188
|
-
end
|
1189
|
-
end
|
1190
|
-
end
|
1191
|
-
end
|
1192
|
-
end
|
1193
|
-
end
|
1194
|
-
if s0.last
|
1195
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1196
|
-
r0.extend(TranslatableAttribute0)
|
1197
|
-
r0.extend(TranslatableAttribute1)
|
1198
|
-
else
|
1199
|
-
@index = i0
|
1200
|
-
r0 = nil
|
1201
|
-
end
|
1202
|
-
|
1203
|
-
node_cache[:translatable_attribute][start_index] = r0
|
1204
|
-
|
1205
|
-
r0
|
1206
|
-
end
|
1207
|
-
|
1208
|
-
module Element0
|
1209
|
-
def open
|
1210
|
-
elements[0]
|
1211
|
-
end
|
1212
|
-
|
1213
|
-
def nested
|
1214
|
-
elements[1]
|
1215
|
-
end
|
1216
|
-
|
1217
|
-
def close
|
1218
|
-
elements[2]
|
1219
|
-
end
|
1220
|
-
end
|
1221
|
-
|
1222
|
-
module Element1
|
1223
|
-
def item
|
1224
|
-
::Weskit::WML::Mixins::Grammar.raise_on_mismatching open, close
|
1225
|
-
::Weskit::WML::Element.new(open.name).push *nested.items
|
1226
|
-
end
|
1227
|
-
end
|
1228
|
-
|
1229
|
-
def _nt_element
|
1230
|
-
start_index = index
|
1231
|
-
if node_cache[:element].has_key?(index)
|
1232
|
-
cached = node_cache[:element][index]
|
1233
|
-
if cached
|
1234
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1235
|
-
@index = cached.interval.end
|
1236
|
-
end
|
1237
|
-
return cached
|
1238
|
-
end
|
1239
|
-
|
1240
|
-
i0, s0 = index, []
|
1241
|
-
r1 = _nt_opening_tag
|
1242
|
-
s0 << r1
|
1243
|
-
if r1
|
1244
|
-
r2 = _nt_contents
|
1245
|
-
s0 << r2
|
1246
|
-
if r2
|
1247
|
-
r3 = _nt_closing_tag
|
1248
|
-
s0 << r3
|
1249
|
-
end
|
1250
|
-
end
|
1251
|
-
if s0.last
|
1252
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1253
|
-
r0.extend(Element0)
|
1254
|
-
r0.extend(Element1)
|
1255
|
-
else
|
1256
|
-
@index = i0
|
1257
|
-
r0 = nil
|
1258
|
-
end
|
1259
|
-
|
1260
|
-
node_cache[:element][start_index] = r0
|
1261
|
-
|
1262
|
-
r0
|
1263
|
-
end
|
1264
|
-
|
1265
|
-
module AmendingElement0
|
1266
|
-
def open
|
1267
|
-
elements[0]
|
1268
|
-
end
|
1269
|
-
|
1270
|
-
def nested
|
1271
|
-
elements[1]
|
1272
|
-
end
|
1273
|
-
|
1274
|
-
def close
|
1275
|
-
elements[2]
|
1276
|
-
end
|
1277
|
-
end
|
1278
|
-
|
1279
|
-
module AmendingElement1
|
1280
|
-
def item
|
1281
|
-
::Weskit::WML::Mixins::Grammar.raise_on_mismatching open, close
|
1282
|
-
::Weskit::WML::Element.new(open.name, :amendment => true).push *nested.items
|
1283
|
-
end
|
1284
|
-
end
|
1285
|
-
|
1286
|
-
def _nt_amending_element
|
1287
|
-
start_index = index
|
1288
|
-
if node_cache[:amending_element].has_key?(index)
|
1289
|
-
cached = node_cache[:amending_element][index]
|
1290
|
-
if cached
|
1291
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1292
|
-
@index = cached.interval.end
|
1293
|
-
end
|
1294
|
-
return cached
|
1295
|
-
end
|
1296
|
-
|
1297
|
-
i0, s0 = index, []
|
1298
|
-
r1 = _nt_amending_tag
|
1299
|
-
s0 << r1
|
1300
|
-
if r1
|
1301
|
-
r2 = _nt_contents
|
1302
|
-
s0 << r2
|
1303
|
-
if r2
|
1304
|
-
r3 = _nt_closing_tag
|
1305
|
-
s0 << r3
|
1306
|
-
end
|
1307
|
-
end
|
1308
|
-
if s0.last
|
1309
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1310
|
-
r0.extend(AmendingElement0)
|
1311
|
-
r0.extend(AmendingElement1)
|
1312
|
-
else
|
1313
|
-
@index = i0
|
1314
|
-
r0 = nil
|
1315
|
-
end
|
1316
|
-
|
1317
|
-
node_cache[:amending_element][start_index] = r0
|
1318
|
-
|
1319
|
-
r0
|
1320
|
-
end
|
1321
|
-
|
1322
|
-
def _nt_content
|
1323
|
-
start_index = index
|
1324
|
-
if node_cache[:content].has_key?(index)
|
1325
|
-
cached = node_cache[:content][index]
|
1326
|
-
if cached
|
1327
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1328
|
-
@index = cached.interval.end
|
1329
|
-
end
|
1330
|
-
return cached
|
1331
|
-
end
|
1332
|
-
|
1333
|
-
i0 = index
|
1334
|
-
if has_terminal?("\n", false, index)
|
1335
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1336
|
-
@index += 1
|
1337
|
-
else
|
1338
|
-
terminal_parse_failure("\n")
|
1339
|
-
r1 = nil
|
1340
|
-
end
|
1341
|
-
if r1
|
1342
|
-
r0 = r1
|
1343
|
-
else
|
1344
|
-
if index < input_length
|
1345
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1346
|
-
@index += 1
|
1347
|
-
else
|
1348
|
-
terminal_parse_failure("any character")
|
1349
|
-
r2 = nil
|
1350
|
-
end
|
1351
|
-
if r2
|
1352
|
-
r0 = r2
|
1353
|
-
else
|
1354
|
-
@index = i0
|
1355
|
-
r0 = nil
|
1356
|
-
end
|
1357
|
-
end
|
1358
|
-
|
1359
|
-
node_cache[:content][start_index] = r0
|
1360
|
-
|
1361
|
-
r0
|
1362
|
-
end
|
1363
|
-
|
1364
|
-
def _nt_eol
|
1365
|
-
start_index = index
|
1366
|
-
if node_cache[:eol].has_key?(index)
|
1367
|
-
cached = node_cache[:eol][index]
|
1368
|
-
if cached
|
1369
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1370
|
-
@index = cached.interval.end
|
1371
|
-
end
|
1372
|
-
return cached
|
1373
|
-
end
|
1374
|
-
|
1375
|
-
i0 = index
|
1376
|
-
if has_terminal?("\n", false, index)
|
1377
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1378
|
-
@index += 1
|
1379
|
-
else
|
1380
|
-
terminal_parse_failure("\n")
|
1381
|
-
r1 = nil
|
1382
|
-
end
|
1383
|
-
if r1
|
1384
|
-
r0 = r1
|
1385
|
-
else
|
1386
|
-
i2 = index
|
1387
|
-
if index < input_length
|
1388
|
-
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1389
|
-
@index += 1
|
1390
|
-
else
|
1391
|
-
terminal_parse_failure("any character")
|
1392
|
-
r3 = nil
|
1393
|
-
end
|
1394
|
-
if r3
|
1395
|
-
r2 = nil
|
1396
|
-
else
|
1397
|
-
@index = i2
|
1398
|
-
r2 = instantiate_node(SyntaxNode,input, index...index)
|
1399
|
-
end
|
1400
|
-
if r2
|
1401
|
-
r0 = r2
|
1402
|
-
else
|
1403
|
-
@index = i0
|
1404
|
-
r0 = nil
|
1405
|
-
end
|
1406
|
-
end
|
1407
|
-
|
1408
|
-
node_cache[:eol][start_index] = r0
|
1409
|
-
|
1410
|
-
r0
|
1411
|
-
end
|
1412
|
-
|
1413
|
-
def _nt_equals
|
1414
|
-
start_index = index
|
1415
|
-
if node_cache[:equals].has_key?(index)
|
1416
|
-
cached = node_cache[:equals][index]
|
1417
|
-
if cached
|
1418
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1419
|
-
@index = cached.interval.end
|
1420
|
-
end
|
1421
|
-
return cached
|
1422
|
-
end
|
1423
|
-
|
1424
|
-
if has_terminal?('=', false, index)
|
1425
|
-
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1426
|
-
@index += 1
|
1427
|
-
else
|
1428
|
-
terminal_parse_failure('=')
|
1429
|
-
r0 = nil
|
1430
|
-
end
|
1431
|
-
|
1432
|
-
node_cache[:equals][start_index] = r0
|
1433
|
-
|
1434
|
-
r0
|
1435
|
-
end
|
1436
|
-
|
1437
|
-
def _nt_quote
|
1438
|
-
start_index = index
|
1439
|
-
if node_cache[:quote].has_key?(index)
|
1440
|
-
cached = node_cache[:quote][index]
|
1441
|
-
if cached
|
1442
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1443
|
-
@index = cached.interval.end
|
1444
|
-
end
|
1445
|
-
return cached
|
1446
|
-
end
|
1447
|
-
|
1448
|
-
if has_terminal?('"', false, index)
|
1449
|
-
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1450
|
-
@index += 1
|
1451
|
-
else
|
1452
|
-
terminal_parse_failure('"')
|
1453
|
-
r0 = nil
|
1454
|
-
end
|
1455
|
-
|
1456
|
-
node_cache[:quote][start_index] = r0
|
1457
|
-
|
1458
|
-
r0
|
1459
|
-
end
|
1460
|
-
|
1461
|
-
def _nt_ws
|
1462
|
-
start_index = index
|
1463
|
-
if node_cache[:ws].has_key?(index)
|
1464
|
-
cached = node_cache[:ws][index]
|
1465
|
-
if cached
|
1466
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1467
|
-
@index = cached.interval.end
|
1468
|
-
end
|
1469
|
-
return cached
|
1470
|
-
end
|
1471
|
-
|
1472
|
-
i0 = index
|
1473
|
-
if has_terminal?("\s", false, index)
|
1474
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1475
|
-
@index += 1
|
1476
|
-
else
|
1477
|
-
terminal_parse_failure("\s")
|
1478
|
-
r1 = nil
|
1479
|
-
end
|
1480
|
-
if r1
|
1481
|
-
r0 = r1
|
1482
|
-
else
|
1483
|
-
if has_terminal?("\t", false, index)
|
1484
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1485
|
-
@index += 1
|
1486
|
-
else
|
1487
|
-
terminal_parse_failure("\t")
|
1488
|
-
r2 = nil
|
1489
|
-
end
|
1490
|
-
if r2
|
1491
|
-
r0 = r2
|
1492
|
-
else
|
1493
|
-
@index = i0
|
1494
|
-
r0 = nil
|
1495
|
-
end
|
1496
|
-
end
|
1497
|
-
|
1498
|
-
node_cache[:ws][start_index] = r0
|
1499
|
-
|
1500
|
-
r0
|
1501
|
-
end
|
1502
|
-
|
1503
|
-
def _nt_lws
|
1504
|
-
start_index = index
|
1505
|
-
if node_cache[:lws].has_key?(index)
|
1506
|
-
cached = node_cache[:lws][index]
|
1507
|
-
if cached
|
1508
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1509
|
-
@index = cached.interval.end
|
1510
|
-
end
|
1511
|
-
return cached
|
1512
|
-
end
|
1513
|
-
|
1514
|
-
s0, i0 = [], index
|
1515
|
-
loop do
|
1516
|
-
r1 = _nt_ws
|
1517
|
-
if r1
|
1518
|
-
s0 << r1
|
1519
|
-
else
|
1520
|
-
break
|
1521
|
-
end
|
1522
|
-
end
|
1523
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1524
|
-
|
1525
|
-
node_cache[:lws][start_index] = r0
|
1526
|
-
|
1527
|
-
r0
|
1528
|
-
end
|
1529
|
-
|
1530
|
-
module Fws0
|
1531
|
-
def eol
|
1532
|
-
elements[1]
|
1533
|
-
end
|
1534
|
-
end
|
1535
|
-
|
1536
|
-
def _nt_fws
|
1537
|
-
start_index = index
|
1538
|
-
if node_cache[:fws].has_key?(index)
|
1539
|
-
cached = node_cache[:fws][index]
|
1540
|
-
if cached
|
1541
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1542
|
-
@index = cached.interval.end
|
1543
|
-
end
|
1544
|
-
return cached
|
1545
|
-
end
|
1546
|
-
|
1547
|
-
i0, s0 = index, []
|
1548
|
-
s1, i1 = [], index
|
1549
|
-
loop do
|
1550
|
-
r2 = _nt_ws
|
1551
|
-
if r2
|
1552
|
-
s1 << r2
|
1553
|
-
else
|
1554
|
-
break
|
1555
|
-
end
|
1556
|
-
end
|
1557
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1558
|
-
s0 << r1
|
1559
|
-
if r1
|
1560
|
-
r3 = _nt_eol
|
1561
|
-
s0 << r3
|
1562
|
-
end
|
1563
|
-
if s0.last
|
1564
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1565
|
-
r0.extend(Fws0)
|
1566
|
-
else
|
1567
|
-
@index = i0
|
1568
|
-
r0 = nil
|
1569
|
-
end
|
1570
|
-
|
1571
|
-
node_cache[:fws][start_index] = r0
|
1572
|
-
|
1573
|
-
r0
|
1574
|
-
end
|
1575
|
-
|
1576
|
-
end
|
1577
|
-
|
1578
|
-
class WesnothMarkupLanguageParser < Treetop::Runtime::CompiledParser
|
1579
|
-
include WesnothMarkupLanguage
|
1580
|
-
end
|