onion 0.1.2 → 0.1.3
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.
- data/lib/onion/control_client.rb +3 -7
- data/lib/onion/parsers/circuit_lists.treetop +32 -31
- metadata +7 -24
- data/License.txt +0 -23
- data/lib/onion/parsers/circuit_lists.rb +0 -491
- data/lib/onion/parsers/common.rb +0 -1692
- data/lib/onion/parsers/router_statuses.rb +0 -1035
- data/lib/onion/parsers/stream_lists.rb +0 -356
| @@ -1,356 +0,0 @@ | |
| 1 | 
            -
            # Autogenerated from a Treetop grammar. Edits may be lost.
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
            module Onion
         | 
| 5 | 
            -
              module StreamLists
         | 
| 6 | 
            -
                include Treetop::Runtime
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                def root
         | 
| 9 | 
            -
                  @root ||= :stream_list
         | 
| 10 | 
            -
                end
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                include Common
         | 
| 13 | 
            -
             | 
| 14 | 
            -
                module StreamList0
         | 
| 15 | 
            -
                  def streams
         | 
| 16 | 
            -
                    streams = []
         | 
| 17 | 
            -
                    self.elements.each do |stream|
         | 
| 18 | 
            -
            						streams << Stream.new(stream.s_id.text_value.strip, stream.c_id.text_value.strip)
         | 
| 19 | 
            -
            					end
         | 
| 20 | 
            -
                    return streams
         | 
| 21 | 
            -
                  end
         | 
| 22 | 
            -
                end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                def _nt_stream_list
         | 
| 25 | 
            -
                  start_index = index
         | 
| 26 | 
            -
                  if node_cache[:stream_list].has_key?(index)
         | 
| 27 | 
            -
                    cached = node_cache[:stream_list][index]
         | 
| 28 | 
            -
                    if cached
         | 
| 29 | 
            -
                      cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
         | 
| 30 | 
            -
                      @index = cached.interval.end
         | 
| 31 | 
            -
                    end
         | 
| 32 | 
            -
                    return cached
         | 
| 33 | 
            -
                  end
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                  s0, i0 = [], index
         | 
| 36 | 
            -
                  loop do
         | 
| 37 | 
            -
                    r1 = _nt_stream_list_entry
         | 
| 38 | 
            -
                    if r1
         | 
| 39 | 
            -
                      s0 << r1
         | 
| 40 | 
            -
                    else
         | 
| 41 | 
            -
                      break
         | 
| 42 | 
            -
                    end
         | 
| 43 | 
            -
                  end
         | 
| 44 | 
            -
                  if s0.empty?
         | 
| 45 | 
            -
                    @index = i0
         | 
| 46 | 
            -
                    r0 = nil
         | 
| 47 | 
            -
                  else
         | 
| 48 | 
            -
                    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
         | 
| 49 | 
            -
                    r0.extend(StreamList0)
         | 
| 50 | 
            -
                  end
         | 
| 51 | 
            -
             | 
| 52 | 
            -
                  node_cache[:stream_list][start_index] = r0
         | 
| 53 | 
            -
             | 
| 54 | 
            -
                  r0
         | 
| 55 | 
            -
                end
         | 
| 56 | 
            -
             | 
| 57 | 
            -
                module StreamListEntry0
         | 
| 58 | 
            -
                  def s_id
         | 
| 59 | 
            -
                    elements[0]
         | 
| 60 | 
            -
                  end
         | 
| 61 | 
            -
             | 
| 62 | 
            -
                  def SP1
         | 
| 63 | 
            -
                    elements[1]
         | 
| 64 | 
            -
                  end
         | 
| 65 | 
            -
             | 
| 66 | 
            -
                  def s
         | 
| 67 | 
            -
                    elements[2]
         | 
| 68 | 
            -
                  end
         | 
| 69 | 
            -
             | 
| 70 | 
            -
                  def SP2
         | 
| 71 | 
            -
                    elements[3]
         | 
| 72 | 
            -
                  end
         | 
| 73 | 
            -
             | 
| 74 | 
            -
                  def c_id
         | 
