tech@mandoc.bsd.lv
 help / color / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: "Anthony J. Bentley" <anthony@anjbe.name>
Cc: tech@mandoc.bsd.lv
Subject: Re: Incorrect column count in lint messages
Date: Fri, 14 Feb 2020 18:06:09 +0100
Message-ID: <20200214170609.GF92189@athene.usta.de> (raw)
In-Reply-To: <21953-1581656851.930227@-SgG.yrqY.5jf->

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

      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14  5:07 Anthony J. Bentley
2020-02-14 17:06 ` Ingo Schwarze [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200214170609.GF92189@athene.usta.de \
    --to=schwarze@usta.de \
    --cc=anthony@anjbe.name \
    --cc=tech@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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