tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Corner case: mandoc doesn't require \& where it should
@ 2014-11-11 21:55 Steffen Nurpmeso
  2014-11-20  2:21 ` Ingo Schwarze
  0 siblings, 1 reply; 2+ messages in thread
From: Steffen Nurpmeso @ 2014-11-11 21:55 UTC (permalink / raw)
  To: tech

Hello Ingo, list,

(i stripped "has too much AI where it shouldn't" from Subject:)
imagine this,

  .Op Fl t Ar Sh | Ss

with mandoc you get

  mdocmx [-v] [-t Sh | Ss]

but with groff it is

  mdocmx [-v] [-t file ...

which is not nice but luckily it also echoes 

  Usage: .Sh not callable by other macros (#26)

which points out something correct since it really should be

  .Op Fl t Ar \&Sh | \&Ss

Really unfortunate is imho that -Tlint doesn't catch this.
Interestingly

  .Op Fl t Ar Sh | Ss | Ar du

gives

  mdocmx [-v] [-t Sh | Ss | du]

Ciao!

--steffen

--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Corner case: mandoc doesn't require \& where it should
  2014-11-11 21:55 Corner case: mandoc doesn't require \& where it should Steffen Nurpmeso
@ 2014-11-20  2:21 ` Ingo Schwarze
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Schwarze @ 2014-11-20  2:21 UTC (permalink / raw)
  To: Steffen Nurpmeso; +Cc: tech

Hi Steffen,

Steffen Nurpmeso wrote on Tue, Nov 11, 2014 at 10:55:16PM +0100:

>   .Op Fl t Ar Sh | Ss
> 
> with mandoc you get
> 
>   mdocmx [-v] [-t Sh | Ss]
> 
> but with groff it is
> 
>   mdocmx [-v] [-t file ...
> 
> which is not nice but luckily it also echoes 
> 
>   Usage: .Sh not callable by other macros (#26)
> 
> which points out something correct since it really should be
> 
>   .Op Fl t Ar \&Sh | \&Ss
> 
> Really unfortunate is imho that -Tlint doesn't catch this.

This is harder than it may seem, the rules which macros are
parsed and callable have changed in the past (in particular
groff relaxed them), i'm not aware that what should happen
when the rules are violated was ever written down, and even
though the implementation of all this is not particularly
complicated, it is non-trivial by its shere size, both in
mandoc and groff.

For now, i have added a todo entry:

- warn about attempts to call non-callable macros
  Steffen Nurpmeso  Tue, 11 Nov 2014 22:55:16 +0100
  Note that formatting is inconsistent in groff.
  .Fn Po prints "Po()", .Ar Sh prints "file ..." and no "Sh".
  Relatively hard because the relevant code is scattered
  all over mdoc_macro.c and all subtly different.
  loc **  exist **  algo **  size **  imp **

Yours,
  Ingo
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-20  2:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-11 21:55 Corner case: mandoc doesn't require \& where it should Steffen Nurpmeso
2014-11-20  2:21 ` Ingo Schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).