| 75 | 
            -
                    elements[4]
         | 
| 76 | 
            -
                  end
         | 
| 77 | 
            -
             | 
| 78 | 
            -
                  def SP3
         | 
| 79 | 
            -
                    elements[5]
         | 
| 80 | 
            -
                  end
         | 
| 81 | 
            -
             | 
| 82 | 
            -
                  def t
         | 
| 83 | 
            -
                    elements[6]
         | 
| 84 | 
            -
                  end
         | 
| 85 | 
            -
             | 
| 86 | 
            -
                end
         | 
| 87 | 
            -
             | 
| 88 | 
            -
                def _nt_stream_list_entry
         | 
| 89 | 
            -
                  start_index = index
         | 
| 90 | 
            -
                  if node_cache[:stream_list_entry].has_key?(index)
         | 
| 91 | 
            -
                    cached = node_cache[:stream_list_entry][index]
         | 
| 92 | 
            -
                    if cached
         | 
| 93 | 
            -
                      cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
         | 
| 94 | 
            -
                      @index = cached.interval.end
         | 
| 95 | 
            -
                    end
         | 
| 96 | 
            -
                    return cached
         | 
| 97 | 
            -
                  end
         | 
| 98 | 
            -
             | 
| 99 | 
            -
                  i0, s0 = index, []
         | 
| 100 | 
            -
                  r1 = _nt_StreamID
         | 
| 101 | 
            -
                  s0 << r1
         | 
| 102 | 
            -
                  if r1
         | 
| 103 | 
            -
                    r2 = _nt_SP
         | 
| 104 | 
            -
                    s0 << r2
         | 
| 105 | 
            -
                    if r2
         | 
| 106 | 
            -
                      r3 = _nt_StreamStatus
         | 
| 107 | 
            -
                      s0 << r3
         | 
| 108 | 
            -
                      if r3
         | 
| 109 | 
            -
                        r4 = _nt_SP
         | 
| 110 | 
            -
                        s0 << r4
         | 
| 111 | 
            -
                        if r4
         | 
| 112 | 
            -
                          r5 = _nt_CircuitID
         | 
| 113 | 
            -
                          s0 << r5
         | 
| 114 | 
            -
                          if r5
         | 
| 115 | 
            -
                            r6 = _nt_SP
         | 
| 116 | 
            -
                            s0 << r6
         | 
| 117 | 
            -
                            if r6
         | 
| 118 | 
            -
                              r7 = _nt_Target
         | 
| 119 | 
            -
                              s0 << r7
         | 
| 120 | 
            -
                              if r7
         | 
| 121 | 
            -
                                if has_terminal?("\r\n", false, index)
         | 
| 122 | 
            -
                                  r8 = instantiate_node(SyntaxNode,input, index...(index + 2))
         | 
| 123 | 
            -
                                  @index += 2
         | 
| 124 | 
            -
                                else
         | 
| 125 | 
            -
                                  terminal_parse_failure("\r\n")
         | 
| 126 | 
            -
                                  r8 = nil
         | 
| 127 | 
            -
                                end
         | 
| 128 | 
            -
                                s0 << r8
         | 
| 129 | 
            -
                              end
         | 
| 130 | 
            -
                            end
         | 
| 131 | 
            -
                          end
         | 
| 132 | 
            -
                        end
         | 
| 133 | 
            -
                      end
         | 
| 134 | 
            -
                    end
         | 
| 135 | 
            -
                  end
         | 
| 136 | 
            -
                  if s0.last
         | 
| 137 | 
            -
                    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
         | 
| 138 | 
            -
                    r0.extend(StreamListEntry0)
         | 
| 139 | 
            -
                  else
         | 
| 140 | 
            -
                    @index = i0
         | 
| 141 | 
            -
                    r0 = nil
         | 
| 142 | 
            -
                  end
         | 
| 143 | 
            -
             | 
| 144 | 
            -
                  node_cache[:stream_list_entry][start_index] = r0
         | 
| 145 | 
            -
             | 
| 146 | 
            -
                  r0
         | 
