tech@mandoc.bsd.lv
 help / color / 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, back to index

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

tech@mandoc.bsd.lv

Archives are clonable: git clone --mirror http://inbox.vuxu.org/mandoc-tech

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.mandoc.tech


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git