# File lib/puppet/util/inifile.rb, line 103
103:         def read(file)
104:             text = Puppet::Util::FileType.filetype(:flat).new(file).read
105:             if text.nil?
106:                 raise "Could not find #{file}"
107:             end
108: 
109:             section = nil   # The name of the current section
110:             optname = nil   # The name of the last option in section
111:             line = 0
112:             @files[file] = []
113:             text.each_line do |l|
114:                 line += 1
115:                 if l.strip.empty? || "#;".include?(l[0,1]) ||
116:                         (l.split(nil, 2)[0].downcase == "rem" &&
117:                          l[0,1].downcase == "r")
118:                     # Whitespace or comment
119:                     if section.nil?
120:                         @files[file] << l
121:                     else
122:                         section.add_line(l)
123:                     end
124:                 elsif " \t\r\n\f".include?(l[0,1]) && section && optname
125:                     # continuation line
126:                     section[optname] += "\n" + l.chomp
127:                 elsif l =~ /^\[([^\]]+)\]/
128:                     # section heading
129:                     section.mark_clean unless section.nil?
130:                     section = add_section($1, file)
131:                     optname = nil
132:                 elsif l =~ /^\s*([^\s=]+)\s*\=(.*)$/
133:                     # We allow space around the keys, but not the values
134:                     # For the values, we don't know if space is significant
135:                     if section.nil?
136:                         raise "#{file}:#{line}:Key/value pair outside of a section for key #{$1}"
137:                     else
138:                         section[$1] = $2
139:                         optname = $1
140:                     end
141:                 else
142:                     raise "#{file}:#{line}: Can't parse '#{l.chomp}'"
143:                 end
144:             end
145:             section.mark_clean unless section.nil?
146:         end