rubyang 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1454 @@
1
+ class Rubyang::Model::Parser
2
+
3
+ token
4
+ STRING
5
+
6
+ rule
7
+ statement : "module-stmt"
8
+ | "submodule-stmt"
9
+
10
+ "module-stmt" : "module-keyword" "identifier-arg-str"
11
+ "{"
12
+ "module-header-stmts"
13
+ "linkage-stmts"
14
+ "meta-stmts"
15
+ "revision-stmts"
16
+ "body-stmts"
17
+ "}"
18
+ {
19
+ substmts = val[3..-2].inject( [] ){ |ss, s| ss + s }
20
+ result = Rubyang::Model::Module.new( val[1], substmts )
21
+ }
22
+
23
+ "submodule-stmt" : "submodule-keyword" "identifier-arg-str"
24
+ "{"
25
+ "submodule-header-stmts"
26
+ "linkage-stmts"
27
+ "meta-stmts"
28
+ "revision-stmts"
29
+ "body-stmts"
30
+ "}"
31
+ {
32
+ substmts = val[3..-2].inject( [] ){ |ss, s| ss + s }
33
+ result = Rubyang::Model::Submodule.new( val[1], substmts )
34
+ }
35
+
36
+ "module-header-stmts" : /* */
37
+ {
38
+ result = []
39
+ }
40
+ | "module-header-stmts" "module-header-stmt"
41
+ {
42
+ result = val[0] + [val[1]]
43
+ }
44
+
45
+ "module-header-stmt" : "yang-version-stmt"
46
+ | "namespace-stmt"
47
+ | "prefix-stmt"
48
+
49
+ "submodule-header-stmts" : /* */
50
+ {
51
+ result = []
52
+ }
53
+ | "submodule-header-stmts" "submodule-header-stmt"
54
+ {
55
+ result = val[0] + [val[1]]
56
+ }
57
+
58
+ "submodule-header-stmt" : "yang-version-stmt"
59
+ | "belongs-to-stmt"
60
+
61
+ "meta-stmts" : /* */
62
+ {
63
+ result = []
64
+ }
65
+ | "meta-stmts" "meta-stmt"
66
+ {
67
+ result = val[0] + [val[1]]
68
+ }
69
+
70
+ "meta-stmt" : "organization-stmt"
71
+ | "contact-stmt"
72
+ | "description-stmt"
73
+ | "reference-stmt"
74
+
75
+ "linkage-stmts" : /* */
76
+ {
77
+ result = []
78
+ }
79
+ | "linkage-stmts" "linkage-stmt"
80
+ {
81
+ result = val[0] + [val[1]]
82
+ }
83
+
84
+ "linkage-stmt" : "import-stmt"
85
+ | "include-stmt"
86
+
87
+ "revision-stmts" : /* */
88
+ {
89
+ result = []
90
+ }
91
+ | "revision-stmts" "revision-stmt"
92
+ {
93
+ result = val[0] + [val[1]]
94
+ }
95
+
96
+ "body-stmts" : /* */
97
+ {
98
+ result = []
99
+ }
100
+ | "body-stmts" "body-stmt"
101
+ {
102
+ result = val[0] + [val[1]]
103
+ }
104
+
105
+ "body-stmt" : "extension-stmt"
106
+ | "feature-stmt"
107
+ | "identity-stmt"
108
+ | "typedef-stmt"
109
+ | "grouping-stmt"
110
+ | "data-def-stmt"
111
+ | "augment-stmt"
112
+ | "rpc-stmt"
113
+ | "notification-stmt"
114
+ | "deviation-stmt"
115
+
116
+ "data-def-stmt" : "container-stmt"
117
+ | "leaf-stmt"
118
+ | "leaf-list-stmt"
119
+ | "list-stmt"
120
+ | "choice-stmt"
121
+ | "anyxml-stmt"
122
+ | "uses-stmt"
123
+
124
+ "yang-version-stmt" : "yang-version-keyword" "yang-version-arg-str" "stmtend"
125
+ {
126
+ result = Rubyang::Model::YangVersion.new( val[1] )
127
+ }
128
+
129
+ "yang-version-arg-str" : "string"
130
+ {
131
+ unless val[0] == "1"
132
+ raise ParseError, "yang-version must be '1', but '#{val[0]}'"
133
+ end
134
+ result = val[0]
135
+ }
136
+
137
+ "import-stmt" : "import-keyword" "identifier-arg-str" "{" "inner-import-stmts" "}"
138
+ {
139
+ substmts = val[3]
140
+ result = Rubyang::Model::Import.new( val[1], substmts )
141
+ }
142
+
143
+ "inner-import-stmts" : /* */
144
+ {
145
+ result = []
146
+ }
147
+ | "inner-import-stmts" "inner-import-stmt"
148
+ {
149
+ result = val[0] + [val[1]]
150
+ }
151
+
152
+ "inner-import-stmt" : "prefix-stmt"
153
+ | "revision-date-stmt"
154
+
155
+ "include-stmt" : "include-keyword" "identifier-arg-str" ";"
156
+ {
157
+ result = Rubyang::Model::Include.new( val[1] )
158
+ }
159
+ | "include-keyword" "identifier-arg-str" "{" "inner-include-stmts" "}"
160
+ {
161
+ substmts = val[3]
162
+ result = Rubyang::Model::Include.new( val[1], substmts )
163
+ }
164
+
165
+ "inner-include-stmts" : /* */
166
+ {
167
+ result = []
168
+ }
169
+ | "inner-include-stmts" "inner-include-stmt"
170
+ {
171
+ result = val[0] + [val[1]]
172
+ }
173
+
174
+ "inner-include-stmt" : "revision-date-stmt"
175
+
176
+ "namespace-stmt" : "namespace-keyword" "uri-str" "stmtend"
177
+ {
178
+ result = Rubyang::Model::Namespace.new( val[1] )
179
+ }
180
+
181
+ "uri-str" : "string"
182
+ {
183
+ unless val[0] == URI.regexp.match( val[0] ).to_s
184
+ raise ParseError, "namespace statement's argument must be URI"
185
+ end
186
+ result = val[0]
187
+ }
188
+
189
+ "prefix-stmt" : "prefix-keyword" "prefix-arg-str" "stmtend"
190
+ {
191
+ result = Rubyang::Model::Prefix.new( val[1] )
192
+ }
193
+
194
+ "belongs-to-stmt" : "belongs-to-keyword" "identifier-arg-str" "{" "prefix-stmt" "}"
195
+ {
196
+ substmts = [val[3]]
197
+ result = Rubyang::Model::BelongsTo.new( val[1], substmts )
198
+ }
199
+
200
+ "organization-stmt" : "organization-keyword" "string" "stmtend"
201
+ {
202
+ result = Rubyang::Model::Organization.new( val[1] )
203
+ }
204
+
205
+ "contact-stmt" : "contact-keyword" "string" "stmtend"
206
+ {
207
+ result = Rubyang::Model::Contact.new( val[1] )
208
+ }
209
+
210
+ "description-stmt" : "description-keyword" "string" "stmtend"
211
+ {
212
+ result = Rubyang::Model::Description.new( val[1] )
213
+ }
214
+
215
+ "reference-stmt" : "reference-keyword" "string" "stmtend"
216
+ {
217
+ result = Rubyang::Model::Reference.new( val[1] )
218
+ }
219
+
220
+ "units-stmt" : "units-keyword" "string" "stmtend"
221
+ {
222
+ result = Rubyang::Model::Units.new( val[1] )
223
+ }
224
+
225
+ "revision-stmt" : "revision-keyword" "revision-date" ";"
226
+ {
227
+ result = Rubyang::Model::Revision.new( val[1] )
228
+ }
229
+ | "revision-keyword" "revision-date" "{" "inner-revision-stmts" "}"
230
+ {
231
+ substmts = val[3]
232
+ result = Rubyang::Model::Revision.new( val[1], substmts )
233
+ }
234
+
235
+ "inner-revision-stmts" : /* */
236
+ {
237
+ result = []
238
+ }
239
+ | "inner-revision-stmts" "inner-revision-stmt"
240
+ {
241
+ result = val[0] + [val[1]]
242
+ }
243
+
244
+ "inner-revision-stmt" : "description-stmt"
245
+ | "reference-stmt"
246
+
247
+ "revision-date" : "date-arg-str"
248
+
249
+ "revision-date-stmt" : "revision-date-keyword" "revision-date" "stmtend"
250
+ {
251
+ result = Rubyang::Model::RevisionDate.new( val[1] )
252
+ }
253
+
254
+ "extension-stmt" : "extension-keyword" "identifier-arg-str" ";"
255
+ {
256
+ result = Rubyang::Model::Extension.new( val[1] )
257
+ }
258
+ | "extension-keyword" "identifier-arg-str" "{" "inner-extension-stmts" "}"
259
+ {
260
+ substmts = val[3]
261
+ result = Rubyang::Model::Extension.new( val[1], substmts )
262
+ }
263
+
264
+ "inner-extension-stmts" : /* */
265
+ {
266
+ result = []
267
+ }
268
+ | "inner-extension-stmts" "inner-extension-stmt"
269
+ {
270
+ result = val[0] + [val[1]]
271
+ }
272
+
273
+ "inner-extension-stmt" : "argument-stmt"
274
+ | "status-stmt"
275
+ | "description-stmt"
276
+ | "reference-stmt"
277
+
278
+ "argument-stmt" : "argument-keyword" "identifier-arg-str" ";"
279
+ {
280
+ result = Rubyang::Model::Argument.new( val[1] )
281
+ }
282
+ | "argument-keyword" "identifier-arg-str" "{" "inner-argument-stmts" "}"
283
+ {
284
+ substmts = val[3]
285
+ result = Rubyang::Model::Argument.new( val[1], substmts )
286
+ }
287
+
288
+ "inner-argument-stmts" : /* */
289
+ {
290
+ result = []
291
+ }
292
+ | "inner-argument-stmts" "inner-argument-stmt"
293
+ {
294
+ result = val[0] + [val[1]]
295
+ }
296
+
297
+ "inner-argument-stmt" : "yin-element-stmt"
298
+
299
+ "yin-element-stmt" : "yin-element-keyword" "yin-element-arg-str" ";"
300
+ {
301
+ result = Rubyang::Model::YinElement.new( val[1] )
302
+ }
303
+
304
+ "yin-element-arg-str" : "string"
305
+ {
306
+ unless ['true', 'false'].include? val[0]
307
+ raise Racc::ParseError, "yin-element-arg-str must be 'true' or 'false', but '#{val[0]}'"
308
+ end
309
+ result = val[0]
310
+ }
311
+
312
+ "identity-stmt" : "identity-keyword" "identifier-arg-str" ";"
313
+ {
314
+ result = Rubyang::Model::Identity.new( val[1] )
315
+ }
316
+ | "identity-keyword" "identifier-arg-str" "{" "inner-identity-stmts" "}"
317
+ {
318
+ substmts = val[3]
319
+ result = Rubyang::Model::Identity.new( val[1], substmts )
320
+ }
321
+
322
+ "inner-identity-stmts" : /* */
323
+ {
324
+ result = []
325
+ }
326
+ | "inner-identity-stmts" "inner-identity-stmt"
327
+ {
328
+ result = val[0] + [val[1]]
329
+ }
330
+
331
+ "inner-identity-stmt" : "base-stmt"
332
+ | "status-stmt"
333
+ | "description-stmt"
334
+ | "reference-stmt"
335
+
336
+ "base-stmt" : "base-keyword" "identifier-ref-arg-str" ";"
337
+ {
338
+ result = Rubyang::Model::Base.new( val[1] )
339
+ }
340
+
341
+ "feature-stmt" : "feature-keyword" "identifier-arg-str" ";"
342
+ {
343
+ result = Rubyang::Model::Feature.new( val[1] )
344
+ }
345
+ | "feature-keyword" "identifier-arg-str" "{" "inner-feature-stmts" "}"
346
+ {
347
+ substmts = val[3]
348
+ result = Rubyang::Model::Feature.new( val[1], substmts )
349
+ }
350
+
351
+ "inner-feature-stmts" : /* */
352
+ {
353
+ result = []
354
+ }
355
+ | "inner-feature-stmts" "inner-feature-stmt"
356
+ {
357
+ result = val[0] + [val[1]]
358
+ }
359
+
360
+ "inner-feature-stmt" : "if-feature-stmt"
361
+ | "status-stmt"
362
+ | "description-stmt"
363
+ | "reference-stmt"
364
+
365
+ "if-feature-stmt" : "if-feature-keyword" "identifier-ref-arg-str" "stmtend"
366
+ {
367
+ result = Rubyang::Model::IfFeature.new( val[1] )
368
+ }
369
+
370
+ "typedef-stmt" : "typedef-keyword" "identifier-arg-str" "{" "inner-typedef-stmts" "}"
371
+ {
372
+ substmts = val[3]
373
+ result = Rubyang::Model::Typedef.new( val[1], substmts )
374
+ }
375
+
376
+ "inner-typedef-stmts" : /* */
377
+ {
378
+ result = []
379
+ }
380
+ | "inner-typedef-stmts" "inner-typedef-stmt"
381
+ {
382
+ result = val[0] + [val[1]]
383
+ }
384
+
385
+ "inner-typedef-stmt" : "type-stmt"
386
+ | "units-stmt"
387
+ | "default-stmt"
388
+ | "status-stmt"
389
+ | "description-stmt"
390
+ | "reference-stmt"
391
+
392
+ "type-stmt" : "type-keyword" "identifier-ref-arg-str" ";"
393
+ {
394
+ result = Rubyang::Model::Type.new( val[1] )
395
+ }
396
+ | "type-keyword" "identifier-ref-arg-str" "{" "type-body-stmts" "}"
397
+ {
398
+ substmts = val[3]
399
+ result = Rubyang::Model::Type.new( val[1], substmts )
400
+ }
401
+
402
+ "type-body-stmts" : "numerical-restrictions"
403
+ | "decimal64-specification"
404
+ | "string-restrictions"
405
+ | "enum-specification"
406
+ | "leafref-specification"
407
+ | "identityref-specification"
408
+ | "instance-identifier-specification"
409
+ | "bits-specification"
410
+ | "union-specification"
411
+
412
+ "numerical-restrictions" : "range-stmt"
413
+ {
414
+ result = [val[0]]
415
+ }
416
+
417
+ "range-stmt" : "range-keyword" "range-arg-str" ";"
418
+ {
419
+ result = Rubyang::Model::Range.new( val[1] )
420
+ }
421
+ | "range-keyword" "range-arg-str" "{" "inner-range-stmts" "}"
422
+ {
423
+ substmts = val[3]
424
+ result = Rubyang::Model::Range.new( val[1], substmts )
425
+ }
426
+
427
+ "inner-range-stmts" : /* */
428
+ {
429
+ result = []
430
+ }
431
+ | "inner-range-stmts" "inner-range-stmt"
432
+ {
433
+ result = val[0] + [val[1]]
434
+ }
435
+
436
+ "inner-range-stmt" : "error-message-stmt"
437
+ | "error-app-tag-stmt"
438
+ | "description-stmt"
439
+ | "reference-stmt"
440
+
441
+ "decimal64-specification" : "fraction-digits-stmt"
442
+ {
443
+ result = [val[0]]
444
+ }
445
+
446
+ "fraction-digits-stmt" : "fraction-digits-keyword" "fraction-digits-arg-str" "stmtend"
447
+ {
448
+ result = Rubyang::Model::FractionDigits.new( val[1] )
449
+ }
450
+
451
+ "fraction-digits-arg-str" : "string"
452
+ {
453
+ unless /^(1[012345678]?|[23456789])$/ =~ val[0]
454
+ raise Racc::ParseError, "fraction digits' must be in 1..18, but '#{val[0]}'"
455
+ end
456
+ result = val[0]
457
+ }
458
+
459
+ "string-restrictions" : /* */
460
+ {
461
+ result = []
462
+ }
463
+ | "string-restrictions" "string-restriction"
464
+ {
465
+ result = val[0] + [val[1]]
466
+ }
467
+
468
+ "string-restriction" : "length-stmt"
469
+ | "pattern-stmt"
470
+
471
+ "length-stmt" : "length-keyword" "length-arg-str" ";"
472
+ {
473
+ result = Rubyang::Model::Length.new( val[1] )
474
+ }
475
+ | "length-keyword" "length-arg-str" "{" "inner-length-stmts" "}"
476
+ {
477
+ substmts = val[3]
478
+ result = Rubyang::Model::Length.new( val[1], substmts )
479
+ }
480
+
481
+ "inner-length-stmts" : /* */
482
+ {
483
+ result = []
484
+ }
485
+ | "inner-length-stmts" "inner-length-stmt"
486
+ {
487
+ result = val[0] + [val[1]]
488
+ }
489
+
490
+ "inner-length-stmt" : "error-message-stmt"
491
+ | "error-app-tag-stmt"
492
+ | "description-stmt"
493
+ | "reference-stmt"
494
+
495
+ "pattern-stmt" : "pattern-keyword" "string" ";"
496
+ {
497
+ result = Rubyang::Model::Pattern.new( val[1] )
498
+ }
499
+ | "pattern-keyword" "string" "{" "inner-pattern-stmts" "}"
500
+ {
501
+ substmts = val[3]
502
+ result = Rubyang::Model::Pattern.new( val[1], substmts )
503
+ }
504
+
505
+ "inner-pattern-stmts" : /* */
506
+ {
507
+ result = []
508
+ }
509
+ | "inner-pattern-stmts" "inner-pattern-stmt"
510
+ {
511
+ result = val[0] + [val[1]]
512
+ }
513
+
514
+ "inner-pattern-stmt" : "error-message-stmt"
515
+ | "error-app-tag-stmt"
516
+ | "description-stmt"
517
+ | "reference-stmt"
518
+
519
+ "default-stmt" : "default-keyword" "string" "stmtend"
520
+ {
521
+ result = Rubyang::Model::Default.new( val[1] )
522
+ }
523
+
524
+ "enum-specification" : "enum-stmt"
525
+ {
526
+ result = [val[0]]
527
+ }
528
+ | "enum-specification" "enum-stmt"
529
+ {
530
+ result = val[0] + [val[1]]
531
+ }
532
+
533
+ "enum-stmt" : "enum-keyword" "string" ";"
534
+ {
535
+ result = Rubyang::Model::Enum.new( val[1] )
536
+ }
537
+ | "enum-keyword" "string" "{" "inner-enum-stmts" "}"
538
+ {
539
+ substmts = val[3]
540
+ result = Rubyang::Model::Enum.new( val[1], substmts )
541
+ }
542
+
543
+ "inner-enum-stmts" : /* */
544
+ {
545
+ result = []
546
+ }
547
+ | "inner-enum-stmts" "inner-enum-stmt"
548
+ {
549
+ result = val[0] + [val[1]]
550
+ }
551
+
552
+ "inner-enum-stmt" : "value-stmt"
553
+ | "status-stmt"
554
+ | "description-stmt"
555
+ | "reference-stmt"
556
+
557
+ "leafref-specification" : "path-stmt"
558
+ {
559
+ result = [val[0]]
560
+ }
561
+ | "path-stmt" "require-instance-stmt"
562
+ {
563
+ result = [val[0]] + [val[1]]
564
+ }
565
+ | "require-instance-stmt" "path-stmt"
566
+ {
567
+ result = [val[0]] + [val[1]]
568
+ }
569
+
570
+ "path-stmt" : "path-keyword" "path-arg-str" "stmtend"
571
+ {
572
+ result = Rubyang::Model::Path.new( val[1] )
573
+ }
574
+
575
+ "require-instance-stmt" : "require-instance-keyword" "require-instance-arg-str" "stmtend"
576
+ {
577
+ result = Rubyang::Model::RequireInstance.new( val[1] )
578
+ }
579
+
580
+ "require-instance-arg-str" : "string"
581
+ {
582
+ unless ['true', 'false'].include? val[0]
583
+ raise Racc::ParseError, "require-instance-arg-str must be 'true' or 'false', but '#{val[0]}'"
584
+ end
585
+ result = val[0]
586
+ }
587
+
588
+ "instance-identifier-specification" : "require-instance-stmt"
589
+ {
590
+ result = [val[0]]
591
+ }
592
+
593
+ "identityref-specification" : "base-stmt"
594
+ {
595
+ result = [val[0]]
596
+ }
597
+
598
+ "union-specification" : "type-stmt"
599
+ {
600
+ result = [val[0]]
601
+ }
602
+ | "union-specification" "type-stmt"
603
+ {
604
+ result = val[0] + [val[1]]
605
+ }
606
+
607
+ "bits-specification" : "bit-stmt"
608
+ {
609
+ result = [val[0]]
610
+ }
611
+ | "bits-specification" "bit-stmt"
612
+ {
613
+ result = val[0] + [val[1]]
614
+ }
615
+
616
+ "bit-stmt" : "bit-keyword" "identifier-arg-str" ";"
617
+ {
618
+ result = Rubyang::Model::Bit.new( val[1] )
619
+ }
620
+ | "bit-keyword" "identifier-arg-str" "{" "inner-bit-stmts" "}"
621
+ {
622
+ substmts = val[3]
623
+ result = Rubyang::Model::Bit.new( val[1], substmts )
624
+ }
625
+
626
+ "inner-bit-stmts" : /* */
627
+ {
628
+ result = []
629
+ }
630
+ | "inner-bit-stmts" "inner-bit-stmt"
631
+ {
632
+ result = val[0] + [val[1]]
633
+ }
634
+
635
+ "inner-bit-stmt" : "position-stmt"
636
+ | "status-stmt"
637
+ | "description-stmt"
638
+ | "reference-stmt"
639
+
640
+ "position-stmt" : "position-keyword" "position-value-arg-str" "stmtend"
641
+ {
642
+ result = Rubyang::Model::Position.new( val[1] )
643
+ }
644
+
645
+ "position-value-arg-str" : "string"
646
+ {
647
+ unless /^[0-9]+$/ =~ val[0]
648
+ raise "position-value-arg-str must be non-negative-integer-value"
649
+ end
650
+ result = val[0]
651
+ }
652
+
653
+ "status-stmt" : "status-keyword" "status-arg-str" "stmtend"
654
+ {
655
+ result = Rubyang::Model::Status.new( val[1] )
656
+ }
657
+
658
+ "status-arg-str" : "string"
659
+ {
660
+ unless ['current', 'obsolete', 'deprecated'].include? val[0]
661
+ raise Racc::ParseError, "status-arg-str must be 'current' or 'obsolete' or 'deprecated', but '#{val[0]}'"
662
+ end
663
+ result = val[0]
664
+ }
665
+
666
+ "config-stmt" : "config-keyword" "config-arg-str" "stmtend"
667
+ {
668
+ result = Rubyang::Model::Config.new( val[1] )
669
+ }
670
+
671
+ "config-arg-str" : "string"
672
+ {
673
+ unless ['true', 'false'].include? val[0]
674
+ raise "config-arg-str must be 'true' or 'false'"
675
+ end
676
+ result = val[0]
677
+ }
678
+
679
+ "mandatory-stmt" : "mandatory-keyword" "mandatory-arg-str" "stmtend"
680
+ {
681
+ result = Rubyang::Model::Mandatory.new( val[1] )
682
+ }
683
+
684
+ "mandatory-arg-str" : "string"
685
+ {
686
+ unless ['true', 'false'].include? val[0]
687
+ raise "mandatory-arg-str must be 'true' or 'false'"
688
+ end
689
+ result = val[0]
690
+ }
691
+
692
+ "presence-stmt" : "presence-keyword" "string" "stmtend"
693
+ {
694
+ result = Rubyang::Model::Presence.new( val[1] )
695
+ }
696
+
697
+ "ordered-by-stmt" : "ordered-by-keyword" "ordered-by-arg-str" "stmtend"
698
+ {
699
+ result = Rubyang::Model::OrderedBy.new( val[1] )
700
+ }
701
+
702
+ "ordered-by-arg-str" : "string"
703
+ {
704
+ unless ['user', 'system'].include? val[0]
705
+ raise "ordered-by-arg-str must be 'user' or 'system'"
706
+ end
707
+ result = val[0]
708
+ }
709
+
710
+ "must-stmt" : "must-keyword" "string" ";"
711
+ {
712
+ result = Rubyang::Model::Must.new( val[1] )
713
+ }
714
+ | "must-keyword" "string" "{" "inner-must-stmts" "}"
715
+ {
716
+ substmts = val[3]
717
+ result = Rubyang::Model::Must.new( val[1], substmts )
718
+ }
719
+
720
+ "inner-must-stmts" : /* */
721
+ {
722
+ result = []
723
+ }
724
+ | "inner-must-stmts" "inner-must-stmt"
725
+ {
726
+ result = val[0] + [val[1]]
727
+ }
728
+
729
+ "inner-must-stmt" : "error-message-stmt"
730
+ | "error-app-tag-stmt"
731
+ | "description-stmt"
732
+ | "reference-stmt"
733
+
734
+ "error-message-stmt" : "error-message-keyword" "string" "stmtend"
735
+ {
736
+ result = Rubyang::Model::ErrorMessage.new( val[1] )
737
+ }
738
+
739
+ "error-app-tag-stmt" : "error-app-tag-keyword" "string" "stmtend"
740
+ {
741
+ result = Rubyang::Model::ErrorAppTag.new( val[1] )
742
+ }
743
+
744
+ "min-elements-stmt" : "min-elements-keyword" "min-value-arg-str" "stmtend"
745
+ {
746
+ result = Rubyang::Model::MinElements.new( val[1] )
747
+ }
748
+
749
+ "min-value-arg-str" : "string"
750
+ {
751
+ unless /^[0-9]+$/ =~ val[0]
752
+ raise "min-value-arg-str must be non-negative-integer-value"
753
+ end
754
+ result = val[0]
755
+ }
756
+
757
+ "max-elements-stmt" : "max-elements-keyword" "max-value-arg-str" "stmtend"
758
+ {
759
+ result = Rubyang::Model::MaxElements.new( val[1] )
760
+ }
761
+
762
+ "max-value-arg-str" : "string"
763
+ {
764
+ unless /^(unbounded|[0-9]+)$/ =~ val[0]
765
+ raise "max-value-arg-str must be 'unbounded' or non-negative-integer-value"
766
+ end
767
+ result = val[0]
768
+ }
769
+
770
+ "value-stmt" : "value-keyword" "integer-value" "stmtend"
771
+ {
772
+ result = Rubyang::Model::Value.new( val[1] )
773
+ }
774
+
775
+ "grouping-stmt" : "grouping-keyword" "identifier-arg-str" ";"
776
+ {
777
+ result = Rubyang::Model::Grouping.new( val[1] )
778
+ }
779
+ | "grouping-keyword" "identifier-arg-str" "{" "inner-grouping-stmts" "}"
780
+ {
781
+ substmts = val[3]
782
+ result = Rubyang::Model::Grouping.new( val[1], substmts )
783
+ }
784
+
785
+ "inner-grouping-stmts" : /* */
786
+ {
787
+ result = []
788
+ }
789
+ | "inner-grouping-stmts" "inner-grouping-stmt"
790
+ {
791
+ result = val[0] + [val[1]]
792
+ }
793
+
794
+ "inner-grouping-stmt" : "status-stmt"
795
+ | "description-stmt"
796
+ | "reference-stmt"
797
+ | "typedef-stmt"
798
+ | "grouping-stmt"
799
+ | "data-def-stmt"
800
+
801
+ "container-stmt" : "container-keyword" "identifier-arg-str" ";"
802
+ {
803
+ result = Rubyang::Model::Container.new( val[1] )
804
+ }
805
+ | "container-keyword" "identifier-arg-str" "{" "inner-container-stmts" "}"
806
+ {
807
+ substmts = val[3]
808
+ result = Rubyang::Model::Container.new( val[1], substmts )
809
+ }
810
+
811
+ "inner-container-stmts" : /* */
812
+ {
813
+ result = []
814
+ }
815
+ | "inner-container-stmts" "inner-container-stmt"
816
+ {
817
+ result = val[0] + [val[1]]
818
+ }
819
+
820
+ "inner-container-stmt" : "when-stmt"
821
+ | "if-feature-stmt"
822
+ | "must-stmt"
823
+ | "presence-stmt"
824
+ | "config-stmt"
825
+ | "status-stmt"
826
+ | "description-stmt"
827
+ | "reference-stmt"
828
+ | "typedef-stmt"
829
+ | "grouping-stmt"
830
+ | "data-def-stmt"
831
+
832
+ "leaf-stmt" : "leaf-keyword" "identifier-arg-str" "{" "inner-leaf-stmts" "}"
833
+ {
834
+ substmts = val[3]
835
+ result = Rubyang::Model::Leaf.new( val[1], substmts )
836
+ }
837
+
838
+ "inner-leaf-stmts" : /* */
839
+ {
840
+ result = []
841
+ }
842
+ | "inner-leaf-stmts" "inner-leaf-stmt"
843
+ {
844
+ result = val[0] + [val[1]]
845
+ }
846
+
847
+ "inner-leaf-stmt" : "when-stmt"
848
+ | "if-feature-stmt"
849
+ | "type-stmt"
850
+ | "units-stmt"
851
+ | "must-stmt"
852
+ | "default-stmt"
853
+ | "config-stmt"
854
+ | "mandatory-stmt"
855
+ | "status-stmt"
856
+ | "description-stmt"
857
+ | "reference-stmt"
858
+
859
+ "leaf-list-stmt" : "leaf-list-keyword" "identifier-arg-str" "{" "inner-leaf-list-stmts" "}"
860
+ {
861
+ substmts = val[3]
862
+ result = Rubyang::Model::LeafList.new( val[1], substmts )
863
+ }
864
+
865
+ "inner-leaf-list-stmts" : /* */
866
+ {
867
+ result = []
868
+ }
869
+ | "inner-leaf-list-stmts" "inner-leaf-list-stmt"
870
+ {
871
+ result = val[0] + [val[1]]
872
+ }
873
+
874
+ "inner-leaf-list-stmt" : "when-stmt"
875
+ | "if-feature-stmt"
876
+ | "type-stmt"
877
+ | "units-stmt"
878
+ | "must-stmt"
879
+ | "config-stmt"
880
+ | "min-elements-stmt"
881
+ | "max-elements-stmt"
882
+ | "ordered-by-stmt"
883
+ | "status-stmt"
884
+ | "description-stmt"
885
+ | "reference-stmt"
886
+
887
+ "list-stmt" : "list-keyword" "identifier-arg-str" "{" "inner-list-stmts" "}"
888
+ {
889
+ substmts = val[3]
890
+ result = Rubyang::Model::List.new( val[1], substmts )
891
+ }
892
+
893
+ "inner-list-stmts" : /* */
894
+ {
895
+ result = []
896
+ }
897
+ | "inner-list-stmts" "inner-list-stmt"
898
+ {
899
+ result = val[0] + [val[1]]
900
+ }
901
+
902
+ "inner-list-stmt" : "when-stmt"
903
+ | "if-feature-stmt"
904
+ | "must-stmt"
905
+ | "key-stmt"
906
+ | "unique-stmt"
907
+ | "config-stmt"
908
+ | "min-elements-stmt"
909
+ | "max-elements-stmt"
910
+ | "ordered-by-stmt"
911
+ | "status-stmt"
912
+ | "description-stmt"
913
+ | "reference-stmt"
914
+ | "typedef-stmt"
915
+ | "grouping-stmt"
916
+ | "data-def-stmt"
917
+
918
+ "key-stmt" : "key-keyword" "key-arg-str" "stmtend"
919
+ {
920
+ result = Rubyang::Model::Key.new( val[1] )
921
+ }
922
+
923
+ "key-arg-str" : "string"
924
+ {
925
+ unless /^(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*(\s+(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*)*$/ =~ val[0]
926
+ raise ParseError, "bad key-arg-str"
927
+ end
928
+ result = val[0]
929
+ }
930
+
931
+ "unique-stmt" : "unique-keyword" "unique-arg-str" "stmtend"
932
+ {
933
+ result = Rubyang::Model::Unique.new( val[1] )
934
+ }
935
+
936
+ "unique-arg-str" : "unique-arg"
937
+
938
+ "unique-arg" : "descendant-schema-nodeid"
939
+ | "unique-arg" "descendant-schema-nodeid"
940
+ {
941
+ result = val[0] + val[1]
942
+ }
943
+
944
+ "choice-stmt" : "choice-keyword" "identifier-arg-str" ";"
945
+ {
946
+ result = Rubyang::Model::Choice.new( val[1] )
947
+ }
948
+ | "choice-keyword" "identifier-arg-str" "{" "inner-choice-stmts" "}"
949
+ {
950
+ substmts = val[3]
951
+ result = Rubyang::Model::Choice.new( val[1], substmts )
952
+ }
953
+
954
+ "inner-choice-stmts" : /* */
955
+ {
956
+ result = []
957
+ }
958
+ | "inner-choice-stmts" "inner-choice-stmt"
959
+ {
960
+ result = val[0] + [val[1]]
961
+ }
962
+
963
+ "inner-choice-stmt" : "when-stmt"
964
+ | "if-feature-stmt"
965
+ | "default-stmt"
966
+ | "config-stmt"
967
+ | "mandatory-stmt"
968
+ | "status-stmt"
969
+ | "description-stmt"
970
+ | "reference-stmt"
971
+ | "short-case-stmt"
972
+ | "case-stmt"
973
+
974
+ "short-case-stmt" : "container-stmt"
975
+ | "leaf-stmt"
976
+ | "leaf-list-stmt"
977
+ | "list-stmt"
978
+ | "anyxml-stmt"
979
+
980
+ "case-stmt" : "case-keyword" "identifier-arg-str" ";"
981
+ {
982
+ result = Rubyang::Model::Case.new( val[1] )
983
+ }
984
+ | "case-keyword" "identifier-arg-str" "{" "inner-case-stmts" "}"
985
+ {
986
+ substmts = val[3]
987
+ result = Rubyang::Model::Case.new( val[1], substmts )
988
+ }
989
+
990
+ "inner-case-stmts" : /* */
991
+ {
992
+ result = []
993
+ }
994
+ | "inner-case-stmts" "inner-case-stmt"
995
+ {
996
+ result = val[0] + [val[1]]
997
+ }
998
+
999
+ "inner-case-stmt" : "when-stmt"
1000
+ | "if-feature-stmt"
1001
+ | "status-stmt"
1002
+ | "description-stmt"
1003
+ | "reference-stmt"
1004
+ | "data-def-stmt"
1005
+
1006
+ "anyxml-stmt" : "anyxml-keyword" "identifier-arg-str" ";"
1007
+ {
1008
+ result = Rubyang::Model::Anyxml.new( val[1] )
1009
+ }
1010
+ | "anyxml-keyword" "identifier-arg-str" "{" "inner-anyxml-stmts" "}"
1011
+ {
1012
+ substmts = val[3]
1013
+ result = Rubyang::Model::Anyxml.new( val[1], substmts )
1014
+ }
1015
+
1016
+ "inner-anyxml-stmts" : /* */
1017
+ {
1018
+ result = []
1019
+ }
1020
+ | "inner-anyxml-stmts" "inner-anyxml-stmt"
1021
+ {
1022
+ result = val[0] + [val[1]]
1023
+ }
1024
+
1025
+ "inner-anyxml-stmt" : "when-stmt"
1026
+ | "if-feature-stmt"
1027
+ | "must-stmt"
1028
+ | "config-stmt"
1029
+ | "mandatory-stmt"
1030
+ | "status-stmt"
1031
+ | "description-stmt"
1032
+ | "reference-stmt"
1033
+
1034
+ "uses-stmt" : "uses-keyword" "identifier-ref-arg-str" ";"
1035
+ {
1036
+ result = Rubyang::Model::Uses.new( val[1] )
1037
+ }
1038
+ | "uses-keyword" "identifier-ref-arg-str" "{" "inner-uses-stmts" "}"
1039
+ {
1040
+ substmts = val[3]
1041
+ result = Rubyang::Model::Uses.new( val[1], substmts )
1042
+ }
1043
+
1044
+ "inner-uses-stmts" : /* */
1045
+ {
1046
+ result = []
1047
+ }
1048
+ | "inner-uses-stmts" "inner-uses-stmt"
1049
+ {
1050
+ result = val[0] + [val[1]]
1051
+ }
1052
+
1053
+ "inner-uses-stmt" : "when-stmt"
1054
+ | "if-feature-stmt"
1055
+ | "status-stmt"
1056
+ | "description-stmt"
1057
+ | "reference-stmt"
1058
+ | "refine-stmt"
1059
+ | "uses-augment-stmt"
1060
+
1061
+ "refine-stmt" : "refine-keyword" "refine-arg-str" ";"
1062
+ {
1063
+ result = Rubyang::Model::Refine.new( val[1] )
1064
+ }
1065
+ | "refine-keyword" "refine-arg-str" "{" "inner-refine-stmts" "}"
1066
+ {
1067
+ substmts = val[3]
1068
+ result = Rubyang::Model::Refine.new( val[1], substmts )
1069
+ }
1070
+
1071
+ "inner-refine-stmts" : /* */
1072
+ {
1073
+ result = []
1074
+ }
1075
+ | "inner-refine-stmts" "inner-refine-stmt"
1076
+ {
1077
+ result = val[0] + [val[1]]
1078
+ }
1079
+
1080
+ "inner-refine-stmt" : "must-stmt"
1081
+ | "presence-stmt"
1082
+ | "config-stmt"
1083
+ | "description-stmt"
1084
+ | "reference-stmt"
1085
+ | "default-stmt"
1086
+ | "mandatory-stmt"
1087
+ | "min-elements-stmt"
1088
+ | "max-elements-stmt"
1089
+
1090
+ "refine-arg-str" : "refine-arg"
1091
+
1092
+ "refine-arg" : "descendant-schema-nodeid"
1093
+
1094
+ "uses-augment-stmt" : "augment-keyword" "uses-augment-arg-str" "{" "inner-uses-augment-stmts" "}"
1095
+ {
1096
+ substmts = val[3]
1097
+ result = Rubyang::Model::Augment.new( val[1], substmts )
1098
+ }
1099
+
1100
+ "inner-uses-augment-stmts" : /* */
1101
+ {
1102
+ result = []
1103
+ }
1104
+ | "inner-uses-augment-stmts" "inner-uses-augment-stmt"
1105
+ {
1106
+ result = val[0] + [val[1]]
1107
+ }
1108
+
1109
+ "inner-uses-augment-stmt" : "when-stmt"
1110
+ | "if-feature-stmt"
1111
+ | "status-stmt"
1112
+ | "description-stmt"
1113
+ | "reference-stmt"
1114
+ | "data-def-stmt"
1115
+ | "case-stmt"
1116
+
1117
+ "uses-augment-arg-str" : "uses-augment-arg"
1118
+
1119
+ "uses-augment-arg" : "descendant-schema-nodeid"
1120
+
1121
+ "augment-stmt" : "augment-keyword" "augment-arg-str" "{" "inner-augment-stmts" "}"
1122
+ {
1123
+ substmts = val[3]
1124
+ result = Rubyang::Model::Augment.new( val[1], substmts )
1125
+ }
1126
+
1127
+ "inner-augment-stmts" : /* */
1128
+ {
1129
+ result = []
1130
+ }
1131
+ | "inner-augment-stmts" "inner-augment-stmt"
1132
+ {
1133
+ result = val[0] + [val[1]]
1134
+ }
1135
+
1136
+ "inner-augment-stmt" : "when-stmt"
1137
+ | "if-feature-stmt"
1138
+ | "status-stmt"
1139
+ | "description-stmt"
1140
+ | "reference-stmt"
1141
+ | "data-def-stmt"
1142
+ | "case-stmt"
1143
+
1144
+ "augment-arg-str" : "augment-arg"
1145
+
1146
+ "augment-arg" : "absolute-schema-nodeid"
1147
+
1148
+ "unknown-statement" : "prefixed-node-identifier" "unknown-string" ";"
1149
+ | "prefixed-node-identifier" "unknown-string" "{" "unknown-statements2" "}"
1150
+
1151
+ "unknown-statement2" : "node-identifier" "unknown-string" ";"
1152
+ | "node-identifier" "unknown-string" "{" "unknown-statements2" "}"
1153
+
1154
+ "unknown-string" : /* */
1155
+ | "string"
1156
+
1157
+ "unknown-statements2" : /* */
1158
+ | "unknown-statements2" "unknown-statement2"
1159
+
1160
+ "when-stmt" : "when-keyword" "string" ";"
1161
+ {
1162
+ result = Rubyang::Model::When.new( val[1] )
1163
+ }
1164
+ | "when-keyword" "string" "{" "inner-when-stmts" "}"
1165
+ {
1166
+ substmts = val[3]
1167
+ result = Rubyang::Model::When.new( val[1], substmts )
1168
+ }
1169
+
1170
+ "inner-when-stmts" : /* */
1171
+ {
1172
+ result = []
1173
+ }
1174
+ | "inner-when-stmts" "inner-when-stmt"
1175
+ {
1176
+ result = val[0] + [val[1]]
1177
+ }
1178
+
1179
+ "inner-when-stmt" : "description-stmt"
1180
+ | "reference-stmt"
1181
+
1182
+ "rpc-stmt" : "rpc-keyword" "identifier-arg-str" ";"
1183
+ {
1184
+ result = Rubyang::Model::Rpc.new( val[1] )
1185
+ }
1186
+ | "rpc-keyword" "identifier-arg-str" "{" "inner-rpc-stmts" "}"
1187
+ {
1188
+ substmts = val[3]
1189
+ result = Rubyang::Model::Rpc.new( val[1], substmts )
1190
+ }
1191
+
1192
+ "inner-rpc-stmts" : /* */
1193
+ {
1194
+ result = []
1195
+ }
1196
+ | "inner-rpc-stmts" "inner-rpc-stmt"
1197
+ {
1198
+ result = val[0] + [val[1]]
1199
+ }
1200
+
1201
+ "inner-rpc-stmt" : "if-feature-stmt"
1202
+ | "status-stmt"
1203
+ | "description-stmt"
1204
+ | "reference-stmt"
1205
+ | "typedef-stmt"
1206
+ | "grouping-stmt"
1207
+ | "input-stmt"
1208
+ | "output-stmt"
1209
+
1210
+ "input-stmt" : "input-keyword" "{" "inner-input-stmts" "}"
1211
+ {
1212
+ substmts = val[2]
1213
+ result = Rubyang::Model::Input.new( substmts )
1214
+ }
1215
+
1216
+ "inner-input-stmts" : /* */
1217
+ {
1218
+ result = []
1219
+ }
1220
+ | "inner-input-stmts" "inner-input-stmt"
1221
+ {
1222
+ result = val[0] + [val[1]]
1223
+ }
1224
+
1225
+ "inner-input-stmt" : "typedef-stmt"
1226
+ | "grouping-stmt"
1227
+ | "data-def-stmt"
1228
+
1229
+ "output-stmt" : "output-keyword" "{" "inner-output-stmts" "}"
1230
+ {
1231
+ substmts = val[2]
1232
+ result = Rubyang::Model::Output.new( substmts )
1233
+ }
1234
+
1235
+ "inner-output-stmts" : /* */
1236
+ {
1237
+ result = []
1238
+ }
1239
+ | "inner-output-stmts" "inner-output-stmt"
1240
+ {
1241
+ result = val[0] + [val[1]]
1242
+ }
1243
+
1244
+ "inner-output-stmt" : "typedef-stmt"
1245
+ | "grouping-stmt"
1246
+ | "data-def-stmt"
1247
+
1248
+ "notification-stmt" : "notification-keyword" "identifier-arg-str" ";"
1249
+ {
1250
+ result = Rubyang::Model::Notification.new( val[1] )
1251
+ }
1252
+ | "notification-keyword" "identifier-arg-str" "{" "inner-notification-stmts" "}"
1253
+ {
1254
+ substmts = val[3]
1255
+ result = Rubyang::Model::Notification.new( val[1], substmts )
1256
+ }
1257
+
1258
+ "inner-notification-stmts" : /* */
1259
+ {
1260
+ result = []
1261
+ }
1262
+ | "inner-notification-stmts" "inner-notification-stmt"
1263
+ {
1264
+ result = val[0] + [val[1]]
1265
+ }
1266
+
1267
+ "inner-notification-stmt" : "if-feature-stmt"
1268
+ | "status-stmt"
1269
+ | "description-stmt"
1270
+ | "reference-stmt"
1271
+ | "typedef-stmt"
1272
+ | "grouping-stmt"
1273
+ | "data-def-stmt"
1274
+
1275
+ "deviation-stmt" : "deviation-keyword" "deviation-arg-str" ";"
1276
+ {
1277
+ result = Rubyang::Model::Deviation.new( val[1] )
1278
+ }
1279
+ | "deviation-keyword" "deviation-arg-str" "{" "inner-deviation-stmts" "}"
1280
+ {
1281
+ substmts = val[3]
1282
+ result = Rubyang::Model::Deviation.new( val[1], substmts )
1283
+ }
1284
+
1285
+ "inner-deviation-stmts" : /* */
1286
+ {
1287
+ result = []
1288
+ }
1289
+ | "inner-deviation-stmts" "inner-deviation-stmt"
1290
+ {
1291
+ result = val[0] + [val[1]]
1292
+ }
1293
+
1294
+ "inner-deviation-stmt" : "description-stmt"
1295
+ | "reference-stmt"
1296
+ | "typedef-stmt"
1297
+ | "deviate-stmt"
1298
+ #| "deviate-not-supported-stmt"
1299
+ #| "deviate-add-stmt"
1300
+ #| "deviate-replace-stmt"
1301
+ #| "deviate-delete-stmt"
1302
+
1303
+ "deviation-arg-str" : "deviation-arg"
1304
+
1305
+ "deviation-arg" : "absolute-schema-nodeid"
1306
+
1307
+ "deviate-stmt" : "deviate-keyword" "deviate-arg-str" ";"
1308
+ {
1309
+ result = Rubyang::Model::Deviate.new( val[1] )
1310
+ }
1311
+ | "deviate-keyword" "deviate-arg-str" "{" "inner-deviate-stmts" "}"
1312
+ {
1313
+ substmts = val[3]
1314
+ result = Rubyang::Model::Deviate.new( val[1], substmts )
1315
+ }
1316
+
1317
+ "inner-deviate-stmts" : /* */
1318
+ {
1319
+ result = []
1320
+ }
1321
+ | "inner-deviate-stmts" "inner-deviate-stmt"
1322
+ {
1323
+ result = val[0] + [val[1]]
1324
+ }
1325
+
1326
+ "inner-deviate-stmt" : "units-stmt"
1327
+ | "must-stmt"
1328
+ | "unique-stmt"
1329
+ | "default-stmt"
1330
+ | "config-stmt"
1331
+ | "mandatory-stmt"
1332
+ | "min-elements-stmt"
1333
+ | "max-elements-stmt"
1334
+ | "type-stmt"
1335
+
1336
+ "deviate-arg-str" : "string"
1337
+ {
1338
+ unless ['not-supported', 'add', 'replace', 'delete'].include? val[0]
1339
+ raise "deviate statement's argument must be 'not-supported' or 'add' or 'replace' or 'delete', but '#{val[0]}'"
1340
+ end
1341
+ result = val[0]
1342
+ }
1343
+
1344
+ "range-arg-str" : "string"
1345
+ {
1346
+ unless /^(min|max|[+-]?[0-9]+(\.[0-9]+)*)(\s*\.\.\s*(min|max|[+-]?[0-9]+(\.[0-9]+)*))*(\s*\|\s*(min|max|[+-]?[0-9]+(\.[0-9]+)*)(\s*\.\.\s*(min|max|[+-]?[0-9]+(\.[0-9]+)*))*)*$/ =~ val[0]
1347
+ raise "bad range-arg-str, but '#{val[0]}"
1348
+ end
1349
+ result = val[0]
1350
+ }
1351
+
1352
+ "length-arg-str" : "string"
1353
+ {
1354
+ unless /^(min|max|[+]?[0-9]+)(\s*\.\.\s*(min|max|[+]?[0-9]+))*(\s*\|\s*(min|max|[+]?[0-9]+)(\s*\.\.\s*(min|max|[+]?[0-9]+))*)*$/ =~ val[0]
1355
+ raise "bad length-arg-str, but '#{val[0]}'"
1356
+ end
1357
+ result = val[0]
1358
+ }
1359
+
1360
+ "date-arg-str" : "string"
1361
+ {
1362
+ unless /^\d\d\d\d-\d\d-\d\d$/ =~ val[0]
1363
+ raise ParseError, "bad date-arg-str"
1364
+ end
1365
+ result = val[0]
1366
+ }
1367
+
1368
+ "absolute-schema-nodeid" : "string"
1369
+ {
1370
+ unless /^\/(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*(\/(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*)*$/ =~ val[0]
1371
+ raise ParseError, "bad absolute-schema-nodeid"
1372
+ end
1373
+ result = val[0]
1374
+ }
1375
+
1376
+ "descendant-schema-nodeid" : "string"
1377
+ {
1378
+ unless /^(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*(\/(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*)*$/ =~ val[0]
1379
+ raise ParseError, "bad absolute-schema-nodeid"
1380
+ end
1381
+ result = val[0]
1382
+ }
1383
+
1384
+ "node-identifier" : "string"
1385
+ {
1386
+ unless /^(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*/ =~ val[0]
1387
+ raise ParseError, "bad identifier"
1388
+ end
1389
+ result = val[0]
1390
+ }
1391
+
1392
+ "prefixed-node-identifier" : "string"
1393
+ {
1394
+ unless /^([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:([a-zA-Z]|_)[a-zA-Z0-9_\.-]*/ =~ val[0]
1395
+ raise ParseError, "bad prefix:identifier"
1396
+ end
1397
+ result = val[0]
1398
+ }
1399
+
1400
+ "path-arg-str" : "string"
1401
+ {
1402
+ unless /^(\/(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*(\[\s*(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*\s*=\s*current\s*\(\s*\)\s*\/\s*(\.\.\s*\/\s*)+((([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*\s*\/\s*)*(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*\s*\])*)+$/ =~ val[0] || /^(\.\.\/)+(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*((\[\s*(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*\s*=\s*current\s*\(\s*\)\s*\/\s*(\.\.\s*\/\s*)+((([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*\s*\/\s*)*(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*\s*\])*(\/(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*(\[\s*(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*\s*=\s*current\s*\(\s*\)\s*\/\s*(\.\.\s*\/\s*)+((([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*\s*\/\s*)*(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*\s*\])*)+)?$/ =~ val[0]
1403
+ raise ParseError, "bad path-arg-str, but '#{val[0]}'"
1404
+ end
1405
+ result = val[0]
1406
+ }
1407
+
1408
+ "prefix-arg-str" : "prefix-arg"
1409
+
1410
+ "prefix-arg" : "prefix"
1411
+
1412
+ "prefix" : "identifier"
1413
+
1414
+ "identifier-arg-str" : "identifier-arg"
1415
+
1416
+ "identifier-arg" : "identifier"
1417
+
1418
+ "identifier" : "string"
1419
+ {
1420
+ unless /^([a-zA-Z]|_)[a-zA-Z0-9_\.-]*$/ =~ val[0]
1421
+ raise ParseError, "bad identifier-arg-str"
1422
+ end
1423
+ result = val[0]
1424
+ }
1425
+
1426
+ "identifier-ref-arg-str" : "string"
1427
+ {
1428
+ unless /^(([a-zA-Z]|_)[a-zA-Z0-9_\.-]*:)?([a-zA-Z]|_)[a-zA-Z0-9_\.-]*$/ =~ val[0]
1429
+ raise ParseError, "bad identifier-ref-arg-str"
1430
+ end
1431
+ result = val[0]
1432
+ }
1433
+
1434
+ "integer-value" : "string"
1435
+ {
1436
+ unless /^[1-9][0-9]*$/ =~ val[0]
1437
+ raise ParseError, "bad integer-value, but '#{val[0]}'"
1438
+ end
1439
+ result = val[0]
1440
+ }
1441
+
1442
+ "string" : STRING
1443
+ | "string" "+" STRING
1444
+ {
1445
+ result = val[0] + val[1]
1446
+ }
1447
+
1448
+ "stmtend" : ";"
1449
+ | "{" "unknown-statements" "}"
1450
+
1451
+ "unknown-statements" : /* */
1452
+ | "unknown-statements" "unknown-statement"
1453
+ end
1454
+