这是我的一部分代码:
%option noyywrap
%option bison-bridge
%option reentrant
...
enum {
UNDEFINED = 1,
CREATE,
TABLE,
UPDATE,
SET,
INSERT,
INTO,
VALUES,
DELETE,
FROM,
SELECT,
GET,
PUT,
EXIST,
USER,
BEGIN,
COMMIT,
ROLLBACK
};
...
[Cc][Rr][Ee][Aa][Tt][Ee] RETURN_TOKEN(CREATE)
[Tt][Aa][Bb][Ll][Ee] RETURN_TOKEN(TABLE)
[Uu][Pp][Dd][Aa][Tt][Ee] RETURN_TOKEN(UPDATE)
[Ss][Ee][Tt] RETURN_TOKEN(SET)
[Ii][Nn][Ss][Ee][Rr][Tt] RETURN_TOKEN(INSERT)
[Ii][Nn][Tt]Oo RETURN_TOKEN(INTO)
但是,在正式编译的时候,还是出现了问题:
[beginnerc@fedora SimpleSQL]$ lex try.l
[beginnerc@fedora SimpleSQL]$ gcc lex.yy.c
lex.yy.c:145:18: error: expected ',' or '}' before '->' token
145 | */
| ^
try.l:32:5: note: in expansion of macro 'BEGIN'
32 | BEGIN,
| ^~~~~
lex.yy.c:559:5: error: unknown type name 'YYSTYPE'
559 |
| ^
lex.yy.c:606:1: error: unknown type name 'YYSTYPE'; did you mean 'YYSTATE'?
606 |
| ^
| YYSTATE
lex.yy.c:608:19: error: unknown type name 'YYSTYPE'; did you mean 'YYSTATE'?
608 |
| ^
| YYSTATE
lex.yy.c:726:17: error: unknown type name 'YYSTYPE'; did you mean 'YYSTATE'?
726 | extern int yylex \
| ^~
| YYSTATE
有没有同志可以给出修订的方法? 谢谢!