TwP / inifile

Native Ruby package for reading and writing INI files
http://codeforpeople.rubyforge.org/inifile
95 stars 47 forks source link

error with semicolons and multiline escaping #17

Closed trevor closed 10 years ago

trevor commented 11 years ago

Valid:

three   = hello \
multiline

Valid:

three   = "hello; \
multiline"

Valid:

three   = "hello;
multiline"

Invalid:

three   = hello; \
multiline
TwP commented 10 years ago

The semicolon is considered a comment character by default. So the invalid case truly is invalid since the \ character is part of the comment and it is not considered a newline continuation.

Your third case above is valid because the semicolon is inside a quoted string and not considered a comment character.

You can make that fourth case valid either by escaping the semicolon:

three   = hello\; \
multiline

or by configuring the IniFile parser to treat semicolons as a regular character:

inifile = IniFile.new(:filename => "file.ini", :comment => "#")