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

Can't parse .toml file without newline at the end #20

Open
ghost opened this issue May 29, 2018 · 6 comments
Open

Can't parse .toml file without newline at the end #20

ghost opened this issue May 29, 2018 · 6 comments

Comments

@ghost
Copy link

ghost commented May 29, 2018

I don't really know if this is a bug or it's actually in TOML specification, but here's the repro code:

import parsetoml

let data = parseString("""
[general]
data = 1""") # Notice that there's no newline, with it everything works

echo data.getTable("general").getInt("data")
@PMunch
Copy link
Member

PMunch commented May 29, 2018

Oh strange, I thought I had fixed this. I won't be home until Friday, but if no one have done it by then I'll do it.

@ITwrx
Copy link

ITwrx commented May 8, 2023

i just had this same issue with 0.7.0.

invalid control char 0x00 found in a comment [TomlError]

added new line and it works.

I'm using a file instead of a string, if that matters.

let file = parsetoml.parseFile("file.toml")

@PMunch
Copy link
Member

PMunch commented May 8, 2023

Hmm, seems like a specific issue with comments perhaps, or a regression. I'm reopening this, but if it turns out to be something else it might be better to have it as a separate issue.

@PMunch PMunch reopened this May 8, 2023
@ITwrx
Copy link

ITwrx commented May 8, 2023

thanks. btw, the line it referenced was the last line of the file.

@ITwrx
Copy link

ITwrx commented May 8, 2023

i just deleted all comments and the newline at the end of the toml and it compiled and ran. not seeing any special requirements on comments in the toml docs, so i'm not sure what the problem is.

@PMunch
Copy link
Member

PMunch commented May 8, 2023

The problem is likely just that the part of the parser which does comments consumes the line ending while it shouldn't. Probably a fairly easy fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants