Skip to content

[R] add new pipe from R 4.1

Hi,

A new syntax is allowed in R when you can do

Sys.setenv("_R_USE_PIPEBIND_"= TRUE)
mtcars |> x => lm(mpg ~ cyl, data = x)

So new operators are

  • |> pipe operator - syntax file already support %>% for magrittr package
  • => pipebind operator - still optional but it exists in R.

I am a Pandoc and R user and Pandoc uses KDE syntax file for its highlighting. It would be great to support this in KDE so that we can update downstream. This PR aims to add support for this.

I tested this syntax using Pandoc. Unfortunately, I don't have a KDE ready environment to test (e.g make & make test). I did not manage to set one easily. So I added some test, but did not produced the rendered file.

I am happy to change this if I can get help set this up. Otherwise, maybe it is easy for someone with already an environment to run the necessary command.

Also, I am not acquainted with KDE syntax file so I hope I got it right, but I am happy to take any comment from expert if this should be done differently.

thanks

Edited by christophe dervieux

Merge request reports