paradigmatic / Configrity

Simple, immutable and flexible configuration library for scala.
Other
132 stars 19 forks source link

#-comments not recognized #9

Closed triplem closed 12 years ago

triplem commented 12 years ago

During the test of an application, we had some comments in the configuration loaded via loadresource, like

# key =

The configuration is always complaining about the wrong assigment:

org.streum.configrity.io.StandardFormat$ParserException: [7.3] failure: `=' expected but `k' found
Rogach commented 12 years ago

I saw this one - if you add that "=" after "#", it starts complaining about missing "[".

Thus things start to work only when you have "#=[]" at the end of the file.

paradigmatic commented 12 years ago

Thanks for reporting the bugs. Unfortunately, I was unable to reproduce them. I wrote to new tests with your examples and everything is green (see the changeset SHA: 34c588d3ae16dc3634425a2f1190350d9f07ff92).

Can you please post a minimal configuration file which displays the errors ? I will try to correct them as soon as possible.

triplem commented 12 years ago
# key =

produces:

 org.streum.configrity.io.StandardFormat$ParserException: [4.3] failure: `=' expected but `k' found
#key =

produces:

org.streum.configrity.io.StandardFormat$ParserException: [4.7] failure: `[' expected but end of source found

I am working with version: "org.streum" %% "configrity-core" % "0.10.0"

paradigmatic commented 12 years ago

As stated in the wiki, the values which contain whitespaces must be quoted. In the test case you submitted, the problem arises because the value of baz = hello world must be quoted. If you replace it by baz = "hello world", it works as expected.

I think the error message is not clear enough, but currently I don't know how to make it more helpful. Any advice/contribution are welcome.