Nothing Special   »   [go: up one dir, main page]

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

comment rule only support "\n", not support "\r\n" #376

Closed
hangingman opened this issue Aug 25, 2021 · 4 comments
Closed

comment rule only support "\n", not support "\r\n" #376

hangingman opened this issue Aug 25, 2021 · 4 comments
Assignees
Labels
C++ C invalid lexer Concerning the generated lexer OCaml Windows Issues concerning running on Windows

Comments

@hangingman
Copy link

This rule generates

comment "#" ;

$ bnfc -m -cpp_stl sample.cf

following flex file

<INITIAL>"#"[^\n]* /* skip */; /* BNFC: comment "#" */

This is not working when I tried to read windows text file. I wish comment rule was customizable to use CRLF file.

@andreasabel
Copy link
Member

Maybe this would work for all end-of-line conventions:

<INITIAL>"#"[^\r\n]* /* skip */; /* BNFC: comment "#" */

@andreasabel andreasabel added C C++ lexer Concerning the generated lexer Windows Issues concerning running on Windows OCaml labels Aug 26, 2021
@andreasabel andreasabel added this to the 2.9.3 milestone Aug 26, 2021
@andreasabel andreasabel self-assigned this Aug 26, 2021
@andreasabel
Copy link
Member
<INITIAL>"#"[^\n]* /* skip */; /* BNFC: comment "#" */

This is not working when I tried to read windows text file.

What is going wrong, actually? In theory, this should lex # followed by arbitrary characters, including CR, stopping at LF. If the line ending is CR/LF (rather than LF on *nix), this should also work.

@andreasabel andreasabel added the info-needed More information is needed from the bug reporter to confirm the issue. label Aug 26, 2021
andreasabel added a commit that referenced this issue Aug 26, 2021
However, I am not sure that changes anything, at least not on LF or
CR/LF systems.
@hangingman
Copy link
Author

@andreasabel
Sorry, the issue comment was my misunderstanding (maybe mixed up other issue...)
I have double-checked my EBNF generated executable on my home, CRLF is skipped and text parsed nicely.

So I will close this issue.
Thanks

@andreasabel andreasabel added invalid and removed info-needed More information is needed from the bug reporter to confirm the issue. labels Aug 27, 2021
@andreasabel
Copy link
Member

@hangingman Ok, good, that confirms my analysis!
While investigating, I found a problem in the Ocaml backend with CR characters, which I fixed (1ee2889). Good.

@andreasabel andreasabel removed this from the 2.9.3 milestone Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ C invalid lexer Concerning the generated lexer OCaml Windows Issues concerning running on Windows
Projects
None yet
Development

No branches or pull requests

2 participants