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

Error reporting doesn't handle CRLF properly #153

Closed
17cupsofcoffee opened this issue Jan 22, 2017 · 1 comment
Closed

Error reporting doesn't handle CRLF properly #153

17cupsofcoffee opened this issue Jan 22, 2017 · 1 comment

Comments

@17cupsofcoffee
Copy link

Something I just noticed while implementing error reporting for my parser - every time I add a new line to my input file, the column number goes out of sync by +1 (and then eventually the line number too, when it hits the end of the line). That smelt of line ending weirdness to me, so I switched my editor from CRLF to LF - sure enough, everything lines back up.

So, in other words, it looks like pos_to_line in the generated code doesn't take into account the fact that a CRLF line ending is 2 bytes long. I'm guessing this hasn't been caught yet cause most people are using this library/Rust on Linux, where LF is the default.

This isn't a huge issue, as I can work around it by stripping out \r characters before the parsing stage, but I thought I should bring it to your attention at least!

Thanks for all your hard work on this library, by the way! By far the most fun I've had writing parsers ❤️

@17cupsofcoffee
Copy link
Author

Wow, that was fast, thanks :)

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

1 participant