# File lib/nginx_config_parser/scanner.rb, line 14
      def parse(data)
        # Stuff for Ragel
        data = data.unpack("c*") if data.is_a?(String)
        eof, stack = 0, []
        # The list of words to fill for identifiers and values
        words = []
        # The stack of contexts, used to accumulate data at
        # the appropriate level
        contexts = [Configuration.new]
        
# line 25 "src/scanner.rb"
class << self
        attr_accessor :_nginx_actions
        private :_nginx_actions, :_nginx_actions=
end
self._nginx_actions = [
        0, 1, 0, 1, 1, 1, 2, 1, 
        3, 1, 4, 1, 5, 1, 6, 1, 
        7, 1, 8, 1, 9, 1, 10, 1, 
        11, 1, 12, 1, 13, 1, 14, 1, 
        15
]

class << self
        attr_accessor :_nginx_key_offsets
        private :_nginx_key_offsets, :_nginx_key_offsets=
end
self._nginx_key_offsets = [
        0, 1, 5, 6, 11, 12, 13, 18, 
        21, 22, 23, 30, 35, 39, 42, 48
]

class << self
        attr_accessor :_nginx_trans_keys
        private :_nginx_trans_keys, :_nginx_trans_keys=
end
self._nginx_trans_keys = [
        10, 32, 40, 9, 13, 41, 32, 41, 
        123, 9, 13, 125, 10, 32, 35, 105, 
        9, 13, 32, 9, 13, 10, 102, 32, 
        35, 59, 123, 125, 9, 13, 32, 59, 
        123, 9, 13, 32, 125, 9, 13, 32, 
        9, 13, 10, 32, 59, 123, 9, 13, 
        32, 59, 123, 9, 13, 0
]

class << self
        attr_accessor :_nginx_single_lengths
        private :_nginx_single_lengths, :_nginx_single_lengths=
end
self._nginx_single_lengths = [
        1, 2, 1, 3, 1, 1, 3, 1, 
        1, 1, 5, 3, 2, 1, 4, 3
]

class << self
        attr_accessor :_nginx_range_lengths
        private :_nginx_range_lengths, :_nginx_range_lengths=
end
self._nginx_range_lengths = [
        0, 1, 0, 1, 0, 0, 1, 1, 
        0, 0, 1, 1, 1, 1, 1, 1
]

class << self
        attr_accessor :_nginx_index_offsets
        private :_nginx_index_offsets, :_nginx_index_offsets=
end
self._nginx_index_offsets = [
        0, 2, 6, 8, 13, 15, 17, 22, 
        25, 27, 29, 36, 41, 45, 48, 54
]

class << self
        attr_accessor :_nginx_indicies
        private :_nginx_indicies, :_nginx_indicies=
end
self._nginx_indicies = [
        2, 1, 3, 4, 3, 0, 5, 4, 
        5, 5, 6, 5, 4, 7, 6, 10, 
        9, 12, 13, 14, 12, 11, 12, 12, 
        15, 2, 1, 3, 16, 18, 19, 20, 
        21, 22, 18, 17, 23, 23, 23, 23, 
        17, 18, 25, 18, 24, 25, 25, 26, 
        10, 9, 9, 9, 9, 19, 25, 23, 
        23, 25, 17, 0
]

class << self
        attr_accessor :_nginx_trans_targs_wi
        private :_nginx_trans_targs_wi, :_nginx_trans_targs_wi=
end
self._nginx_trans_targs_wi = [
        6, 0, 6, 1, 2, 3, 4, 6, 
        10, 5, 10, 6, 7, 8, 9, 6, 
        6, 11, 12, 14, 10, 10, 15, 10, 
        10, 13, 10
]

class << self
        attr_accessor :_nginx_trans_actions_wi
        private :_nginx_trans_actions_wi, :_nginx_trans_actions_wi=
end
self._nginx_trans_actions_wi = [
        31, 0, 25, 0, 0, 0, 0, 21, 
        19, 0, 11, 23, 0, 5, 5, 29, 
        27, 0, 0, 5, 7, 9, 0, 13, 
        17, 0, 15
]

class << self
        attr_accessor :_nginx_to_state_actions
        private :_nginx_to_state_actions, :_nginx_to_state_actions=
