bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] More %define/%code encapsulation


From: Joel E. Denny
Subject: Re: [PATCH] More %define/%code encapsulation
Date: Wed, 17 Jan 2007 02:06:09 -0500 (EST)

On Wed, 17 Jan 2007, Paolo Bonzini wrote:

> - for _if, I have "%define single_class" in Java if you want lexer and parser
> to reside in the same class.  And actually it would be better to extend it to
> accept "true" or "false" too, hence the _case.

How about b4_percent_define_if_true instead?  Given that we have _ifdef, 
_if seems like it ought to be like m4_if, which is not about booleans.

> - for _ifval, I'm thinking of
> 
> m4_define([b4_class_name], [b4_get_percent_code([package])dnl
> b4_get_percent_code_ifval([package], [.])$1])

Why not the following?

  m4_define([b4_class_name], [b4_percent_code_get([[package]])dnl
  m4_ifval(b4_percent_code_get([[package]]), [.])$1])

> - for _case, I'm thinking of a multi-value flag.

A direct use of m4_case seems sufficient.  I don't see a need for 
b4_percent_define_case.

> > > +# b4_percent_define_if(VARIABLE, IF-TRUE, IF-FALSE)
> > > +# -------------------------------------------------
> > > +# If the %define variable VARIABLE is defined to anything but 0, evaluate
> > > IF-TRUE.
> > > +# If it is defined to 0, evaluate IF-FALSE.
> > 
> > In my experience, an empty string also means false.
> 
> Except that I wanted to make the default of %define become empty rather than 1
> in a follow-up patch (disconnected from the Java skeleton).

To be clear, you mean that the no-value %define form:

  %define my_boolean_variable

is equivalent to:

  %define my_boolean_variable "1"

but you want it equivalent to:

  %define my_boolean_variable ""

Why?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]