Hi onf,

At 2024-11-03T03:56:23+0100, onf wrote:
> On Sun Nov 3, 2024 at 2:53 AM CET, onf wrote:
> > changing the escape character hasn't occured to me, that's clever!
> > Unfortunately it doesn't work -- groff won't allow me to set the
> > escape character to a control one, and I cannot use some obscure
> > unicode glyph because it must be ASCII... I could disable escaping,
> > but that seems to break embedding comments etc. from what I've tried.
> 
> Ugh, I should have taken more time to reply -- I missed the fact that
> groff doesn't consider DEL a control character. Thanks for the hack,
> it works...

Glad to hear it!  Let me put on a familiar hat and suggest that you use
different terminology, though.

In *roff, a "control character" is something that the formatter
recognizes as starting a "control line".  Using the same term to refer
to properties of characters from the encoding your system uses can lead
to confusion.  Except when the formatter is expecting a control line
(at the start of an input line or the consequent of a control flow
request), control characters have no special meaning.

In *roff, there are two (and only two) "control characters": `.` and
`'`.[1]

You can use `'` as a delimiter in a delimited escape sequence or
formatted output comparison, and most people and examples do--even
though it's the default no-break control character.

You _can't_ use '.' as a delimiter, not because it's the default control
character, but because it is valid in a numeric expression.

groff(7):
Delimiters
...
       Finally, the escape sequences \D, \h, \H, \l, \L, \N, \R, \s, \S,
       \v, and \x prohibit delimiters that are meaningful in numeric
       expressions, because they accept such expressions as (or within)
       arguments.

              •  the numerals 0–9 and the decimal point “.”

              •  the (single‐character) operators +-/*%<>=&:()|

              •  any escape sequences other than \%, \:, \{, \}, \', \`,
                 \-, \_, \!, \/, \c, \e, and \p

I see I need to mention the formatted output comparison operator there.

The reason DEL works is not because it is or isn't a control character,
but because it's a valid input character, like ^B, ^C, and several
others.  (Historically, ^G was popular in attempts to avoid the problem
in the next paragraph.)

> I am dumbfounded that it doesn't trip when I try to test against the
> same character that's used as comparand delimiter either.[1]

Right.  I also think I addressed this point in my previous reply.  In
groff documentation I refer to this as "interpolation depth"; inside the
formatter source it's often called the "input level", which I think is
less clear.

Regards,
Branden

[1] In groff 1.24, the formatter enforces the invariant that the control
    character, no-break control character, and escape character are all
    distinct.  At present, you can get the formatter into an ill-defined
    state by perversely attempting to make any two of them the same.

Attachment: signature.asc
Description: PGP signature

Reply via email to