| 147 | 
            -
                end
         | 
| 148 | 
            -
             | 
| 149 | 
            -
                def _nt_StreamStatus
         | 
| 150 | 
            -
                  start_index = index
         | 
| 151 | 
            -
                  if node_cache[:StreamStatus].has_key?(index)
         | 
| 152 | 
            -
                    cached = node_cache[:StreamStatus][index]
         | 
| 153 | 
            -
                    if cached
         | 
| 154 | 
            -
                      cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
         | 
| 155 | 
            -
                      @index = cached.interval.end
         | 
| 156 | 
            -
                    end
         | 
| 157 | 
            -
                    return cached
         | 
| 158 | 
            -
                  end
         | 
| 159 | 
            -
             | 
| 160 | 
            -
                  i0 = index
         | 
| 161 | 
            -
                  if has_terminal?("NEW", false, index)
         | 
| 162 | 
            -
                    r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
         | 
| 163 | 
            -
                    @index += 3
         | 
| 164 | 
            -
                  else
         | 
| 165 | 
            -
                    terminal_parse_failure("NEW")
         | 
| 166 | 
            -
                    r1 = nil
         | 
| 167 | 
            -
                  end
         | 
| 168 | 
            -
                  if r1
         | 
| 169 | 
            -
                    r0 = r1
         | 
| 170 | 
            -
                  else
         | 
| 171 | 
            -
                    if has_terminal?("NEWRESOLVE", false, index)
         | 
| 172 | 
            -
                      r2 = instantiate_node(SyntaxNode,input, index...(index + 10))
         | 
| 173 | 
            -
                      @index += 10
         | 
| 174 | 
            -
                    else
         | 
| 175 | 
            -
                      terminal_parse_failure("NEWRESOLVE")
         | 
| 176 | 
            -
                      r2 = nil
         | 
| 177 | 
            -
                    end
         | 
| 178 | 
            -
                    if r2
         | 
| 179 | 
            -
                      r0 = r2
         | 
| 180 | 
            -
                    else
         | 
| 181 | 
            -
                      if has_terminal?("REMAP", false, index)
         | 
| 182 | 
            -
                        r3 = instantiate_node(SyntaxNode,input, index...(index + 5))
         | 
| 183 | 
            -
                        @index += 5
         | 
| 184 | 
            -
                      else
         | 
| 185 | 
            -
                        terminal_parse_failure("REMAP")
         | 
| 186 | 
            -
                        r3 = nil
         | 
| 187 | 
            -
                      end
         | 
| 188 | 
            -
                      if r3
         | 
| 189 | 
            -
                        r0 = r3
         | 
| 190 | 
            -
                      else
         | 
| 191 | 
            -
                        if has_terminal?("SENTCONNECT", false, index)
         | 
| 192 | 
            -
                          r4 = instantiate_node(SyntaxNode,input, index...(index + 11))
         | 
| 193 | 
            -
                          @index += 11
         | 
| 194 | 
            -
                        else
         | 
| 195 | 
            -
                          terminal_parse_failure("SENTCONNECT")
         | 
| 196 | 
            -
                          r4 = nil
         | 
| 197 | 
            -
                        end
         | 
| 198 | 
            -
                        if r4
         | 
| 199 | 
            -
                          r0 = r4
         | 
| 200 | 
            -
                        else
         | 
| 201 | 
            -
                          if has_terminal?("SENTRESOLVE", false, index)
         | 
| 202 | 
            -
                            r5 = instantiate_node(SyntaxNode,input, index...(index + 11))
         | 
| 203 | 
            -
                            @index += 11
         | 
| 204 | 
            -
                          else
         | 
| 205 | 
            -
                            terminal_parse_failure("SENTRESOLVE")
         | 
| 206 | 
            -
                            r5 = nil
         | 
| 207 | 
            -
                          end
         | 
| 208 | 
            -
                          if r5
         | 
| 209 | 
            -
                            r0 = r5
         | 
| 210 | 
            -
                          else
         | 
| 211 | 
            -
                            if has_terminal?("SUCCEEDED", false, index)
         | 
