bison's reduction didn't work as expected

后端 未结 1 551
心在旅途
心在旅途 2021-01-26 10:00

I\'m trying to write a EPL parser,so I\'m learning flex and bison.I try using it with following rules(SQL):

SELECT { cout<<\"SELECT detected\"<

        
相关标签:
1条回答
  • 2021-01-26 10:39

    You must create a copy of the token string (yytext) if you want to use it outside of the flex action. The string pointed to by yytext is a temporary value, and will be modified as soon as the lexer is re-entered.

    See the bison FAQ, the flex manual, or any number of SO questions (which are harder to search for because many of the questioners misdiagnose the problem).

    0 讨论(0)
提交回复
热议问题