Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
[Bug] Including %type and %standalone produces uncompileable code [sf#93] #95
Reported by mcspanky on 2008-06-21 04:15 UTC
Here's the file I used; it could be stripped down more:
/* main character classes */
WhiteSpace = [ \t\f]
/* identifiers /
/* keywords */
/* end of line */
/* whitespace /
/* identifiers */
Commented by lsf37 on 2008-06-21 06:06 UTC
The description is correct. I'm inclined to say it's a feature, though. %standalone scanners are supposed to have return type int, in fact they are not supposed to return anything, but be filters only.
I should possibly make this a JFlex error message already and not let it occur at the compiler stage.
Is it possible that you are looking for %debug instead?
Commented by mcspanky on 2008-06-21 13:58 UTC
Yes, a better error message would be great. Basically I took one of the examples and was learning flex by modifying it various ways. You're right, %debug is probably what I should use. An error message would have saved me a lot of time and head scratching. Perhaps, when someone uses %standalone and another directive that's incompatible with it, the error message could suggest %debug?
Commented by mcspanky on 2008-06-21 14:02 UTC
By the way, the docs for %standalone say this:
To avoid having to use an extra token class, the scanning method will be declared as having default type int, not YYtoken (if there isn't any other type explicitly specified). This is in most cases irrelevant, but could be useful to know when making another scanner standalone for some purpose.
So, if you want to keep the ability to make another scanner standalone, you could have it return null instead of YYEOF. Either way is fine by me.