I have a generator scanner from Flex, which is not used by yax or bison. Instead of giving Yylex () a token-type signal, a token-like structure gives an indicator on the memory.
Of course, the compilation warns me Returns an integer without indicating an artist.
I read in Flex man pages how YY_DECL declares the scanning routine:
YY_DECL < / Code> controls how the scanning routine is declared by default, "". This definition can change by redefining the "int yylex ()" or, if prototype is being used, "int yylex (zero) ) YY_DECL" macro.
When I try to redefine YY_DECL , the resulting file fails to compile.
#undef YY_DECL #define YY_DECL (token *) yylex () What am I trying to do, what is the right way to accomplish this is ?
Normal syntax will be:
#define YY_DECL token * Yylex ( Zero) This minimum Flex source file shows that:
% {typedef struct token {int tok; } Tokens; # Defined YY_DECL token * yylex (zero) token t; %} %% {T.tok = 1; Return & amp; T; } %% This is compiled for me.
Comments
Post a Comment