[Rd] [External] Include line number in the error messages regarding misuse of placeholder

iuke-tier@ey m@iii@g oii uiow@@edu iuke-tier@ey m@iii@g oii uiow@@edu
Thu Apr 21 18:47:38 CEST 2022


[Apologies for the late reply. About a month ago our wonderful
Exchange server apparently started to dump messages into Junk Email
again even though I had turned that "feature" off, and I just noticed
a couple of days ago.]

In principle I'd be happy to consider a simple patch to gram.y that
add line numbers. I can't see the benefit of a complicated patch that
makes the grammar even harder to maintain than it is already as being
worth the cost. If you can come up with a simple. well tested patch
please submit via bugzilla.

Best,

luke

On Mon, 21 Mar 2022, Kun Ren wrote:

> Hello, R maintainers,
>
> We are discussing the changes needed for code linting in the lintr package development for the upcoming placeholder in a pipe at <https://github.com/r-lib/lintr/issues/959>.
>
> First, thanks for implementing the feature!
>
> While I'm playing with it and see what we could do to improve in code linting for it, I notice that the error messages produced by the parser regarding the misuse of placeholder do not contain anything about the line number, which makes it hard to tell user which line of code causes this error.
>
> For example,
>
>    parse(text = "data |> fun(mpg ~ cyl, data1 = _, data2 = _)")
>
> produces the error "pipe placeholder may only appear once"
>
>    parse(text = "mtcars |> lm(mpg ~ cyl, data = fun(_))")
>
> produces the error "invalid use of pipe placeholder".
>
> Neither contains a line number. Michael Chirico tried to include the correct line number (https://github.com/r-lib/lintr/issues/959#issuecomment-1073389513), but it seems non-trivial to do so.
>
> We are wondering if it is possible to include a proper line number in these error messages, like some other messages that include it, so that user could know better about where the error occurs?
>
> Best regards,
> Kun Ren
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   luke-tierney using uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu



More information about the R-devel mailing list