"Joel E. Denny" <[EMAIL PROTECTED]> writes:
> %{
> /* A block for the non-header pre-prologue. */
> /* For Yacc portability, Bison doesn't put this in the header file. */
> %}
> %header{
> /* A block for the header pre-prologue. */
> /* This is the right place to declare %union dependencies. */
> %}
> %union {
> /* If you don't declare a %union, Bison will not generate any
> post-prologues. */
> }
> %header{
> /* A block for the header post-prologue. */
> /* If you want something in the header file and it depends on
> Bison-generated definitions, put it here. */
> %}
> %{
> /* A block for the non-header post-prologue. */
> /* If you want something in your code file but *not* in your header file
> and it depends on Bison-generated definitions, put it here. */
> %}
A nice solution but whew! it's kinda complicated when you step back
and look at it.
Is there any reason one might want to put %header anywhere other than
immediately before or after %union? If not, another possibility is to
extend the %union syntax to allow three operands, not one. Or if
that's too weird, the new %header syntax could be used _instead_ of
%union, and could have three operands.