Skip to content
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

Parser fails if the last line is a comment #102

Closed
movermeyer opened this issue Oct 12, 2016 · 1 comment
Closed

Parser fails if the last line is a comment #102

movermeyer opened this issue Oct 12, 2016 · 1 comment
Labels

Comments

@movermeyer
Copy link
Contributor

@movermeyer movermeyer commented Oct 12, 2016

The grammar fails to parse files where the last line is a comment.

Example:

foo: "1"
bar: "2"
#DO NOT CHANGE ANY OF THE ABOVE SETTINGS!

Gives the exception:

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    config = ConfigFactory.parse_string(input)
  File "/<redacted>/pyhocon/config_parser.py", line 90, in parse_string
    return ConfigParser().parse(content, basedir, resolve)
  File "/<redacted>/pyhocon/config_parser.py", line 273, in parse
    config = config_expr.parseString(content, parseAll=True)[0]
  File "/<redacted>/env/lib/python2.7/site-packages/pyparsing.py", line 1617, in parseString
    raise exc
pyparsing.ParseSyntaxException: No match found for Suppress:(W:(
)) (at char 1), (line:1, col:2)

The HOCON spec does not say this isn't allowed, so it should parse correctly as a comment.

@darthbear darthbear added the bug label Dec 2, 2016
darthbear added a commit that referenced this issue Dec 3, 2016
darthbear added a commit that referenced this issue Dec 4, 2016
Fixed case where last line is a comment #102
@darthbear
Copy link
Member

@darthbear darthbear commented Dec 4, 2016

Thanks @movermeyer for reporting that issue. It's now fixed and pushed to pyhocon==0.3.35. Thanks!

@darthbear darthbear closed this Dec 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants