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

Generated C++ parser does not allow whitespace to be a token #431

Closed
Arm-Mike opened this issue Dec 14, 2022 · 3 comments · Fixed by #432
Closed

Generated C++ parser does not allow whitespace to be a token #431

Arm-Mike opened this issue Dec 14, 2022 · 3 comments · Fixed by #432
Assignees
Labels
C++ C lexer Concerning the generated lexer regression in 2.9.0
Milestone

Comments

@Arm-Mike
Copy link

The following token definition generates bad C++ parser.

token Foo '\'' ["01x "]* '\'' ;

The lex file generated is <YYINITIAL>'( |0|1|x)*' yylval._string = strdup(yytext); return _SYMB_171; but it needs to be <YYINITIAL>'(\ |0|1|x)*' yylval._string = strdup(yytext); return _SYMB_171; for it to compile.

The make file reports the following error message

flex -Pasl_ -oLexer.C ASL.l
ASL.l:219: unrecognized rule
ASL.l:220: unrecognized rule
make: *** [Lexer.C] Error 1
@andreasabel andreasabel added bug C++ C lexer Concerning the generated lexer labels Dec 14, 2022
@andreasabel
Copy link
Member

andreasabel commented Dec 14, 2022

I can confirm that is broken for the C-family backends but works with the other backends (Haskell, Java, Ocaml).

It still works correctly in BNFC-2.8.4, so @Arm-Mike, if downgrading is an option for you, this could be a workaround.

@andreasabel
Copy link
Member

@Arm-Mike : I released the fix as 2.9.4.1 just now!

@andreasabel
Copy link
Member

Now on his way to Jerusalem, Jesus traveled along the border between Samaria and Galilee. As he was going into a village, ten men who had leprosy met him. They stood at a distance and called out in a loud voice, “Jesus, Master, have pity on us!”

 When he saw them, he said, “Go, show yourselves to the priests.” And as they went, they were cleansed.

 One of them, when he saw he was healed, came back, praising God in a loud voice.  He threw himself at Jesus’ feet and thanked him—and he was a Samaritan.

 Jesus asked, “Were not all ten cleansed? Where are the other nine? Has no one returned to give praise to God except this foreigner?” Then he said to him, “Rise and go; your faith has made you well.”

Quoted from Luke 17,11-19.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ C lexer Concerning the generated lexer regression in 2.9.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants