Module: RTor::DirspecV2::NetworkStatus

Includes:
Primitives, Treetop::Runtime
Included in:
NetworkStatusParser
Defined in:
lib/rtor/dirspecv2/network_status_parser.rb

Defined Under Namespace

Modules: DirSourceLine0, FingerprintLine0, PublishedLine0

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_DirSourceLineObject



65
66
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
119
120
# File 'lib/rtor/dirspecv2/network_status_parser.rb', line 65

def _nt_DirSourceLine
  start_index = index
  if node_cache[:DirSourceLine].has_key?(index)
    cached = node_cache[:DirSourceLine][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?("dir-source", false, index)
    r1 = instantiate_node(SyntaxNode,input, index...(index + 10))
    @index += 10
  else
    terminal_parse_failure("dir-source")
    r1 = nil
  end
  s0 << r1
  if r1
    r2 = _nt_SP
    s0 << r2
    if r2
      r3 = _nt_Hostname
      s0 << r3
      if r3
        r4 = _nt_SP
        s0 << r4
        if r4
          r5 = _nt_IPv4Address
          s0 << r5
          if r5
            r6 = _nt_SP
            s0 << r6
            if r6
              r7 = _nt_DirPort
              s0 << r7
            end
          end
        end
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(DirSourceLine0)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:DirSourceLine][start_index] = r0

  r0
end

#_nt_FingerprintLineObject



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
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/rtor/dirspecv2/network_status_parser.rb', line 132

def _nt_FingerprintLine
  start_index = index
  if node_cache[:FingerprintLine].has_key?(index)
    cached = node_cache[:FingerprintLine][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?("fingerprint", false, index)
    r1 = instantiate_node(SyntaxNode,input, index...(index + 11))
    @index += 11
  else
    terminal_parse_failure("fingerprint")
    r1 = nil
  end
  s0 << r1
  if r1
    r2 = _nt_SP
    s0 << r2
    if r2
      r3 = _nt_Fingerprint
      s0 << r3
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(FingerprintLine0)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:FingerprintLine][start_index] = r0

  r0
end

#_nt_NetworkStatusVersionObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rtor/dirspecv2/network_status_parser.rb', line 15

def _nt_NetworkStatusVersion
  start_index = index
  if node_cache[:NetworkStatusVersion].has_key?(index)
    cached = node_cache[:NetworkStatusVersion][index]
    if cached
      cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  if has_terminal?("network-status-version 2", false, index)
    r0 = instantiate_node(SyntaxNode,input, index...(index + 24))
    @index += 24
  else
    terminal_parse_failure("network-status-version 2")
    r0 = nil
  end

  node_cache[:NetworkStatusVersion][start_index] = r0

  r0
end

#_nt_PublishedLineObject



183
184
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
221
222
# File 'lib/rtor/dirspecv2/network_status_parser.rb', line 183

def _nt_PublishedLine
  start_index = index
  if node_cache[:PublishedLine].has_key?(index)
    cached = node_cache[:PublishedLine][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_SP
    s0 << r2
    if r2
      r3 = _nt_DateTime
      s0 << r3
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(PublishedLine0)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:PublishedLine][start_index] = r0

  r0
end

#rootObject



9
10
11
# File 'lib/rtor/dirspecv2/network_status_parser.rb', line 9

def root
  @root ||= :NetworkStatusVersion
end