Class: SCON::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/scon/parser.rb

Instance Method Summary collapse

Instance Method Details

#parse!(data) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/scon/parser.rb', line 4

def parse! data
  @data = data.bytes
  if @data[0] == 0xF1  # Has Key Lookup
    @keyassoc = []
    @data.shift
    while (temp = parse_inline_string(@data)) != false
      @keyassoc << temp
    end
  end

  if @data[0] == 0xF0    # Is a Hash
    @data.shift
    root = {}
    hash_parse_entries root
    return root
  else                  # Is an Array
    root = []
    array_parse_entries root
    return root
  end
end