How to put header file to .tab.h in Bison?

前端 未结 1 1715
抹茶落季
抹茶落季 2021-01-19 07:11

I wrote bison code header:

%{
#include \"foo.h\"
%}

And I defined a struct named \'Foo\' in header. I\'d like to use it as token type in Bi

相关标签:
1条回答
  • 2021-01-19 07:50

    For includes that should appear in both the .c and the .h file (before the definition for the %union), you should use %code requires { ... }. %{ ... } inserts code in the .c file only.

    For more information on the various %code options, you can look at the "Prologue Alternatives" chapter of the Bison docs.

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