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: Steffen Nurpmeso
Subject: Re: [Groff] condition: OR of two string comparisons
Date: Thu, 13 Nov 2014 16:50:49 +0100
User-agent: s-nail v14.7.8-70-g9310369

Ralph Corderoy <address@hidden> wrote:
 |> Unfortunately, this also means inventing a new syntax.  How should
 |> "\*", "\(", and "\[" be treated -- as groff escapes or as
 |> regular-expression magic?
 |
 |Exactly.  Taking an earlier suggestion for OR, it's valid now.
 |
 |    $ nroff | grep .
 |    .if 'a'a'b'c'
 |    b’c’
 |    $
 |
 |However, a new syntax is needed.  I'd guess something at the start that
 |is currently invalid would indicate a whole new style of expression is
 |present, one with typical precedence, and more string matching
 |possibilities.

A really really ugly way of extending the current syntax today,
which possibly would do no harm in real life?, would be to let
a doubling of the delimiter mean that further tests follow, as in

 .if 'abc'def''ghi''not this''abc' .tm matches

I have no idea, but the attached patch should do this pretty well.
Note i'm running groff(1) with my [file_case] extension and
without GNULib, but it applies somewhat:

  address@hidden groff.git]$ gl1 15d0cd9 | s-patch  
  patching file src/roff/troff/input.cpp
  Hunk #1 succeeded at 5766 (offset 5 lines).
  address@hidden groff.git]$ 

I'm not sure i like this approach, though.
Ciao,

--steffen

Attachment: hohe72.diff
Description: Text Data


reply via email to

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