Chr*_*odd 16
您可以使用flex EOF规则将换行符附加到输入:
<<EOF>> { static int once = 0; return once++ ? 0 : '\n' }
Run Code Online (Sandbox Code Playgroud)
在你的 lex 文件中
#define yyterminate() return token::END
Run Code Online (Sandbox Code Playgroud)
在你的 yacc 文件中
%token END 0 "end of file"
Run Code Online (Sandbox Code Playgroud)