end
self._nginx_to_state_actions = [
        0, 0, 0, 0, 0, 0, 1, 0, 
        0, 0, 1, 0, 0, 0, 0, 0
]

class << self
        attr_accessor :_nginx_from_state_actions
        private :_nginx_from_state_actions, :_nginx_from_state_actions=
end
self._nginx_from_state_actions = [
        0, 0, 0, 0, 0, 0, 3, 0, 
        0, 0, 3, 0, 0, 0, 0, 0
]

class << self
        attr_accessor :_nginx_eof_trans
        private :_nginx_eof_trans, :_nginx_eof_trans=
end
self._nginx_eof_trans = [
        1, 1, 1, 1, 1, 9, 0, 16, 
        17, 17, 0, 24, 25, 27, 24, 24
]

class << self
        attr_accessor :nginx_start
end
self.nginx_start = 6;
class << self
        attr_accessor :nginx_first_final
end
self.nginx_first_final = 6;
class << self
        attr_accessor :nginx_error
end
self.nginx_error = -1;

class << self
        attr_accessor :nginx_en_statement
end
self.nginx_en_statement = 10;
class << self
        attr_accessor :nginx_en_main
end
self.nginx_en_main = 6;

# line 68 "src/scanner.rl"
        
# line 176 "src/scanner.rb"
begin
        p ||= 0
        pe ||= data.length
        cs = nginx_start
        top = 0
        ts = nil
        te = nil
        act = 0
end
# line 69 "src/scanner.rl"
        
# line 188 "src/scanner.rb"
begin
        _klen, _trans, _keys, _acts, _nacts = nil
        _goto_level = 0
        _resume = 10
        _eof_trans = 15
        _again = 20
        _test_eof = 30
        _out = 40
        while true
        _trigger_goto = false
        if _goto_level <= 0
        if p == pe
                _goto_level = _test_eof
                next
        end
        end
        if _goto_level <= _resume
        _acts = _nginx_from_state_actions[cs]
        _nacts = _nginx_actions[_acts]
        _acts += 1
        while _nacts > 0
                _nacts -= 1
                _acts += 1
                case _nginx_actions[_acts - 1]
                        when 1 then
# line 1 "src/scanner.rl"
                begin
ts = p
                end
# line 1 "src/scanner.rl"
# line 219 "src/scanner.rb"
                end # from state action switch
        end
        if _trigger_goto
                next
        end
        _keys = _nginx_key_offsets[cs]
        _trans = _nginx_index_offsets[cs]
        _klen = _nginx_single_lengths[cs]
        _break_match = false
        
        begin
          if _klen > 0
             _lower = _keys
             _upper = _keys + _klen - 1

             loop do
                break if _upper < _lower
                _mid = _lower + ( (_upper - _lower) >> 1 )

                if data[p] < _nginx_trans_keys[_mid]
                   _upper = _mid - 1
                elsif data[p] > _nginx_trans_keys[_mid]
                   _lower = _mid + 1
                else
                   _trans += (_mid - _keys)
                   _break_match = true
                   break
                end
             end # loop
             break if _break_match
             _keys += _klen
             _trans += _klen
          end
          _klen = _nginx_range_lengths[cs]
          if _klen > 0
             _lower = _keys
             _upper = _keys + (_klen << 1) - 2
             loop do
                break if _upper < _lower
                _mid = _lower + (((_upper-_lower) >> 1) & ~1)
                if data[p] < _nginx_trans_keys[_mid]
                  _upper = _mid - 2
                elsif data[p] > _nginx_trans_keys[_mid+1]
                  _lower = _mid + 2
                else
                  _trans += ((_mid - _keys) >> 1)
                  _break_match = true
                  break
                end
             end # loop
             break if _break_match
             _trans += _klen
          end
        end while false
        _trans = _nginx_indicies[_trans]
        end
        if _goto_level <= _eof_trans
        cs = _nginx_trans_targs_wi[_trans]
        if _nginx_trans_actions_wi[_trans] != 0
                _acts = _nginx_trans_actions_wi[_trans]
                _nacts = _nginx_actions[_acts]
                _acts += 1
                while _nacts > 0
                        _nacts -= 1
                        _acts += 1
                        case _nginx_actions[_acts - 1]
when 2 then
# line 1 "src/scanner.rl"
                begin
te = p+1
                end
