[Flex-help] Are Mulitple EOF's allowed
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Arthur S. <asc...@at...> - 2013-11-05 14:45:23
|
The following code yields the following comment: "gumdrop.lex:9: multiple <<EOF>> rules for start condition EOLCOMMENT" If <EOLCOMMENT><<EOF>> is placed outside of the <EOLCOMMENT>{ scope the same error message is given. Is there any way of using multiple <<EOF>> patterns? Section 12 End-Of-File Rules says that this is possible. Is there anything wrong with my code? I don't understand what I can do and without some way of detecting <<EOF>> patterns I have problems with multiple input buffers/files since restoring a lexer environment retains the last lexer state if an included files. Therefore, returning to a previous environment starts with the last state of the replaced environment. If the replaced file contains an unterminating, e.g., string or comment, then returning to a previous environment continues trying to detect a string or comment or etc. This leads to some issues for me. Do I have to use a kludge and always return to INITIAL when I restore an environment, and how can I do that? art -------------- code -------------- %x EOLCOMMENT %% <<EOF>> return 0; <EOLCOMMENT>{ .** \n <<EOF>> BEGIN(INITIAL); } /* <EOLCOMMENT> */ |