I use Flex and Bison for the parser generator, but I have problems with the start states in my scanner.
I use exclusive rules for commenting, but this grammar does not seem to match the specified tokens:
%x COMMENT
<COMMENT>[^\n] ;
<COMMENT>\n { BEGIN(INITIAL); }
"==" { return EQUALEQUAL; }
. ;
In this simple example, the line:
does not fully match the comment unless I include this rule:
<COMMENT>"==" ;
How can I get around this without having to add all these tokens to my exclusive rules?
source
share