Flex为什么说这是“无法识别的规则"? [英] Why does Flex say this is an "unrecognized rule"?
本文介绍了Flex为什么说这是“无法识别的规则"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下:
space ([ \t\f\r])+
opt_space ([ \t\f\r])*
cpp ^{opt_space}#{opt_space}
word [A-Za-z_][A-Za-z_0-9]*
arg_macro {cpp}define{space}{word}
/*arg_macro ^{opt_space}#{opt_space}define{space}{word}*/
%%
{arg_macro} ;
%%
我收到一条错误消息
test.l:9: unrecognized rule
如果我取消注释第二个版本的arg_macro
并注释第一个版本,则错误消息消失.
If I uncomment the second version of arg_macro
and comment the first one, the error message goes away.
有什么想法吗?
推荐答案
如果从cpp定义中删除^
,并将其放在arg_macro定义中,那么它很高兴.
If you remove the ^
from the cpp definition, and place it in the arg_macro definition, then it's happy.
space ([ \t\f\r])+
opt_space ([ \t\f\r])*
cpp {opt_space}#{opt_space}
word [A-Za-z_][A-Za-z_0-9]*
arg_macro ^{cpp}define{space}{word}
这篇关于Flex为什么说这是“无法识别的规则"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文