groff
[Top][All Lists]
Advanced

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

Re: [Groff] condition: OR of two string comparisons


From: Werner LEMBERG
Subject: Re: [Groff] condition: OR of two string comparisons
Date: Wed, 19 Nov 2014 08:33:43 +0100 (CET)

>> Having `.if x' instead of a new keyword `.ifx' is appealing to me.
> 
> Ok, sounds interesting.  Could also be used for .nr:
> 
> .nr <regname> x <expression>

Well, the idea is to set the a register to *avoid* additional syntax
stuff.  In other words, we could stay with

  .nr <regname> <expression>     ,

not needing `x' or something similar.

>> Assuming that we have a global register to activate a novel
>> interpretation of expressions (as suggested by Colin), we could
>> indeed simply stay with the currently available keywords.
> 
> But then the whole document has to be in the new syntax?

No.  Only the part where this register is set gets interpreted with
the new syntax.

Note that groff doesn't convert macros into an internal
representation; they are only stored and interpreted on demand (this
has both advantages and disadvantages).  Thus the need for `.de1' and
friends.

> That is ok for new documents, but what if one just one wants to add
> something using the new extression syntax?

Assuming we make register `.C' writable, it could be

  .nr \(.C 2
  ... modern syntax
  .nr \(.C 1
  ... compatibility mode
  .nr \(.C 0
  ... normal groff syntax

> (Anyway that new register does not hurt if it is additional.  But it
> may have advantages to decide per request which expression syntax is
> used.)

Mhmm.  Not sure whether this is a good idea.

>> Note, however, that it gets tricky if groff tries to execute
>> `modern' macros in compatibility mode (.cp 0), cf. `.de1' and
>> friends.
> 
> Would it not be correct to switch off the extended expressions in
> compatibility mode?  So there should be no clashes.

We already have a mechanism for executing groff extensions in
compatibility mode, so I think it would be reasonable to have the same
for handling the new expression mode.


    Werner



reply via email to

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