rubyang 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.travis.yml +13 -2
- data/README.md +2 -3
- data/lib/rubyang/database/data_tree.rb +494 -130
- data/lib/rubyang/database/schema_tree.rb +541 -293
- data/lib/rubyang/database.rb +10 -0
- data/lib/rubyang/logger.rb +19 -0
- data/lib/rubyang/model/parser/parser.tab.rb +919 -901
- data/lib/rubyang/model/parser/parser.y +9 -1
- data/lib/rubyang/model/parser.rb +48 -18
- data/lib/rubyang/model.rb +16 -1
- data/lib/rubyang/version.rb +1 -1
- data/lib/rubyang/xpath/parser/parser.tab.rb +561 -548
- data/lib/rubyang/xpath/parser/parser.y +74 -78
- data/lib/rubyang/xpath/parser.rb +12 -2
- data/lib/rubyang/xpath.rb +342 -105
- data/lib/rubyang.rb +1 -0
- data/rubyang.gemspec +2 -2
- metadata +8 -7
@@ -1,13 +1,13 @@
|
|
1
1
|
class Rubyang::Xpath::Parser
|
2
2
|
|
3
3
|
rule
|
4
|
-
statement : "
|
4
|
+
statement : "Expr"
|
5
5
|
{
|
6
6
|
if Rubyang::Xpath::Parser::DEBUG
|
7
|
-
puts 'statement :
|
7
|
+
puts 'statement : Expr'
|
8
8
|
puts "val: #{val.inspect}"
|
9
9
|
end
|
10
|
-
result = val[0]
|
10
|
+
result = Rubyang::Xpath::Expr.new val[0]
|
11
11
|
}
|
12
12
|
|
13
13
|
"LocationPath" : "RelativeLocationPath"
|
@@ -37,7 +37,7 @@ rule
|
|
37
37
|
node_test = Rubyang::Xpath::NodeTest.new Rubyang::Xpath::NodeTest::NodeTestType::NAME_TEST, '/'
|
38
38
|
predicates = Rubyang::Xpath::Predicates.new
|
39
39
|
location_step = Rubyang::Xpath::LocationStep.new axis, node_test, predicates
|
40
|
-
result = Rubyang::Xpath::
|
40
|
+
result = Rubyang::Xpath::LocationPath.new location_step
|
41
41
|
}
|
42
42
|
| "/" "RelativeLocationPath"
|
43
43
|
{
|
@@ -49,10 +49,7 @@ rule
|
|
49
49
|
node_test = Rubyang::Xpath::NodeTest.new Rubyang::Xpath::NodeTest::NodeTestType::NAME_TEST, '/'
|
50
50
|
predicates = Rubyang::Xpath::Predicates.new
|
51
51
|
location_step = Rubyang::Xpath::LocationStep.new axis, node_test, predicates
|
52
|
-
|
53
|
-
location_steps.push location_step
|
54
|
-
location_steps.push *val[1]
|
55
|
-
result = Rubyang::Xpath::LocationSteps.new *location_steps
|
52
|
+
result = Rubyang::Xpath::LocationPath.new location_step, *(val[1].location_step_sequence)
|
56
53
|
}
|
57
54
|
| "AbbreviatedAbsoluteLocationPath"
|
58
55
|
{
|
@@ -69,7 +66,7 @@ rule
|
|
69
66
|
puts '"RelativeLocationPath" : "Step"'
|
70
67
|
puts "val: #{val.inspect}"
|
71
68
|
end
|
72
|
-
result = Rubyang::Xpath::
|
69
|
+
result = Rubyang::Xpath::LocationPath.new val[0]
|
73
70
|
}
|
74
71
|
| "RelativeLocationPath" "/" "Step"
|
75
72
|
{
|
@@ -77,7 +74,7 @@ rule
|
|
77
74
|
puts '"RelativeLocationPath" : "RelativeLocationPath" "/" "Step"'
|
78
75
|
puts "val: #{val.inspect}"
|
79
76
|
end
|
80
|
-
result = val[0].
|
77
|
+
result = val[0].add val[2]
|
81
78
|
}
|
82
79
|
| "AbbreviatedRelativeLocationPath"
|
83
80
|
{
|
@@ -129,7 +126,7 @@ rule
|
|
129
126
|
| "Predicates" "Predicate"
|
130
127
|
{
|
131
128
|
if Rubyang::Xpath::Parser::DEBUG
|
132
|
-
puts '"Predicates" : "Predicates"
|
129
|
+
puts '"Predicates" : "Predicates" "Predicate"'
|
133
130
|
puts "val: #{val.inspect}"
|
134
131
|
end
|
135
132
|
result = val[0].push val[1]
|
@@ -274,7 +271,7 @@ rule
|
|
274
271
|
puts '"Predicate" : "[" "PredicateExpr" "]"'
|
275
272
|
puts "val: #{val.inspect}"
|
276
273
|
end
|
277
|
-
result = val[1]
|
274
|
+
result = Rubyang::Xpath::Predicate.new val[1]
|
278
275
|
}
|
279
276
|
|
280
277
|
"PredicateExpr" : "Expr"
|
@@ -283,7 +280,7 @@ rule
|
|
283
280
|
puts '"PredicateExpr" : "Expr"'
|
284
281
|
puts "val: #{val.inspect}"
|
285
282
|
end
|
286
|
-
result =
|
283
|
+
result = val[0]
|
287
284
|
}
|
288
285
|
|
289
286
|
"AbbreviatedAbsoluteLocationPath" : "//" "RelativeLocationPath"
|
@@ -371,7 +368,6 @@ rule
|
|
371
368
|
puts "val: #{val.inspect}"
|
372
369
|
end
|
373
370
|
result = val[1]
|
374
|
-
raise "'(' Expr ')' is not implemented"
|
375
371
|
}
|
376
372
|
| "Literal"
|
377
373
|
{
|
@@ -379,8 +375,8 @@ rule
|
|
379
375
|
puts '"PrimaryExpr" : "Literal"'
|
380
376
|
puts "val: #{val.inspect}"
|
381
377
|
end
|
382
|
-
literal = Rubyang::Xpath::
|
383
|
-
result = Rubyang::Xpath::
|
378
|
+
literal = Rubyang::Xpath::Literal.new val[0]
|
379
|
+
result = Rubyang::Xpath::PrimaryExpr.new literal
|
384
380
|
}
|
385
381
|
| "Number"
|
386
382
|
{
|
@@ -388,8 +384,8 @@ rule
|
|
388
384
|
puts '"PrimaryExpr" : "Number"'
|
389
385
|
puts "val: #{val.inspect}"
|
390
386
|
end
|
391
|
-
number = Rubyang::Xpath::
|
392
|
-
result = Rubyang::Xpath::
|
387
|
+
number = Rubyang::Xpath::Number.new val[0]
|
388
|
+
result = Rubyang::Xpath::PrimaryExpr.new number
|
393
389
|
}
|
394
390
|
| "FunctionCall"
|
395
391
|
{
|
@@ -397,7 +393,7 @@ rule
|
|
397
393
|
puts '"PrimaryExpr" : "FunctionCall"'
|
398
394
|
puts "val: #{val.inspect}"
|
399
395
|
end
|
400
|
-
result = Rubyang::Xpath::
|
396
|
+
result = Rubyang::Xpath::PrimaryExpr.new val[0]
|
401
397
|
}
|
402
398
|
|
403
399
|
"FunctionCall" : "FunctionName(" ")"
|
@@ -406,7 +402,7 @@ rule
|
|
406
402
|
puts '"FunctionCall" : "FunctionName(" ")"'
|
407
403
|
puts "val: #{val.inspect}"
|
408
404
|
end
|
409
|
-
result = Rubyang::Xpath::
|
405
|
+
result = Rubyang::Xpath::FunctionCall.new val[0]
|
410
406
|
}
|
411
407
|
| "FunctionName(" "Arguments" ")"
|
412
408
|
{
|
@@ -414,7 +410,7 @@ rule
|
|
414
410
|
puts '"FunctionCall" : "FunctionName(" "Arguments" ")"'
|
415
411
|
puts "val: #{val.inspect}"
|
416
412
|
end
|
417
|
-
result = Rubyang::Xpath::
|
413
|
+
result = Rubyang::Xpath::FunctionCall.new val[0], val[1]
|
418
414
|
}
|
419
415
|
|
420
416
|
"Arguments" : "Argument"
|
@@ -449,7 +445,7 @@ rule
|
|
449
445
|
puts '"UnionExpr" : "PathExpr"'
|
450
446
|
puts "val: #{val.inspect}"
|
451
447
|
end
|
452
|
-
result = Rubyang::Xpath::
|
448
|
+
result = Rubyang::Xpath::UnionExpr.new val[0]
|
453
449
|
}
|
454
450
|
| "UnionExpr" "|" "PathExpr"
|
455
451
|
{
|
@@ -457,7 +453,7 @@ rule
|
|
457
453
|
puts '"UnionExpr" : "UnionExpr" "|" "PathExpr"'
|
458
454
|
puts "val: #{val.inspect}"
|
459
455
|
end
|
460
|
-
result = Rubyang::Xpath::
|
456
|
+
result = Rubyang::Xpath::UnionExpr.new val[0], val[1], val[2]
|
461
457
|
}
|
462
458
|
|
463
459
|
"PathExpr" : "LocationPath"
|
@@ -466,7 +462,7 @@ rule
|
|
466
462
|
puts '"PathExpr" : "LocationPath"'
|
467
463
|
puts "val: #{val.inspect}"
|
468
464
|
end
|
469
|
-
result = Rubyang::Xpath::
|
465
|
+
result = Rubyang::Xpath::PathExpr.new val[0]
|
470
466
|
}
|
471
467
|
| "FilterExpr"
|
472
468
|
{
|
@@ -474,7 +470,7 @@ rule
|
|
474
470
|
puts '"PathExpr" : "FilterExpr"'
|
475
471
|
puts "val: #{val.inspect}"
|
476
472
|
end
|
477
|
-
result = Rubyang::Xpath::
|
473
|
+
result = Rubyang::Xpath::PathExpr.new val[0]
|
478
474
|
}
|
479
475
|
| "FilterExpr" "/" "RelativeLocationPath"
|
480
476
|
{
|
@@ -482,7 +478,7 @@ rule
|
|
482
478
|
puts '"PathExpr" : "FilterExpr" "/" "RelativeLocationPath"'
|
483
479
|
puts "val: #{val.inspect}"
|
484
480
|
end
|
485
|
-
result = Rubyang::Xpath::
|
481
|
+
result = Rubyang::Xpath::PathExpr.new val[0], val[1], val[2]
|
486
482
|
}
|
487
483
|
| "FilterExpr" "//" "RelativeLocationPath"
|
488
484
|
{
|
@@ -490,7 +486,7 @@ rule
|
|
490
486
|
puts '"PathExpr" : "FilterExpr" "//" "RelativeLocationPath"'
|
491
487
|
puts "val: #{val.inspect}"
|
492
488
|
end
|
493
|
-
result = Rubyang::Xpath::
|
489
|
+
result = Rubyang::Xpath::PathExpr.new val[0], val[1], val[2]
|
494
490
|
}
|
495
491
|
|
496
492
|
"FilterExpr" : "PrimaryExpr"
|
@@ -499,7 +495,7 @@ rule
|
|
499
495
|
puts '"FilterExpr" : "PrimaryExpr"'
|
500
496
|
puts "val: #{val.inspect}"
|
501
497
|
end
|
502
|
-
result = Rubyang::Xpath::
|
498
|
+
result = Rubyang::Xpath::FilterExpr.new val[0]
|
503
499
|
}
|
504
500
|
| "FilterExpr Predicat"
|
505
501
|
{
|
@@ -507,7 +503,7 @@ rule
|
|
507
503
|
puts '"FilterExpr" : "FilterExpr Predicat"'
|
508
504
|
puts "val: #{val.inspect}"
|
509
505
|
end
|
510
|
-
result = Rubyang::Xpath::
|
506
|
+
result = Rubyang::Xpath::FilterExpr.new val[0], val[1]
|
511
507
|
}
|
512
508
|
|
513
509
|
"OrExpr" : "AndExpr"
|
@@ -516,7 +512,7 @@ rule
|
|
516
512
|
puts '"OrExpr" : "AndExpr"'
|
517
513
|
puts "val: #{val.inspect}"
|
518
514
|
end
|
519
|
-
result = Rubyang::Xpath::
|
515
|
+
result = Rubyang::Xpath::OrExpr.new val[0]
|
520
516
|
}
|
521
517
|
| "OrExpr" "or" "AndExpr"
|
522
518
|
{
|
@@ -524,7 +520,7 @@ rule
|
|
524
520
|
puts '"OrExpr" : "OrExpr" "or" "AndExpr"'
|
525
521
|
puts "val: #{val.inspect}"
|
526
522
|
end
|
527
|
-
result = Rubyang::Xpath::
|
523
|
+
result = Rubyang::Xpath::OrExpr.new val[0], val[2]
|
528
524
|
}
|
529
525
|
|
530
526
|
"AndExpr" : "EqualityExpr"
|
@@ -533,7 +529,7 @@ rule
|
|
533
529
|
puts '"AndExpr" : "EqualityExpr"'
|
534
530
|
puts "val: #{val.inspect}"
|
535
531
|
end
|
536
|
-
result = Rubyang::Xpath::
|
532
|
+
result = Rubyang::Xpath::AndExpr.new val[0]
|
537
533
|
}
|
538
534
|
| "AndExpr" "and" "EqualityExpr"
|
539
535
|
{
|
@@ -541,7 +537,7 @@ rule
|
|
541
537
|
puts '"AndExpr" : "AndExpr" "and" "EqualityExpr"'
|
542
538
|
puts "val: #{val.inspect}"
|
543
539
|
end
|
544
|
-
result = Rubyang::Xpath::
|
540
|
+
result = Rubyang::Xpath::AndExpr.new val[0], val[2]
|
545
541
|
}
|
546
542
|
|
547
543
|
"EqualityExpr" : "RelationalExpr"
|
@@ -550,7 +546,7 @@ rule
|
|
550
546
|
puts '"EqualityExpr" : "RelationalExpr"'
|
551
547
|
puts "val: #{val.inspect}"
|
552
548
|
end
|
553
|
-
result = Rubyang::Xpath::
|
549
|
+
result = Rubyang::Xpath::EqualityExpr.new val[0]
|
554
550
|
}
|
555
551
|
| "EqualityExpr" "=" "RelationalExpr"
|
556
552
|
{
|
@@ -558,7 +554,7 @@ rule
|
|
558
554
|
puts '"EqualityExpr" : "EqualityExpr" "=" "RelationalExpr"'
|
559
555
|
puts "val: #{val.inspect}"
|
560
556
|
end
|
561
|
-
result = Rubyang::Xpath::
|
557
|
+
result = Rubyang::Xpath::EqualityExpr.new val[0], val[1], val[2]
|
562
558
|
}
|
563
559
|
| "EqualityExpr" "!=" "RelationalExpr"
|
564
560
|
{
|
@@ -566,7 +562,7 @@ rule
|
|
566
562
|
puts '"EqualityExpr" : "EqualityExpr" "!=" "RelationalExpr"'
|
567
563
|
puts "val: #{val.inspect}"
|
568
564
|
end
|
569
|
-
result = Rubyang::Xpath::
|
565
|
+
result = Rubyang::Xpath::EqualityExpr.new val[0], val[1], val[2]
|
570
566
|
}
|
571
567
|
|
572
568
|
"RelationalExpr" : "AdditiveExpr"
|
@@ -575,7 +571,7 @@ rule
|
|
575
571
|
puts '"RelationalExpr" : "AdditiveExpr"'
|
576
572
|
puts "val: #{val.inspect}"
|
577
573
|
end
|
578
|
-
result = Rubyang::Xpath::
|
574
|
+
result = Rubyang::Xpath::RelationalExpr.new val[0]
|
579
575
|
}
|
580
576
|
| "RelationalExpr" "<" "AdditiveExpr"
|
581
577
|
{
|
@@ -583,7 +579,7 @@ rule
|
|
583
579
|
puts '"RelationalExpr" : "RelationalExpr" "<" "AdditiveExpr"'
|
584
580
|
puts "val: #{val.inspect}"
|
585
581
|
end
|
586
|
-
result = Rubyang::Xpath::
|
582
|
+
result = Rubyang::Xpath::RelationalExpr.new val[0], val[1], val[2]
|
587
583
|
}
|
588
584
|
| "RelationalExpr" ">" "AdditiveExpr"
|
589
585
|
{
|
@@ -591,7 +587,7 @@ rule
|
|
591
587
|
puts '"RelationalExpr" : "RelationalExpr" ">" "AdditiveExpr"'
|
592
588
|
puts "val: #{val.inspect}"
|
593
589
|
end
|
594
|
-
result = Rubyang::Xpath::
|
590
|
+
result = Rubyang::Xpath::RelationalExpr.new val[0], val[1], val[2]
|
595
591
|
}
|
596
592
|
| "RelationalExpr" "<=" "AdditiveExpr"
|
597
593
|
{
|
@@ -599,7 +595,7 @@ rule
|
|
599
595
|
puts '"RelationalExpr" : "RelationalExpr" "<=" "AdditiveExpr"'
|
600
596
|
puts "val: #{val.inspect}"
|
601
597
|
end
|
602
|
-
result = Rubyang::Xpath::
|
598
|
+
result = Rubyang::Xpath::RelationalExpr.new val[0], val[1], val[2]
|
603
599
|
}
|
604
600
|
| "RelationalExpr" ">=" "AdditiveExpr"
|
605
601
|
{
|
@@ -607,7 +603,7 @@ rule
|
|
607
603
|
puts '"RelationalExpr" : "RelationalExpr" ">=" "AdditiveExpr"'
|
608
604
|
puts "val: #{val.inspect}"
|
609
605
|
end
|
610
|
-
result = Rubyang::Xpath::
|
606
|
+
result = Rubyang::Xpath::RelationalExpr.new val[0], val[1], val[2]
|
611
607
|
}
|
612
608
|
|
613
609
|
"AdditiveExpr" : "MultiplicativeExpr"
|
@@ -616,7 +612,7 @@ rule
|
|
616
612
|
puts '"AdditiveExpr" : "MultiplicativeExpr"'
|
617
613
|
puts "val: #{val.inspect}"
|
618
614
|
end
|
619
|
-
result = Rubyang::Xpath::
|
615
|
+
result = Rubyang::Xpath::AdditiveExpr.new val[0]
|
620
616
|
}
|
621
617
|
| "AdditiveExpr" "+" "MultiplicativeExpr"
|
622
618
|
{
|
@@ -624,7 +620,7 @@ rule
|
|
624
620
|
puts '"AdditiveExpr" : "AdditiveExpr" "+" "MultiplicativeExpr"'
|
625
621
|
puts "val: #{val.inspect}"
|
626
622
|
end
|
627
|
-
result = Rubyang::Xpath::
|
623
|
+
result = Rubyang::Xpath::AdditiveExpr.new val[0], val[1], val[2]
|
628
624
|
}
|
629
625
|
| "AdditiveExpr" "-" "MultiplicativeExpr"
|
630
626
|
{
|
@@ -632,7 +628,7 @@ rule
|
|
632
628
|
puts '"AdditiveExpr" : "AdditiveExpr" "-" "MultiplicativeExpr"'
|
633
629
|
puts "val: #{val.inspect}"
|
634
630
|
end
|
635
|
-
result = Rubyang::Xpath::
|
631
|
+
result = Rubyang::Xpath::AdditiveExpr.new val[0], val[1], val[2]
|
636
632
|
}
|
637
633
|
|
638
634
|
"MultiplicativeExpr" : "UnaryExpr"
|
@@ -641,7 +637,7 @@ rule
|
|
641
637
|
puts '"MultiplicativeExpr" : "UnaryExpr"'
|
642
638
|
puts "val: #{val.inspect}"
|
643
639
|
end
|
644
|
-
result = Rubyang::Xpath::
|
640
|
+
result = Rubyang::Xpath::MultiplicativeExpr.new val[0]
|
645
641
|
}
|
646
642
|
| "MultiplicativeExpr" "*" "UnaryExpr"
|
647
643
|
{
|
@@ -649,7 +645,7 @@ rule
|
|
649
645
|
puts '"MultiplicativeExpr" : "MultiplicativeExpr" "*" "UnaryExpr"'
|
650
646
|
puts "val: #{val.inspect}"
|
651
647
|
end
|
652
|
-
result = Rubyang::Xpath::
|
648
|
+
result = Rubyang::Xpath::MultiplicativeExpr.new val[0], val[1], val[2]
|
653
649
|
}
|
654
650
|
| "MultiplicativeExpr" "div" "UnaryExpr"
|
655
651
|
{
|
@@ -657,7 +653,7 @@ rule
|
|
657
653
|
puts '"MultiplicativeExpr" : "MultiplicativeExpr" "div" "UnaryExpr"'
|
658
654
|
puts "val: #{val.inspect}"
|
659
655
|
end
|
660
|
-
result = Rubyang::Xpath::
|
656
|
+
result = Rubyang::Xpath::MultiplicativeExpr.new val[0], val[1], val[2]
|
661
657
|
}
|
662
658
|
| "MultiplicativeExpr" "mod" "UnaryExpr"
|
663
659
|
{
|
@@ -665,7 +661,7 @@ rule
|
|
665
661
|
puts '"MultiplicativeExpr" : "MultiplicativeExpr" "mod" "UnaryExpr"'
|
666
662
|
puts "val: #{val.inspect}"
|
667
663
|
end
|
668
|
-
result = Rubyang::Xpath::
|
664
|
+
result = Rubyang::Xpath::MultiplicativeExpr.new val[0], val[1], val[2]
|
669
665
|
}
|
670
666
|
|
671
667
|
"UnaryExpr" : "UnionExpr"
|
@@ -674,7 +670,7 @@ rule
|
|
674
670
|
puts '"UnaryExp" : "UnionExpr"'
|
675
671
|
puts "val: #{val.inspect}"
|
676
672
|
end
|
677
|
-
result = Rubyang::Xpath::
|
673
|
+
result = Rubyang::Xpath::UnaryExpr.new val[0]
|
678
674
|
}
|
679
675
|
| "-" "UnaryExp"
|
680
676
|
{
|
@@ -682,7 +678,7 @@ rule
|
|
682
678
|
puts '"UnaryExp" : "-" "UnaryExp"'
|
683
679
|
puts "val: #{val.inspect}"
|
684
680
|
end
|
685
|
-
result = Rubyang::Xpath::
|
681
|
+
result = Rubyang::Xpath::UnaryExpr.new val[1], val[0]
|
686
682
|
}
|
687
683
|
|
688
684
|
"Number" : "Digits"
|
@@ -724,7 +720,7 @@ rule
|
|
724
720
|
puts '"FunctionName(" : "last("'
|
725
721
|
puts "val: #{val.inspect}"
|
726
722
|
end
|
727
|
-
result = Rubyang::Xpath::
|
723
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
728
724
|
}
|
729
725
|
| "position("
|
730
726
|
{
|
@@ -732,7 +728,7 @@ rule
|
|
732
728
|
puts '"FunctionName(" : "position("'
|
733
729
|
puts "val: #{val.inspect}"
|
734
730
|
end
|
735
|
-
result = Rubyang::Xpath::
|
731
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
736
732
|
result = val[0]
|
737
733
|
}
|
738
734
|
| "count("
|
@@ -741,7 +737,7 @@ rule
|
|
741
737
|
puts '"FunctionName(" : "count("'
|
742
738
|
puts "val: #{val.inspect}"
|
743
739
|
end
|
744
|
-
result = Rubyang::Xpath::
|
740
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
745
741
|
result = val[0]
|
746
742
|
}
|
747
743
|
| "id("
|
@@ -750,7 +746,7 @@ rule
|
|
750
746
|
puts '"FunctionName(" : "id("'
|
751
747
|
puts "val: #{val.inspect}"
|
752
748
|
end
|
753
|
-
result = Rubyang::Xpath::
|
749
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
754
750
|
result = val[0]
|
755
751
|
}
|
756
752
|
| "local-name("
|
@@ -760,7 +756,7 @@ rule
|
|
760
756
|
puts "val: #{val.inspect}"
|
761
757
|
end
|
762
758
|
result = val[0]
|
763
|
-
result = Rubyang::Xpath::
|
759
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
764
760
|
}
|
765
761
|
| "namespace-uri("
|
766
762
|
{
|
@@ -769,7 +765,7 @@ rule
|
|
769
765
|
puts "val: #{val.inspect}"
|
770
766
|
end
|
771
767
|
result = val[0]
|
772
|
-
result = Rubyang::Xpath::
|
768
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
773
769
|
}
|
774
770
|
| "name("
|
775
771
|
{
|
@@ -778,7 +774,7 @@ rule
|
|
778
774
|
puts "val: #{val.inspect}"
|
779
775
|
end
|
780
776
|
result = val[0]
|
781
|
-
result = Rubyang::Xpath::
|
777
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
782
778
|
}
|
783
779
|
| "string("
|
784
780
|
{
|
@@ -787,7 +783,7 @@ rule
|
|
787
783
|
puts "val: #{val.inspect}"
|
788
784
|
end
|
789
785
|
result = val[0]
|
790
|
-
result = Rubyang::Xpath::
|
786
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
791
787
|
}
|
792
788
|
| "concat("
|
793
789
|
{
|
@@ -796,7 +792,7 @@ rule
|
|
796
792
|
puts "val: #{val.inspect}"
|
797
793
|
end
|
798
794
|
result = val[0]
|
799
|
-
result = Rubyang::Xpath::
|
795
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
800
796
|
}
|
801
797
|
| "starts-with("
|
802
798
|
{
|
@@ -805,7 +801,7 @@ rule
|
|
805
801
|
puts "val: #{val.inspect}"
|
806
802
|
end
|
807
803
|
result = val[0]
|
808
|
-
result = Rubyang::Xpath::
|
804
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
809
805
|
}
|
810
806
|
| "contains("
|
811
807
|
{
|
@@ -814,7 +810,7 @@ rule
|
|
814
810
|
puts "val: #{val.inspect}"
|
815
811
|
end
|
816
812
|
result = val[0]
|
817
|
-
result = Rubyang::Xpath::
|
813
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
818
814
|
}
|
819
815
|
| "substring-before("
|
820
816
|
{
|
@@ -823,7 +819,7 @@ rule
|
|
823
819
|
puts "val: #{val.inspect}"
|
824
820
|
end
|
825
821
|
result = val[0]
|
826
|
-
result = Rubyang::Xpath::
|
822
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
827
823
|
}
|
828
824
|
| "substring-after("
|
829
825
|
{
|
@@ -832,7 +828,7 @@ rule
|
|
832
828
|
puts "val: #{val.inspect}"
|
833
829
|
end
|
834
830
|
result = val[0]
|
835
|
-
result = Rubyang::Xpath::
|
831
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
836
832
|
}
|
837
833
|
| "substring("
|
838
834
|
{
|
@@ -841,7 +837,7 @@ rule
|
|
841
837
|
puts "val: #{val.inspect}"
|
842
838
|
end
|
843
839
|
result = val[0]
|
844
|
-
result = Rubyang::Xpath::
|
840
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
845
841
|
}
|
846
842
|
| "string-length("
|
847
843
|
{
|
@@ -850,7 +846,7 @@ rule
|
|
850
846
|
puts "val: #{val.inspect}"
|
851
847
|
end
|
852
848
|
result = val[0]
|
853
|
-
result = Rubyang::Xpath::
|
849
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
854
850
|
}
|
855
851
|
| "normalize-space("
|
856
852
|
{
|
@@ -859,7 +855,7 @@ rule
|
|
859
855
|
puts "val: #{val.inspect}"
|
860
856
|
end
|
861
857
|
result = val[0]
|
862
|
-
result = Rubyang::Xpath::
|
858
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
863
859
|
}
|
864
860
|
| "translate("
|
865
861
|
{
|
@@ -868,7 +864,7 @@ rule
|
|
868
864
|
puts "val: #{val.inspect}"
|
869
865
|
end
|
870
866
|
result = val[0]
|
871
|
-
result = Rubyang::Xpath::
|
867
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
872
868
|
}
|
873
869
|
| "boolean("
|
874
870
|
{
|
@@ -877,7 +873,7 @@ rule
|
|
877
873
|
puts "val: #{val.inspect}"
|
878
874
|
end
|
879
875
|
result = val[0]
|
880
|
-
result = Rubyang::Xpath::
|
876
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
881
877
|
}
|
882
878
|
| "not("
|
883
879
|
{
|
@@ -886,7 +882,7 @@ rule
|
|
886
882
|
puts "val: #{val.inspect}"
|
887
883
|
end
|
888
884
|
result = val[0]
|
889
|
-
result = Rubyang::Xpath::
|
885
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
890
886
|
}
|
891
887
|
| "true("
|
892
888
|
{
|
@@ -895,7 +891,7 @@ rule
|
|
895
891
|
puts "val: #{val.inspect}"
|
896
892
|
end
|
897
893
|
result = val[0]
|
898
|
-
result = Rubyang::Xpath::
|
894
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
899
895
|
}
|
900
896
|
| "false("
|
901
897
|
{
|
@@ -904,7 +900,7 @@ rule
|
|
904
900
|
puts "val: #{val.inspect}"
|
905
901
|
end
|
906
902
|
result = val[0]
|
907
|
-
result = Rubyang::Xpath::
|
903
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
908
904
|
}
|
909
905
|
| "lang("
|
910
906
|
{
|
@@ -913,7 +909,7 @@ rule
|
|
913
909
|
puts "val: #{val.inspect}"
|
914
910
|
end
|
915
911
|
result = val[0]
|
916
|
-
result = Rubyang::Xpath::
|
912
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
917
913
|
}
|
918
914
|
| "number("
|
919
915
|
{
|
@@ -922,7 +918,7 @@ rule
|
|
922
918
|
puts "val: #{val.inspect}"
|
923
919
|
end
|
924
920
|
result = val[0]
|
925
|
-
result = Rubyang::Xpath::
|
921
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
926
922
|
}
|
927
923
|
| "sum("
|
928
924
|
{
|
@@ -931,7 +927,7 @@ rule
|
|
931
927
|
puts "val: #{val.inspect}"
|
932
928
|
end
|
933
929
|
result = val[0]
|
934
|
-
result = Rubyang::Xpath::
|
930
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
935
931
|
}
|
936
932
|
| "floor("
|
937
933
|
{
|
@@ -940,7 +936,7 @@ rule
|
|
940
936
|
puts "val: #{val.inspect}"
|
941
937
|
end
|
942
938
|
result = val[0]
|
943
|
-
result = Rubyang::Xpath::
|
939
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
944
940
|
}
|
945
941
|
| "ceiling("
|
946
942
|
{
|
@@ -949,7 +945,7 @@ rule
|
|
949
945
|
puts "val: #{val.inspect}"
|
950
946
|
end
|
951
947
|
result = val[0]
|
952
|
-
result = Rubyang::Xpath::
|
948
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
953
949
|
}
|
954
950
|
| "round("
|
955
951
|
{
|
@@ -958,7 +954,7 @@ rule
|
|
958
954
|
puts "val: #{val.inspect}"
|
959
955
|
end
|
960
956
|
result = val[0]
|
961
|
-
result = Rubyang::Xpath::
|
957
|
+
result = Rubyang::Xpath::FunctionCall::LAST
|
962
958
|
}
|
963
959
|
| "current("
|
964
960
|
{
|
@@ -966,7 +962,7 @@ rule
|
|
966
962
|
puts '"FunctionName(" : "current("'
|
967
963
|
puts "val: #{val.inspect}"
|
968
964
|
end
|
969
|
-
result = Rubyang::Xpath::
|
965
|
+
result = Rubyang::Xpath::FunctionCall::CURRENT
|
970
966
|
}
|
971
967
|
|
972
968
|
"VariableReference" : "$" "QName"
|
data/lib/rubyang/xpath/parser.rb
CHANGED
@@ -112,17 +112,27 @@ module Rubyang
|
|
112
112
|
|
113
113
|
until s.eos?
|
114
114
|
token = s.scan( scanre )
|
115
|
-
|
115
|
+
if DEBUG
|
116
|
+
p token
|
117
|
+
end
|
116
118
|
next if "S" == scanre_list.find{ |s| s[1] =~ token }[0]
|
117
119
|
@tokens.push [scanre_list.find{ |s| s[1] =~ token }[0], token]
|
120
|
+
if DEBUG
|
121
|
+
p @tokens.last
|
122
|
+
end
|
118
123
|
end
|
119
124
|
|
125
|
+
if DEBUG
|
126
|
+
p 'run do_parse'
|
127
|
+
end
|
120
128
|
result = self.do_parse
|
121
129
|
result
|
122
130
|
end
|
123
131
|
|
124
132
|
def next_token
|
125
|
-
|
133
|
+
if DEBUG
|
134
|
+
p @tokens.first
|
135
|
+
end
|
126
136
|
@tokens.shift
|
127
137
|
end
|
128
138
|
end
|