Module: Formatting
- Includes:
- Treetop::Runtime
- Included in:
- FormattingParser
- Defined in:
- lib/ntail/node.rb,
lib/ntail/formatting.rb
Defined Under Namespace
Modules: BodyBytesSent0, HttpReferer0, HttpUserAgent0, Literal0, ProxyAddresses0, RemoteAddr0, RemoteUser0, Request0, RequestTime0, Status0, TimeLocal0, UpstreamResponseTime0
Classes: Node
Instance Method Summary
collapse
Instance Method Details
#_nt_body_bytes_sent ⇒ Object
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
|
# File 'lib/ntail/formatting.rb', line 328
def _nt_body_bytes_sent
start_index = index
if node_cache[:body_bytes_sent].has_key?(index)
cached = node_cache[:body_bytes_sent][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
if has_terminal?('%b', false, index)
r0 = instantiate_node(Node,input, index...(index + 2))
r0.extend(BodyBytesSent0)
@index += 2
else
terminal_parse_failure('%b')
r0 = nil
end
node_cache[:body_bytes_sent][start_index] = r0
r0
end
|
11
12
13
14
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
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/ntail/formatting.rb', line 11
def _nt_format_string
start_index = index
if node_cache[:format_string].has_key?(index)
cached = node_cache[:format_string][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
s0, i0 = [], index
loop do
i1 = index
r2 = _nt_token
if r2
r1 = r2
else
r3 = _nt_literal
if r3
r1 = r3
else
@index = i1
r1 = nil
end
end
if r1
s0 << r1
else
break
end
end
if s0.empty?
@index = i0
r0 = nil
else
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
end
node_cache[:format_string][start_index] = r0
r0
end
|
#_nt_http_referer ⇒ Object
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
|
# File 'lib/ntail/formatting.rb', line 431
def _nt_http_referer
start_index = index
if node_cache[:http_referer].has_key?(index)
cached = node_cache[:http_referer][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
if has_terminal?('%R', false, index)
r0 = instantiate_node(Node,input, index...(index + 2))
r0.extend(HttpReferer0)
@index += 2
else
terminal_parse_failure('%R')
r0 = nil
end
node_cache[:http_referer][start_index] = r0
r0
end
|
#_nt_http_user_agent ⇒ Object
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
|
# File 'lib/ntail/formatting.rb', line 462
def _nt_http_user_agent
start_index = index
if node_cache[:http_user_agent].has_key?(index)
cached = node_cache[:http_user_agent][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
if has_terminal?('%U', false, index)
r0 = instantiate_node(Node,input, index...(index + 2))
r0.extend(HttpUserAgent0)
@index += 2
else
terminal_parse_failure('%U')
r0 = nil
end
node_cache[:http_user_agent][start_index] = r0
r0
end
|
#_nt_literal ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/ntail/formatting.rb', line 62
def _nt_literal
start_index = index
if node_cache[:literal].has_key?(index)
cached = node_cache[:literal][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
if index < input_length
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
r0.extend(Literal0)
@index += 1
else
terminal_parse_failure("any character")
r0 = nil
end
node_cache[:literal][start_index] = r0
r0
end
|
#_nt_proxy_addresses ⇒ Object
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
|
# File 'lib/ntail/formatting.rb', line 493
def _nt_proxy_addresses
start_index = index
if node_cache[:proxy_addresses].has_key?(index)
cached = node_cache[:proxy_addresses][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
if has_terminal?('%p', false, index)
r0 = instantiate_node(Node,input, index...(index + 2))
r0.extend(ProxyAddresses0)
@index += 2
else
terminal_parse_failure('%p')
r0 = nil
end
node_cache[:proxy_addresses][start_index] = r0
r0
end
|
#_nt_remote_addr ⇒ Object
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
# File 'lib/ntail/formatting.rb', line 173
def _nt_remote_addr
start_index = index
if node_cache[:remote_addr].has_key?(index)
cached = node_cache[:remote_addr][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
if has_terminal?('%a', false, index)
r0 = instantiate_node(Node,input, index...(index + 2))
r0.extend(RemoteAddr0)
@index += 2
else
terminal_parse_failure('%a')
r0 = nil
end
node_cache[:remote_addr][start_index] = r0
r0
end
|
#_nt_remote_user ⇒ Object
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
# File 'lib/ntail/formatting.rb', line 204
def _nt_remote_user
start_index = index
if node_cache[:remote_user].has_key?(index)
cached = node_cache[:remote_user][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
if has_terminal?('%u', false, index)
r0 = instantiate_node(Node,input, index...(index + 2))
r0.extend(RemoteUser0)
@index += 2
else
terminal_parse_failure('%u')
r0 = nil
end
node_cache[:remote_user][start_index] = r0
r0
end
|
#_nt_request ⇒ Object
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
# File 'lib/ntail/formatting.rb', line 266
def _nt_request
start_index = index
if node_cache[:request].has_key?(index)
cached = node_cache[:request][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
if has_terminal?('%r', false, index)
r0 = instantiate_node(Node,input, index...(index + 2))
r0.extend(Request0)
@index += 2
else
terminal_parse_failure('%r')
r0 = nil
end
node_cache[:request][start_index] = r0
r0
end
|
#_nt_request_time ⇒ Object
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
|
# File 'lib/ntail/formatting.rb', line 400
def _nt_request_time
start_index = index
if node_cache[:request_time].has_key?(index)
cached = node_cache[:request_time][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
if has_terminal?('%T', false, index)
r0 = instantiate_node(Node,input, index...(index + 2))
r0.extend(RequestTime0)
@index += 2
else
terminal_parse_failure('%T')
r0 = nil
end
node_cache[:request_time][start_index] = r0
r0
end
|
#_nt_status ⇒ Object
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
# File 'lib/ntail/formatting.rb', line 297
def _nt_status
start_index = index
if node_cache[:status].has_key?(index)
cached = node_cache[:status][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
if has_terminal?('%s', false, index)
r0 = instantiate_node(Node,input, index...(index + 2))
r0.extend(Status0)
@index += 2
else
terminal_parse_failure('%s')
r0 = nil
end
node_cache[:status][start_index] = r0
r0
end
|
#_nt_time_local ⇒ Object
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
|
# File 'lib/ntail/formatting.rb', line 235
def _nt_time_local
start_index = index
if node_cache[:time_local].has_key?(index)
cached = node_cache[:time_local][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
if has_terminal?('%t', false, index)
r0 = instantiate_node(Node,input, index...(index + 2))
r0.extend(TimeLocal0)
@index += 2
else
terminal_parse_failure('%t')
r0 = nil
end
node_cache[:time_local][start_index] = r0
r0
end
|
#_nt_token ⇒ Object
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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
|
# File 'lib/ntail/formatting.rb', line 87
def _nt_token
start_index = index
if node_cache[:token].has_key?(index)
cached = node_cache[:token][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_remote_addr
if r1
r0 = r1
else
r2 = _nt_remote_user
if r2
r0 = r2
else
r3 = _nt_time_local
if r3
r0 = r3
else
r4 = _nt_request
if r4
r0 = r4
else
r5 = _nt_status
if r5
r0 = r5
else
r6 = _nt_body_bytes_sent
if r6
r0 = r6
else
r7 = _nt_upstream_response_time
if r7
r0 = r7
else
r8 = _nt_request_time
if r8
r0 = r8
else
r9 = _nt_http_referer
if r9
r0 = r9
else
r10 = _nt_http_user_agent
if r10
r0 = r10
else
r11 = _nt_proxy_addresses
if r11
r0 = r11
else
@index = i0
r0 = nil
end
end
end
end
end
end
end
end
end
end
end
node_cache[:token][start_index] = r0
r0
end
|
#_nt_upstream_response_time ⇒ Object
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
|
# File 'lib/ntail/formatting.rb', line 364
def _nt_upstream_response_time
start_index = index
if node_cache[:upstream_response_time].has_key?(index)
cached = node_cache[:upstream_response_time][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
if has_terminal?('%<T', false, index)
r0 = instantiate_node(Node,input, index...(index + 3))
r0.extend(UpstreamResponseTime0)
@index += 3
else
terminal_parse_failure('%<T')
r0 = nil
end
node_cache[:upstream_response_time][start_index] = r0
r0
end
|
#root ⇒ Object
7
8
9
|
# File 'lib/ntail/formatting.rb', line 7
def root
@root ||= :format_string
end
|