New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blank lines cause parsing to end prematurely #2
Comments
xtaran
added a commit
to xtaran/configreader-simple
that referenced
this issue
Mar 1, 2020
Also slightmy modify test suite to also test this case by adding a leading blank line to the tested example string. Fixes briandfoy#2
xtaran
added a commit
to xtaran/configreader-simple
that referenced
this issue
Mar 1, 2020
xtaran
added a commit
to xtaran/configreader-simple
that referenced
this issue
Mar 1, 2020
Also slightly modify test suite to also test this case by adding a leading blank line to the tested example string. Fixes briandfoy#2
xtaran
added a commit
to xtaran/configreader-simple
that referenced
this issue
Mar 1, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code snippet (reduced from my actual code) does not work as expected:
It bails out as follows:
Reason seems to be this part of
parse_string()
, line 399 to 403:If a line contains just
\n
or\r\n
(which is chomped at line 400),$line
just contains the empty string which is interpreted as false in boolean context. Hence, in the example above, parsing ends at the very first (empty) line, completely ignoring the remainder of the string.But according to the POD, this should be possible:
(Besides, the "the first whitespace character is a #" should probably read "the first non-whitespace character is a #". Can open a separate issue or pull request for that if preferred.)
It seems as if using
defined()
around the assignment in line 403 fixes this:At least that fixed my case.
The text was updated successfully, but these errors were encountered: