[Flex-help] Error changing yylex return.
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Fabricio S. P. <fab...@gm...> - 2016-02-29 22:06:23
|
Hello, I'm trying to change the default return value (int) from yylex to a structure. According to FLEX manual it's possible to change how yylex is declared[1]: >This definition may be changed by defining the YY_DECL macro. For >example, you could use: > > #define YY_DECL float lexscan( a, b ) float a, b; > In my flex file I declared this way: >#define YY_DECL struct token yylex(yyscan_t yyscanner) But after using this macro and compiling the final main program I got the following GCC error: >main.c: In function ‘main’: >main.c:14:7: error: incompatible types when assigning to type ‘struct >token’ from type ‘int’ > lol = yylex(scanner); Even after changing how yylex is declared the final result didn't change. After some search on the web I found this[2] stack overflow question, but I got the same error from GCC... Anybody can help? Here are some additional info: OS: Debian 8 64bit GCC: Debian 4.9.2-10 4.9.2 Flex: 2.5.39 And here are my source files: https://gist.github.com/anonymous/49beeae0d85b4a7f91d6 Thanks in advance. [1] http://flex.sourceforge.net/manual/Generated-Scanner.html#Generated-Scanner [2] https://stackoverflow.com/questions/3796598/returning-non-ints-from-yylex -- Fabrício S. Paranhos |