rubyang 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +27 -0
- data/.coveralls.yml +1 -0
- data/.eslintignore +1 -0
- data/.eslintrc +213 -0
- data/.gitignore +41 -0
- data/.rspec +2 -0
- data/.rubocop.yml +1156 -0
- data/.travis.yml +8 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +3 -0
- data/LICENSE +201 -0
- data/README.md +44 -0
- data/Rakefile +6 -0
- data/lib/rubyang.rb +10 -0
- data/lib/rubyang/cli.rb +120 -0
- data/lib/rubyang/cli/parser.rb +74 -0
- data/lib/rubyang/database.rb +29 -0
- data/lib/rubyang/database/data_tree.rb +725 -0
- data/lib/rubyang/database/helper.rb +44 -0
- data/lib/rubyang/database/schema_tree.rb +1060 -0
- data/lib/rubyang/model.rb +917 -0
- data/lib/rubyang/model/parser.rb +183 -0
- data/lib/rubyang/model/parser/parser.tab.rb +3661 -0
- data/lib/rubyang/model/parser/parser.y +1454 -0
- data/lib/rubyang/restapi.rb +4 -0
- data/lib/rubyang/restapi/httpd.rb +62 -0
- data/lib/rubyang/version.rb +3 -0
- data/lib/rubyang/webui.rb +11 -0
- data/lib/rubyang/webui/app.rb +74 -0
- data/lib/rubyang/webui/make_json_schema.rb +63 -0
- data/lib/rubyang/webui/public/js/webui.js +326 -0
- data/lib/rubyang/webui/views/index.erb +48 -0
- data/lib/rubyang/webui/views/layout.erb +82 -0
- data/lib/rubyang/xpath.rb +224 -0
- data/lib/rubyang/xpath/parser.rb +146 -0
- data/lib/rubyang/xpath/parser/parser.tab.rb +2273 -0
- data/lib/rubyang/xpath/parser/parser.y +1083 -0
- data/rubyang.gemspec +38 -0
- metadata +180 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
<div class="page-header">
|
2
|
+
<h2>A Container</h2>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div class="well">
|
6
|
+
<div class="" id="root" data-schemapath="/"></div>
|
7
|
+
|
8
|
+
<div>
|
9
|
+
<button type="button" class="btn btn-success button-ok" data-toggle="modal">OK</button>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<% content_for :javascript do %>
|
14
|
+
<script type="text/javascript">
|
15
|
+
$(document).ready(function(){
|
16
|
+
$('#myModal2').modal();
|
17
|
+
$('#myModal2 .progress-bar').css('width', '33%');
|
18
|
+
$.ajax({
|
19
|
+
type: 'GET',
|
20
|
+
url: "api/schema",
|
21
|
+
dataType: 'json'
|
22
|
+
}).done(function(data){
|
23
|
+
$('#myModal2 .progress-bar').css('width', '67%');
|
24
|
+
make_form(data, 'root');
|
25
|
+
$.ajax({
|
26
|
+
type: 'GET',
|
27
|
+
url: "api/data",
|
28
|
+
dataType: 'json'
|
29
|
+
}).done(function(data){
|
30
|
+
set_config(data, 'root');
|
31
|
+
$('#myModal2 .progress-bar').css('width', '100%');
|
32
|
+
$('#myModal2').modal('hide');
|
33
|
+
}).fail(function(data){
|
34
|
+
alert('failed to load config');
|
35
|
+
$('#myModal2 .progress-bar').css('width', '100%');
|
36
|
+
$('#myModal2').modal('hide');
|
37
|
+
}).always(function(data){
|
38
|
+
});
|
39
|
+
}).fail(function(data){
|
40
|
+
alert('failed to load schema');
|
41
|
+
$('#myModal2 .progress-bar').css('width', '100%');
|
42
|
+
$('#myModal2').modal('hide');
|
43
|
+
}).always(function(data){
|
44
|
+
});
|
45
|
+
});
|
46
|
+
</script>
|
47
|
+
<% end %>
|
48
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="ja">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
7
|
+
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
8
|
+
<title>Rubyang WebUI</title>
|
9
|
+
<!-- Bootstrap -->
|
10
|
+
<!-- <link href="css/bootstrap.min.css" rel="stylesheet"> -->
|
11
|
+
<!-- Latest compiled and minified CSS -->
|
12
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<div class="container-fluid" style="background-color:black;color:white;height:50;">
|
16
|
+
<h1>Rubyang::WebUI</h1>
|
17
|
+
</div>
|
18
|
+
<div class="container">
|
19
|
+
<div class="row">
|
20
|
+
<div class="col-md-3 sidebar">
|
21
|
+
<ul class="nav nav-pills nav-stacked">
|
22
|
+
<li data-toggle="collapse" href="#collapse-A">
|
23
|
+
<a href="#"><span class="caret"></span> menu A</a>
|
24
|
+
</li>
|
25
|
+
<ul id="collapse-A" class="collapse" style="list-style-type:none;">
|
26
|
+
<li><a href="A-1"><span class="fa fa-angle-double-right fa-fw"></span> A-1</a>
|
27
|
+
<li><a href="A-2"><span class="fa fa-angle-double-right fa-fw"></span> A-2</a>
|
28
|
+
<li><a href="A-3"><span class="fa fa-angle-double-right fa-fw"></span> A-3</a>
|
29
|
+
</ul>
|
30
|
+
<li data-toggle="collapse" href="#collapse-B">
|
31
|
+
<a href="#"><span class="caret"></span> menu B</a>
|
32
|
+
</li>
|
33
|
+
<ul id="collapse-B" class="collapse" style="list-style-type:none;">
|
34
|
+
<li><a href="B-1"><span class="fa fa-angle-double-right fa-fw"> B-1</a>
|
35
|
+
<li><a href="B-2"><span class="fa fa-angle-double-right fa-fw"> B-2</a>
|
36
|
+
<li><a href="B-3"><span class="fa fa-angle-double-right fa-fw"> B-3</a>
|
37
|
+
</ul>
|
38
|
+
</ul>
|
39
|
+
</div>
|
40
|
+
<div class="col-md-9">
|
41
|
+
<%= yield %>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
46
|
+
<div class="modal-dialog">
|
47
|
+
<div class="modal-content">
|
48
|
+
<div class="modal-header">
|
49
|
+
<h4 class="modal-title" id="myModalLabel"><i class="fa fa-clock-o"></i>Please Wait ...</h4>
|
50
|
+
</div>
|
51
|
+
<div class="modal-body center-block">
|
52
|
+
<div class="progress">
|
53
|
+
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width:100%"></div>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
60
|
+
<div class="modal-dialog">
|
61
|
+
<div class="modal-content">
|
62
|
+
<div class="modal-header">
|
63
|
+
<h4 class="modal-title" id="myModalLabel"><i class="fa fa-clock-o"></i>Please Wait ...</h4>
|
64
|
+
</div>
|
65
|
+
<div class="modal-body center-block">
|
66
|
+
<div class="progress">
|
67
|
+
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width:0%"></div>
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
</div>
|
72
|
+
</div>
|
73
|
+
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
74
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
75
|
+
<!-- Include all compiled plugins (below), or include individual files as needed -->
|
76
|
+
<!-- <script src="js/bootstrap.min.js"></script> -->
|
77
|
+
<!-- Latest compiled and minified JavaScript -->
|
78
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
|
79
|
+
<script type="text/javascript" src="/js/webui.js"></script>
|
80
|
+
<%= yield_content :javascript %>
|
81
|
+
</body>
|
82
|
+
</html>
|
@@ -0,0 +1,224 @@
|
|
1
|
+
# coding utf-8
|
2
|
+
|
3
|
+
require_relative 'xpath/parser'
|
4
|
+
|
5
|
+
module Rubyang
|
6
|
+
module Xpath
|
7
|
+
class LocationSteps < Array
|
8
|
+
def initialize *location_steps
|
9
|
+
self.push *location_steps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class LocationStep
|
14
|
+
attr_reader :axis, :node_test, :predicates
|
15
|
+
|
16
|
+
def initialize axis, node_test, predicates
|
17
|
+
@axis = axis
|
18
|
+
@node_test = node_test
|
19
|
+
@predicates = predicates
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Axis
|
24
|
+
ANCESTOR ||= 'ancestor'
|
25
|
+
ANCESTOR_OR_SELF ||= 'ancestor-or-self'
|
26
|
+
ATTRIBUTE ||= 'attribute'
|
27
|
+
CHILD ||= 'child'
|
28
|
+
DESCENDANT ||= 'descendant'
|
29
|
+
DESCENDANT_OR_SELF ||= 'descendant-or-self'
|
30
|
+
FOLLOWING ||= 'following'
|
31
|
+
FOLLOWING_SIBLING ||= 'following-sibling'
|
32
|
+
NAMESPACE ||= 'namespace'
|
33
|
+
PARENT ||= 'parent'
|
34
|
+
PRECEDING ||= 'preceding'
|
35
|
+
PRECEDING_SIBLING ||= 'preceding-sibling'
|
36
|
+
SELF ||= 'self'
|
37
|
+
|
38
|
+
attr_reader :name
|
39
|
+
|
40
|
+
def initialize name
|
41
|
+
@name = name
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class NodeTest
|
46
|
+
module NodeTestType
|
47
|
+
NAME_TEST ||= 'name-test'
|
48
|
+
NODE_TYPE ||= 'node-type'
|
49
|
+
PROCESSING_INSTRUCTION ||= 'processing-instruction'
|
50
|
+
end
|
51
|
+
|
52
|
+
class NameTest
|
53
|
+
attr_reader :name
|
54
|
+
|
55
|
+
def initialize name
|
56
|
+
@name = name
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
module NodeType
|
61
|
+
COMMENT ||= 'comment'
|
62
|
+
TEXT ||= 'text'
|
63
|
+
NODE ||= 'node'
|
64
|
+
end
|
65
|
+
|
66
|
+
class ProcessingInstruction
|
67
|
+
attr_reader :literal
|
68
|
+
|
69
|
+
def initialize literal
|
70
|
+
@literal = literal
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
attr_reader :node_test_type, :node_test
|
75
|
+
|
76
|
+
def initialize node_test_type, node_test
|
77
|
+
@node_test_type = node_test_type
|
78
|
+
@node_test = node_test
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class Predicates < Array
|
83
|
+
def initialize *predicates
|
84
|
+
self.push *predicates
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
class Predicate
|
89
|
+
class Expr
|
90
|
+
end
|
91
|
+
|
92
|
+
class OrExpr < Expr
|
93
|
+
attr_reader :op1, :op2
|
94
|
+
def initialize op1, op2=nil
|
95
|
+
@op1 = op1
|
96
|
+
@op2 = op2
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
class AndExpr < Expr
|
101
|
+
attr_reader :op1, :op2
|
102
|
+
def initialize op1, op2=nil
|
103
|
+
@op1 = op1
|
104
|
+
@op2 = op2
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
class EqualityExpr < Expr
|
109
|
+
attr_reader :op1, :operator, :op2
|
110
|
+
def initialize op1, operator=nil, op2=nil
|
111
|
+
@op1 = op1
|
112
|
+
@operator = operator
|
113
|
+
@op2 = op2
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
class RelationalExpr < Expr
|
118
|
+
attr_reader :op1, :operator, :op2
|
119
|
+
def initialize op1, operator=nil, op2=nil
|
120
|
+
@op1 = op1
|
121
|
+
@operator = operator
|
122
|
+
@op2 = op2
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
class AdditiveExpr < Expr
|
127
|
+
attr_reader :op1, :operator, :op2
|
128
|
+
def initialize op1, operator=nil, op2=nil
|
129
|
+
@op1 = op1
|
130
|
+
@operator = operator
|
131
|
+
@op2 = op2
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
class MultiplicativeExpr < Expr
|
136
|
+
attr_reader :op1, :operator, :op2
|
137
|
+
def initialize op1, operator=nil, op2=nil
|
138
|
+
@op1 = op1
|
139
|
+
@operator = operator
|
140
|
+
@op2 = op2
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
class UnaryExpr < Expr
|
145
|
+
attr_reader :op1, :operator
|
146
|
+
def initialize op1, operator=nil
|
147
|
+
@op1 = op1
|
148
|
+
@operator = operator
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
class UnionExpr < Expr
|
153
|
+
attr_reader :op1, :operator, :op2
|
154
|
+
def initialize op1, operator=nil, op2=nil
|
155
|
+
@op1 = op1
|
156
|
+
@operator = operator
|
157
|
+
@op2 = op2
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
class PathExpr < Expr
|
162
|
+
attr_reader :op1, :operator, :op2
|
163
|
+
def initialize op1, operator=nil, op2=nil
|
164
|
+
@op1 = op1
|
165
|
+
@operator = operator
|
166
|
+
@op2 = op2
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
class FilterExpr < Expr
|
171
|
+
attr_reader :op1, :op2
|
172
|
+
def initialize op1, op2=nil
|
173
|
+
@op1 = op1
|
174
|
+
@op2 = op2
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
class PrimaryExpr < Expr
|
179
|
+
attr_reader :op1
|
180
|
+
def initialize op1
|
181
|
+
@op1 = op1
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
class Literal
|
186
|
+
attr_reader :value
|
187
|
+
def initialize value
|
188
|
+
@value = case value
|
189
|
+
when /^"(?:[^"])*"/
|
190
|
+
value.gsub(/^"/,'').gsub(/"$/,'').gsub(/\\n/,"\n").gsub(/\\t/,"\t").gsub(/\\"/,"\"").gsub(/\\\\/,"\\")
|
191
|
+
when /^'(?:[^'])*'/
|
192
|
+
value.gsub(/^'/,'').gsub(/'$/,'')
|
193
|
+
else
|
194
|
+
value
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
class Number
|
200
|
+
attr_reader :value
|
201
|
+
def initialize value
|
202
|
+
@value = value.to_f.to_s
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
class FunctionCall
|
207
|
+
CURRENT ||= 'current'
|
208
|
+
|
209
|
+
attr_reader :name, :args
|
210
|
+
def initialize name, args=[]
|
211
|
+
@name = name
|
212
|
+
@args = args
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
attr_reader :expr
|
217
|
+
|
218
|
+
def initialize expr
|
219
|
+
@expr = expr
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'strscan'
|
4
|
+
|
5
|
+
require_relative '../xpath.rb'
|
6
|
+
|
7
|
+
require_relative 'parser/parser.tab.rb'
|
8
|
+
|
9
|
+
module Rubyang
|
10
|
+
module Xpath
|
11
|
+
class Parser
|
12
|
+
DEBUG ||= false
|
13
|
+
|
14
|
+
def self.parse( xpath_str )
|
15
|
+
parser = self.new
|
16
|
+
parser.parse( xpath_str )
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
end
|
21
|
+
|
22
|
+
def parse( xpath_str )
|
23
|
+
@tokens = Array.new
|
24
|
+
|
25
|
+
s = StringScanner.new( xpath_str )
|
26
|
+
|
27
|
+
scanre_list = [
|
28
|
+
["(", /^\(/],
|
29
|
+
[")", /^\)/],
|
30
|
+
["[", /^\[/],
|
31
|
+
["]", /^\]/],
|
32
|
+
["..", /^\.\./],
|
33
|
+
[".", /^\./],
|
34
|
+
["@", /^\@/],
|
35
|
+
[",", /^\,/],
|
36
|
+
["::", /^\:\:/],
|
37
|
+
["Literal", /^(?:"[^"]*"|'[^']*')/],
|
38
|
+
["Digits", /^[0-9]+/],
|
39
|
+
["//", /^\/\//],
|
40
|
+
["/", /^\//],
|
41
|
+
["|", /^\|/],
|
42
|
+
["+", /^\+/],
|
43
|
+
["-", /^\-/],
|
44
|
+
["!=", /^\!\=/],
|
45
|
+
["<=", /^\<\=/],
|
46
|
+
[">=", /^\>\=/],
|
47
|
+
["=", /^\=/],
|
48
|
+
["<", /^\</],
|
49
|
+
[">", /^\>/],
|
50
|
+
["and", /^and/],
|
51
|
+
["or", /^or/],
|
52
|
+
["mod", /^mod/],
|
53
|
+
["div", /^div/],
|
54
|
+
["$", /^\$/],
|
55
|
+
["*", /^\*/],
|
56
|
+
[":", /^\:/],
|
57
|
+
["S", /^[ \t]+/],
|
58
|
+
# NodeType
|
59
|
+
["comment", /^comment/],
|
60
|
+
["text", /^text/],
|
61
|
+
["node", /^node/],
|
62
|
+
# ProcessingInstruction
|
63
|
+
["processing-instruction", /^processing-instruction/],
|
64
|
+
# Axis
|
65
|
+
["ancestor", /^ancestor/],
|
66
|
+
["ancestor-or-self", /^ancestor-or-self/],
|
67
|
+
["attribute", /^attribute/],
|
68
|
+
["child", /^child/],
|
69
|
+
["descendant", /^descendant/],
|
70
|
+
["descendant-or-self", /^descendant-or-self/],
|
71
|
+
["following", /^following/],
|
72
|
+
["following-sibling", /^following-sibling/],
|
73
|
+
["namespace", /^namespace/],
|
74
|
+
["parent", /^parent/],
|
75
|
+
["preceding", /^preceding/],
|
76
|
+
["preceding-sibling", /^preceding-sibling/],
|
77
|
+
["self", /^self/],
|
78
|
+
# FunctionName
|
79
|
+
["last(", /^last[ \t]*\(/],
|
80
|
+
["position(", /^position[ \t]*\(/],
|
81
|
+
["count(", /^count[ \t]*\(/],
|
82
|
+
["id(", /^id[ \t]*\(/],
|
83
|
+
["local-name(", /^local-name[ \t]*\(/],
|
84
|
+
["namespace-uri(", /^namespace-uri[ \t]*\(/],
|
85
|
+
["name(", /^name[ \t]*\(/],
|
86
|
+
["string(", /^string[ \t]*\(/],
|
87
|
+
["concat(", /^concat[ \t]*\(/],
|
88
|
+
["starts-with(", /^starts-with[ \t]*\(/],
|
89
|
+
["contains(", /^contains[ \t]*\(/],
|
90
|
+
["substring-before(", /^substring-before[ \t]*\(/],
|
91
|
+
["substring-after(", /^substring-after[ \t]*\(/],
|
92
|
+
["substring(", /^substring[ \t]*\(/],
|
93
|
+
["string-length(", /^string-length[ \t]*\(/],
|
94
|
+
["normalize-space(", /^normalize-space[ \t]*\(/],
|
95
|
+
["translate(", /^translate[ \t]*\(/],
|
96
|
+
["boolean(", /^boolean[ \t]*\(/],
|
97
|
+
["not(", /^not[ \t]*\(/],
|
98
|
+
["true(", /^true[ \t]*\(/],
|
99
|
+
["false(", /^false[ \t]*\(/],
|
100
|
+
["lang(", /^lang[ \t]*\(/],
|
101
|
+
["number(", /^number[ \t]*\(/],
|
102
|
+
["sum(", /^sum[ \t]*\(/],
|
103
|
+
["floor(", /^floor[ \t]*\(/],
|
104
|
+
["ceiling(", /^ceiling[ \t]*\(/],
|
105
|
+
["round(", /^round[ \t]*\(/],
|
106
|
+
["current(", /^current[ \t]*\(/],
|
107
|
+
# NCName
|
108
|
+
["NCName", /^(?:[A-Z]|\_|[a-z])(?:[A-Z]|\_|[a-z]|\-|\.|[0-9])*/],
|
109
|
+
]
|
110
|
+
|
111
|
+
scanre = Regexp.union( scanre_list.map{ |scanre| scanre[1] } )
|
112
|
+
|
113
|
+
until s.eos?
|
114
|
+
token = s.scan( scanre )
|
115
|
+
#p token
|
116
|
+
next if "S" == scanre_list.find{ |s| s[1] =~ token }[0]
|
117
|
+
@tokens.push [scanre_list.find{ |s| s[1] =~ token }[0], token]
|
118
|
+
end
|
119
|
+
|
120
|
+
result = self.do_parse
|
121
|
+
result
|
122
|
+
end
|
123
|
+
|
124
|
+
def next_token
|
125
|
+
#p @tokens.first
|
126
|
+
@tokens.shift
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
if __FILE__ == $0
|
133
|
+
require 'yaml'
|
134
|
+
|
135
|
+
#str = "../leaf0"
|
136
|
+
#xpath = Rubyang::Xpath::Parser.parse(str)
|
137
|
+
#puts xpath.to_yaml
|
138
|
+
|
139
|
+
#str = "/hoge"
|
140
|
+
#xpath = Rubyang::Xpath::Parser.parse(str)
|
141
|
+
#puts xpath.to_yaml
|
142
|
+
|
143
|
+
str = "../hoge[name1 = current()/../container1/name]/leaf"
|
144
|
+
xpath = Rubyang::Xpath::Parser.parse(str)
|
145
|
+
puts xpath.to_yaml
|
146
|
+
end
|