| 212 | 
            -
                              r6 = instantiate_node(SyntaxNode,input, index...(index + 9))
         | 
| 213 | 
            -
                              @index += 9
         | 
| 214 | 
            -
                            else
         | 
| 215 | 
            -
                              terminal_parse_failure("SUCCEEDED")
         | 
| 216 | 
            -
                              r6 = nil
         | 
| 217 | 
            -
                            end
         | 
| 218 | 
            -
                            if r6
         | 
| 219 | 
            -
                              r0 = r6
         | 
| 220 | 
            -
                            else
         | 
| 221 | 
            -
                              if has_terminal?("FAILED", false, index)
         | 
| 222 | 
            -
                                r7 = instantiate_node(SyntaxNode,input, index...(index + 6))
         | 
| 223 | 
            -
                                @index += 6
         | 
| 224 | 
            -
                              else
         | 
| 225 | 
            -
                                terminal_parse_failure("FAILED")
         | 
| 226 | 
            -
                                r7 = nil
         | 
| 227 | 
            -
                              end
         | 
| 228 | 
            -
                              if r7
         | 
| 229 | 
            -
                                r0 = r7
         | 
| 230 | 
            -
                              else
         | 
| 231 | 
            -
                                if has_terminal?("CLOSED", false, index)
         | 
| 232 | 
            -
                                  r8 = instantiate_node(SyntaxNode,input, index...(index + 6))
         | 
| 233 | 
            -
                                  @index += 6
         | 
| 234 | 
            -
                                else
         | 
| 235 | 
            -
                                  terminal_parse_failure("CLOSED")
         | 
| 236 | 
            -
                                  r8 = nil
         | 
| 237 | 
            -
                                end
         | 
| 238 | 
            -
                                if r8
         | 
| 239 | 
            -
                                  r0 = r8
         | 
| 240 | 
            -
                                else
         | 
| 241 | 
            -
                                  if has_terminal?("DETACHED", false, index)
         | 
| 242 | 
            -
                                    r9 = instantiate_node(SyntaxNode,input, index...(index + 8))
         | 
| 243 | 
            -
                                    @index += 8
         | 
| 244 | 
            -
                                  else
         | 
| 245 | 
            -
                                    terminal_parse_failure("DETACHED")
         | 
| 246 | 
            -
                                    r9 = nil
         | 
| 247 | 
            -
                                  end
         | 
| 248 | 
            -
                                  if r9
         | 
| 249 | 
            -
                                    r0 = r9
         | 
| 250 | 
            -
                                  else
         | 
| 251 | 
            -
                                    @index = i0
         | 
| 252 | 
            -
                                    r0 = nil
         | 
| 253 | 
            -
                                  end
         | 
| 254 | 
            -
                                end
         | 
| 255 | 
            -
                              end
         | 
| 256 | 
            -
                            end
         | 
| 257 | 
            -
                          end
         | 
| 258 | 
            -
                        end
         | 
| 259 | 
            -
                      end
         | 
| 260 | 
            -
                    end
         | 
| 261 | 
            -
                  end
         | 
| 262 | 
            -
             | 
| 263 | 
            -
                  node_cache[:StreamStatus][start_index] = r0
         | 
| 264 | 
            -
             | 
| 265 | 
            -
                  r0
         | 
| 266 | 
            -
                end
         | 
| 267 | 
            -
             | 
| 268 | 
            -
                module Target0
         | 
| 269 | 
            -
                end
         | 
| 270 | 
            -
             | 
| 271 | 
            -
                def _nt_Target
         | 
| 272 | 
            -
                  start_index = index
         | 
| 273 | 
            -
                  if node_cache[:Target].has_key?(index)
         | 
| 274 | 
            -
                    cached = node_cache[:Target][index]
         | 
| 275 | 
            -
                    if cached
         | 
| 276 | 
            -
                      cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
         | 
| 277 | 
            -
                      @index = cached.interval.end
         | 
| 278 | 
            -
                    end
         | 
| 279 | 
            -
                    return cached
         | 
| 280 | 
            -
                  end
         | 