# line 1 "src/scanner.rl"
when 3 then
# line 20 "src/scanner.rl"
                begin
te = p+1
 begin 
            name = words.shift
            values = words.dup
            contexts.last[name] = value_of(values)
            words.clear
                begin
                top -= 1
                cs = stack[top]
                _trigger_goto = true
                _goto_level = _again
                break
        end

           end
                end
# line 20 "src/scanner.rl"
when 4 then
# line 31 "src/scanner.rl"
                begin
te = p+1
 begin  
                  name = words.shift
            values = words.dup
            contexts << contexts.last.section(name, value_of(values))
            words.clear
                begin
                stack[top] = cs
                top+= 1
                cs = 10
                _trigger_goto = true
                _goto_level = _again
                break
        end

           end
                end
# line 31 "src/scanner.rl"
when 5 then
# line 43 "src/scanner.rl"
                begin
te = p+1
                end
# line 43 "src/scanner.rl"
when 6 then
# line 28 "src/scanner.rl"
                begin
te = p
p = p - 1; begin  words << data[ts...te].pack('c*')  end
                end
# line 28 "src/scanner.rl"
when 7 then
# line 39 "src/scanner.rl"
                begin
te = p
p = p - 1; begin 
            contexts.pop
                begin
                top -= 1
                cs = stack[top]
                _trigger_goto = true
                _goto_level = _again
                break
        end

           end
                end
# line 39 "src/scanner.rl"
when 8 then
# line 43 "src/scanner.rl"
                begin
te = p
p = p - 1;              end
# line 43 "src/scanner.rl"
when 9 then
# line 28 "src/scanner.rl"
                begin
 begin p = ((te))-1; end
 begin  words << data[ts...te].pack('c*')  end
                end
# line 28 "src/scanner.rl"
when 10 then
# line 48 "src/scanner.rl"
                begin
te = p+1
                end
# line 48 "src/scanner.rl"
when 11 then
# line 50 "src/scanner.rl"
                begin
te = p+1
 begin  words.clear; p = p - 1;         begin
                stack[top] = cs
                top+= 1
                cs = 10
                _trigger_goto = true
                _goto_level = _again
                break
        end
  end
                end
# line 50 "src/scanner.rl"
when 12 then
# line 52 "src/scanner.rl"
                begin
te = p+1
                end
# line 52 "src/scanner.rl"
when 13 then
# line 50 "src/scanner.rl"
                begin
te = p
p = p - 1; begin  words.clear; p = p - 1;       begin
                stack[top] = cs
                top+= 1
                cs = 10
                _trigger_goto = true
                _goto_level = _again
                break
        end
  end
                end
# line 50 "src/scanner.rl"
when 14 then
# line 52 "src/scanner.rl"
                begin
te = p
p = p - 1;              end
# line 52 "src/scanner.rl"
when 15 then
# line 50 "src/scanner.rl"
                begin
 begin p = ((te))-1; end
 begin  words.clear; p = p - 1;         begin
                stack[top] = cs
                top+= 1
                cs = 10
                _trigger_goto = true
                _goto_level = _again
                break
        end
  end
                end
# line 50 "src/scanner.rl"
# line 439 "src/scanner.rb"
                        end # action switch
                end
        end
        if _trigger_goto
                next
        end
        end
        if _goto_level <= _again
        _acts = _nginx_to_state_actions[cs]
        _nacts = _nginx_actions[_acts]
        _acts += 1
        while _nacts > 0
                _nacts -= 1
                _acts += 1
                case _nginx_actions[_acts - 1]
when 0 then
# line 1 "src/scanner.rl"
                begin
ts = nil;               end
# line 1 "src/scanner.rl"
# line 460 "src/scanner.rb"
                end # to state action switch
        end
        if _trigger_goto
                next
        end
        p += 1
        if p != pe
                _goto_level = _resume
                next
        end
        end
        if _goto_level <= _test_eof
        if p == eof
        if _nginx_eof_trans[cs] > 0
                _trans = _nginx_eof_trans[cs] - 1;
                _goto_level = _eof_trans
                next;
        end
end
        end
        if _goto_level <= _out
                break
        end
        end
        end
# line 70 "src/scanner.rl"
        # This is a little more forgiving than
        # using <tt>pop</tt> and validating balance
        contexts.first
      end