手册上明确写着:
YYSETSTATE (s)
[...]
The parameter to YYSETSTATE is a signed integer that uniquely identifies
the specific instance of YYFILL (n) that is about to be called.
[...]
问题是,我正在从野牛解析器调用我的 YYSETSTATE 定义的宏。我如何在不知道integer
UI 的情况下开始一个状态?换句话说,我怎样才能获得我想要开始的状态的标识符。
在词法分析器上:
<MY_STATE>{NAME} {
return FN_NAME;
}
在解析器上:
expr: { push_state( ? ) } /* what's the identifier of MY_STATE? */
'(' FN_NAME VALUE VALUE ')' { compile_expr($2, $3, $4); }
;