| 281 | 
            -
             | 
| 282 | 
            -
                  i0, s0 = index, []
         | 
| 283 | 
            -
                  s1, i1 = [], index
         | 
| 284 | 
            -
                  loop do
         | 
| 285 | 
            -
                    if has_terminal?('\G[$0-9a-zA-Z\\.\\-]', true, index)
         | 
| 286 | 
            -
                      r2 = true
         | 
| 287 | 
            -
                      @index += 1
         | 
| 288 | 
            -
                    else
         | 
| 289 | 
            -
                      r2 = nil
         | 
| 290 | 
            -
                    end
         | 
| 291 | 
            -
                    if r2
         | 
| 292 | 
            -
                      s1 << r2
         | 
| 293 | 
            -
                    else
         | 
| 294 | 
            -
                      break
         | 
| 295 | 
            -
                    end
         | 
| 296 | 
            -
                  end
         | 
| 297 | 
            -
                  if s1.empty?
         | 
| 298 | 
            -
                    @index = i1
         | 
| 299 | 
            -
                    r1 = nil
         | 
| 300 | 
            -
                  else
         | 
| 301 | 
            -
                    r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
         | 
| 302 | 
            -
                  end
         | 
| 303 | 
            -
                  s0 << r1
         | 
| 304 | 
            -
                  if r1
         | 
| 305 | 
            -
                    if has_terminal?(":", false, index)
         | 
| 306 | 
            -
                      r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
         | 
| 307 | 
            -
                      @index += 1
         | 
| 308 | 
            -
                    else
         | 
| 309 | 
            -
                      terminal_parse_failure(":")
         | 
| 310 | 
            -
                      r3 = nil
         | 
| 311 | 
            -
                    end
         | 
| 312 | 
            -
                    s0 << r3
         | 
| 313 | 
            -
                    if r3
         | 
| 314 | 
            -
                      s4, i4 = [], index
         | 
| 315 | 
            -
                      loop do
         | 
| 316 | 
            -
                        if has_terminal?('\G[0-9]', true, index)
         | 
| 317 | 
            -
                          r5 = true
         | 
| 318 | 
            -
                          @index += 1
         | 
| 319 | 
            -
                        else
         | 
| 320 | 
            -
                          r5 = nil
         | 
| 321 | 
            -
                        end
         | 
| 322 | 
            -
                        if r5
         | 
| 323 | 
            -
                          s4 << r5
         | 
| 324 | 
            -
                        else
         | 
| 325 | 
            -
                          break
         | 
| 326 | 
            -
                        end
         | 
| 327 | 
            -
                      end
         | 
| 328 | 
            -
                      if s4.empty?
         | 
| 329 | 
            -
                        @index = i4
         | 
| 330 | 
            -
                        r4 = nil
         | 
| 331 | 
            -
                      else
         | 
| 332 | 
            -
                        r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
         | 
| 333 | 
            -
                      end
         | 
| 334 | 
            -
                      s0 << r4
         | 
| 335 | 
            -
                    end
         | 
| 336 | 
            -
                  end
         | 
| 337 | 
            -
                  if s0.last
         | 
| 338 | 
            -
                    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
         | 
| 339 | 
            -
                    r0.extend(Target0)
         | 
| 340 | 
            -
                  else
         | 
| 341 | 
            -
                    @index = i0
         | 
| 342 | 
            -
                    r0 = nil
         | 
| 343 | 
            -
                  end
         | 
| 344 | 
            -
             | 
| 345 | 
            -
                  node_cache[:Target][start_index] = r0
         | 
| 346 | 
            -
             | 
| 347 | 
            -
                  r0
         | 
| 348 | 
            -
                end
         | 
| 349 | 
            -
             | 
| 350 | 
            -
              end
         | 
| 351 | 
            -
             | 
| 352 | 
            -
              class StreamListsParser < Treetop::Runtime::CompiledParser
         | 
| 353 | 
            -
                include StreamLists
         | 
| 354 | 
            -
              end
         | 
| 355 | 
            -
             | 
| 356 | 
            -
            end
         |