EOF is not reached in non-INITIAL state


(Previously I added ill-formed ticket. Since I don't know how to delete, I now change it content to valid one, sorry for confusion).

Consider such rules (see the attached file).

Uncomment/comment the line which switches STR state. In initial state EOF is reached, in non-INITIAL state it is not, and thus the user is not able to run any on-EOF code (yes, I know the trick with moving the code to the main part, out of scope of lexer).

file attachments


k_john_gough wrote Nov 6, 2012 at 3:26 AM

Dear macias

First up: regarding your initial query. You are incorrect - the dot character within quotes is just an ordinary character not the "any but \n" metacharacter. See the log file attached.

For your current issue note the following: Your example does not compile with gplex. It needs at least a namespace declaration.

The real issue is that you have defined STR as an exclusive start state. The <<EOF>> rule is only active in the INITIAL state. If you want it to be active in the STR state you can do one of two things: mark STR as an inclusive state "%s", that is, included in the initial state; or you can mark the EOF rule as applying to all states, as in,
<*><<EOF>> { ... }
You will find both of these work.

macias wrote Nov 7, 2012 at 7:19 AM

Thank you for your explanation. I think it would be useful to note in documentation, that <<EOF>> can be marked with states as other rules.

wrote Feb 14, 2013 at 1:43 AM