[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] condition: OR of two string comparisons
From: |
James K. Lowden |
Subject: |
Re: [Groff] condition: OR of two string comparisons |
Date: |
Sun, 16 Nov 2014 14:22:30 -0500 |
On Sun, 16 Nov 2014 15:17:14 +0100
Tadziu Hoffmann <address@hidden> wrote:
> > [...] maybe we should bear in mind having a .elif and .else
> > too that don't need the .ifx to be .iex.
>
> I don't think that's possible. Since the code can't look ahead,
> it will not know whether an else is coming or not, so the "if"
> has to know whether (.ie) or not (.if) to save the test outcome
> for a following "else".
Maybe I'm missing something, but from here it looks possible. True, you
need a stack, but not very much, and no look-ahead.
Every time you hit an "if", put T/F on the stack indicating the value of
"else". When you hit an else, do or don't, according to the saved
value. When you get to "end if", pop the value (whether or not an
"else" was found).
> Else we needlessly fill up the stack, which is simply bad design.
Depends on "fill" and "needlessly". Branches don't usually nest very
deeply, and "else" is useful functionality.
--jkl
- Re: [Groff] condition: OR of two string comparisons, (continued)
- Re: [Groff] condition: OR of two string comparisons, hohe72, 2014/11/15
- Re: [Groff] condition: OR of two string comparisons, Werner LEMBERG, 2014/11/15
- Re: [Groff] condition: OR of two string comparisons, Ralph Corderoy, 2014/11/16
- Re: [Groff] condition: OR of two string comparisons, Werner LEMBERG, 2014/11/17
- Re: [Groff] condition: OR of two string comparisons, Denis M. Wilson, 2014/11/17
- Re: [Groff] condition: OR of two string comparisons, Werner LEMBERG, 2014/11/19
- Re: [Groff] condition: OR of two string comparisons, Ralph Corderoy, 2014/11/17
- Re: [Groff] condition: OR of two string comparisons, Werner LEMBERG, 2014/11/17
- Re: [Groff] condition: OR of two string comparisons, hohe72, 2014/11/15
- Re: [Groff] condition: OR of two string comparisons, Tadziu Hoffmann, 2014/11/16
- Re: [Groff] condition: OR of two string comparisons,
James K. Lowden <=
- Re: [Groff] condition: OR of two string comparisons, Tadziu Hoffmann, 2014/11/17
- Re: [Groff] condition: OR of two string comparisons, Carsten Kunze, 2014/11/17
- Re: [Groff] condition: OR of two string comparisons, hohe72, 2014/11/18
- Re: [Groff] condition: OR of two string comparisons, Carsten Kunze, 2014/11/18
- Re: [Groff] condition: OR of two string comparisons, hohe72, 2014/11/18
- Re: [Groff] condition: OR of two string comparisons, Ted Harding, 2014/11/23
- Re: [Groff] condition: OR of two string comparisons, Steffen Nurpmeso, 2014/11/14
- Re: [Groff] condition: OR of two string comparisons, Denis M. Wilson, 2014/11/14
- Re: [Groff] condition: OR of two string comparisons, Steffen Nurpmeso, 2014/11/14
- Re: [Groff] condition: OR of two string comparisons, Carsten Kunze, 2014/11/13