Module: RTor::DirspecV2::RouterDescriptor
Defined Under Namespace
Modules: BandwidthItem0, HibernatingItem0, PlatformItem0, PublishedItem0, RouterItem0
Instance Method Summary
collapse
Methods included from Primitives
#_nt_ALPHA, #_nt_Address, #_nt_Base64Char, #_nt_Base64Hash, #_nt_Boolean, #_nt_CircuitID, #_nt_DIGIT, #_nt_DateTime, #_nt_Day, #_nt_DirPort, #_nt_Fingerprint, #_nt_HEXDIG, #_nt_Hostname, #_nt_Hour, #_nt_IDChar, #_nt_IP, #_nt_IPv4Address, #_nt_IPv4Byte, #_nt_LongName, #_nt_Minute, #_nt_Month, #_nt_NL, #_nt_Nickname, #_nt_NicknameChar, #_nt_ORPort, #_nt_Port, #_nt_SP, #_nt_Second, #_nt_ServerID, #_nt_ServerSpec, #_nt_SocksPOrt, #_nt_StreamID, #_nt_Year
Instance Method Details
#_nt_BandwidthItem ⇒ Object
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
# File 'lib/rtor/dirspecv2/router_descriptor_parser.rb', line 134
def _nt_BandwidthItem
start_index = index
if node_cache[:BandwidthItem].has_key?(index)
cached = node_cache[:BandwidthItem][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
if has_terminal?("bandwidth", false, index)
r1 = instantiate_node(SyntaxNode,input, index...(index + 9))
@index += 9
else
terminal_parse_failure("bandwidth")
r1 = nil
end
s0 << r1
if r1
r2 = _nt_BandwidthAvg
s0 << r2
if r2
r3 = _nt_BandwidthBurst
s0 << r3
if r3
r4 = _nt_BandwidthObserved
s0 << r4
end
end
end
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(BandwidthItem0)
else
@index = i0
r0 = nil
end
node_cache[:BandwidthItem][start_index] = r0
r0
end
|
#_nt_Descriptor ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/rtor/dirspecv2/router_descriptor_parser.rb', line 15
def _nt_Descriptor
start_index = index
if node_cache[:Descriptor].has_key?(index)
cached = node_cache[:Descriptor][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_RouterItem
if r1
r0 = r1
else
r2 = _nt_NL
if r2
r0 = r2
else
@index = i0
r0 = nil
end
end
node_cache[:Descriptor][start_index] = r0
r0
end
|
#_nt_HibernatingItem ⇒ Object
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
# File 'lib/rtor/dirspecv2/router_descriptor_parser.rb', line 271
def _nt_HibernatingItem
start_index = index
if node_cache[:HibernatingItem].has_key?(index)
cached = node_cache[:HibernatingItem][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
if has_terminal?("hibernating", false, index)
r1 = instantiate_node(SyntaxNode,input, index...(index + 11))
@index += 11
else
terminal_parse_failure("hibernating")
r1 = nil
end
s0 << r1
if r1
r2 = _nt_Boolean
s0 << r2
end
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(HibernatingItem0)
else
@index = i0
r0 = nil
end
node_cache[:HibernatingItem][start_index] = r0
r0
end
|
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
# File 'lib/rtor/dirspecv2/router_descriptor_parser.rb', line 185
def _nt_PlatformItem
start_index = index
if node_cache[:PlatformItem].has_key?(index)
cached = node_cache[:PlatformItem][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
if has_terminal?("platform", false, index)
r1 = instantiate_node(SyntaxNode,input, index...(index + 8))
@index += 8
else
terminal_parse_failure("platform")
r1 = nil
end
s0 << r1
if r1
r2 = _nt_String
s0 << r2
end
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(PlatformItem0)
else
@index = i0
r0 = nil
end
node_cache[:PlatformItem][start_index] = r0
r0
end
|
#_nt_PublishedItem ⇒ Object
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
|
# File 'lib/rtor/dirspecv2/router_descriptor_parser.rb', line 228
def _nt_PublishedItem
start_index = index
if node_cache[:PublishedItem].has_key?(index)
cached = node_cache[:PublishedItem][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
if has_terminal?("published", false, index)
r1 = instantiate_node(SyntaxNode,input, index...(index + 9))
@index += 9
else
terminal_parse_failure("published")
r1 = nil
end
s0 << r1
if r1
r2 = _nt_DateTime
s0 << r2
end
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(PublishedItem0)
else
@index = i0
r0 = nil
end
node_cache[:PublishedItem][start_index] = r0
r0
end
|
#_nt_RouterItem ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# File 'lib/rtor/dirspecv2/router_descriptor_parser.rb', line 67
def _nt_RouterItem
start_index = index
if node_cache[:RouterItem].has_key?(index)
cached = node_cache[:RouterItem][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
if has_terminal?("router", false, index)
r1 = instantiate_node(SyntaxNode,input, index...(index + 6))
@index += 6
else
terminal_parse_failure("router")
r1 = nil
end
s0 << r1
if r1
r2 = _nt_Nickname
s0 << r2
if r2
r3 = _nt_Address
s0 << r3
if r3
r4 = _nt_ORPort
s0 << r4
if r4
r5 = _nt_SocksPort
s0 << r5
if r5
r6 = _nt_DirPort
s0 << r6
end
end
end
end
end
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(RouterItem0)
else
@index = i0
r0 = nil
end
node_cache[:RouterItem][start_index] = r0
r0
end
|
#root ⇒ Object
9
10
11
|
# File 'lib/rtor/dirspecv2/router_descriptor_parser.rb', line 9
def root
@root ||= :Descriptor
end
|