tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Incorrect column count in lint messages
@ 2020-02-14  5:07 Anthony J. Bentley
  2020-02-14 17:06 ` Ingo Schwarze
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony J. Bentley @ 2020-02-14  5:07 UTC (permalink / raw)
  To: tech

Hi,

Consider the following example:

.Dd
.Sh DESCRIPTION
.Oo lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod \
Ar Ns , Oc

When run through mandoc -Tlint, this warning appears:

    mandoc: /tmp/foo.1:4:78: WARNING: skipping no-space macro

The line number is correct, but the column count wrongly includes the
length of the previous line.

-- 
Anthony J. Bentley
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv

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

* Re: Incorrect column count in lint messages
  2020-02-14  5:07 Incorrect column count in lint messages Anthony J. Bentley
@ 2020-02-14 17:06 ` Ingo Schwarze
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Schwarze @ 2020-02-14 17:06 UTC (permalink / raw)
  To: Anthony J. Bentley; +Cc: tech

Hi Anthony,

Anthony J. Bentley wrote on Thu, Feb 13, 2020 at 10:07:31PM -0700:

> Consider the following example:
> 
> .Dd
> .Sh DESCRIPTION
> .Oo lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod \
> Ar Ns , Oc
> 
> When run through mandoc -Tlint, this warning appears:
> 
>     mandoc: /tmp/foo.1:4:78: WARNING: skipping no-space macro
> 
> The line number is correct, but the column count wrongly includes the
> length of the previous line.

That is very hard to fix because the trailing backslash requests joining
both lines before further parsing, which is done very early between
the read.c module and the roff(7) preprocessor.  By the time the
mdoc(7) parser gets to see the line, the information which parts
of the line originally were on which input line is no longer
available.  I don't see any way of fixing this short of storing
an input column number for every single character in the parse
buffer.

There are many more ways to get the input line preprocessed.
They all mangle the column count, for example:

   $ mandoc -mdoc -W all 
  .ds w longword
  .Em \*w Ns .     
  mandoc: <stdin>:2:14: WARNING: skipping no-space macro

The "Ns" is in column 9, not column 14.

I don't think it would be a good idea to even try to fix this.

Preprocessing is not very widespread in well-written manual pages
in the first place, even traling \ is usually best avoided (though
there are a few unusual circumstances where it makes sense), and
improving column numbers in messages eould hardly justify major
complications of the code.

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

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

end of thread, other threads:[~2020-02-14 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-14  5:07 Incorrect column count in lint messages Anthony J. Bentley
2020-02-14 17:06 ` 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).