Closed hangingman closed 3 years ago
Maybe this would work for all end-of-line conventions:
<INITIAL>"#"[^\r\n]* /* skip */; /* BNFC: comment "#" */
<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 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
@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.
This rule generates
$ bnfc -m -cpp_stl sample.cf
following flex file
This is not working when I tried to read windows text file. I wish comment rule was customizable to use CRLF file.