 require 'coffee-script'
 
+# ---
+
+to_value = (value) ->
+	return switch value
+		when 'none' then null
+		when 'on' then true
+		when 'off' then false
+		when 'true' then true
+		when 'false' then false
+		else value
+		
+to_object = (previous, current) ->
+	previous[key] = to_value(val) for key, val of current if current
+	
+	return previous
+	
+to_array = (previous, current) ->
+	previous.push({}) if previous.length == 0 or current == null
+	
+	previous[previous.length - 1][key] = to_value(val) for key, val of current if current
+	
+	return previous
+	
 # ---
 
 ###

		
		return JSON.parse("{#{line}}")
		
	to_value = (value) ->
		return switch value
			when 'none' then null
			when 'on' then true
			when 'off' then false
			else value
			
	to_object = (previous, current) ->
		previous[key] = to_value(val) for key, val of current if current
		
		return previous
		
	return input.split('\n').map(to_item).reduce(to_object)
	
		
		return JSON.parse("{#{line}}")
		
	return input.split('\n').map(to_item).reduce(to_array, []).filter((item) -> Object.keys(item).length > 0)
	
###
