#Lex simplification help

2 messages · Page 1 of 1 (latest)

acoustic umbra
#

Hello there, I'm in a situation where I need to write something like this
(in a .lex file)

"printf"                    { return PRINTFF; }
"scanf"                     { return SCANFF; }
"int"                       { return INT; }
"float"                     { return FLOAT; }
"char"                      { return CHAR; }
"void"                      { return VOID; }
"return"                    { return RETURN; }
"for"                        { return FOR; }
"if"                        { return IF; }
"else"                        { return ELSE; }

And i wanted to know if I can simplify this by using a X macros or something similar to this ?

I have done something that you can check with the file but I have no idea how I can exploit this because I've nerver touched Lex before.

Thanks in advance !

fickle abyssBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.