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

Fix for CRLF #5

Open
dougvalenta opened this issue May 5, 2024 · 1 comment · May be fixed by #8
Open

Fix for CRLF #5

dougvalenta opened this issue May 5, 2024 · 1 comment · May be fixed by #8

Comments

@dougvalenta
Copy link

Thanks for creating this library! I've been working with it for a couple of months, mostly using the event-based Parser API.

One thing I've noticed is that CRLF line endings are not working (I work on a Windows machine), in that they are resulting in double-line feeds (\n\n) in strings coming out of the library, and incorrect line numbers in Marks.

I believe the fix is very simple. Line 143 of scanner.rs (in read_line_break) should read:

if let ('\r', Some('\n')) = (front, self.buffer.get(1).copied()) {

Similar to line 111, and to the corresponding libyaml implementation (https://github.com/yaml/libyaml/blob/1e66c1e13a50577bd7ad76abec61ba436d0145bd/src/scanner.c#L533)

I cloned locally and made this change, and it did resolve my issue. I have not done any further testing. I'm happy to open a PR but I'm not sure if you're accepting contributions to this repo.

@simonask
Copy link
Owner

If this is still relevant, please do submit a PR, I would be happy to look at it. :-)

@dougvalenta dougvalenta linked a pull request Aug 25, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants