I wrote a simple lex file to define C keywords. My rules look like this:
keyword do|while|char|if
%%
{keyword} { printf("Keyword %s found.", yytext); }
A problem in a rule correctly identifies charin the source code, but also identifies things putcharlike the keyword char. How can I make a rule identify a keyword char, and not when it is present in other words?
source
share