Ivan Krylov
2023-Mar-01 09:56 UTC
[Rd] tab-complete for non-syntactic names could attempt backtick-wrapping
? Wed, 1 Mar 2023 01:36:02 -0800 Michael Chirico via R-devel <r-devel at r-project.org> ?????:> +comps[non_syntactic] <- paste0("`", comps[non_syntactic], "`")There are a few more corner cases. For example, comps could contain backticks (which should be escaped with backslashes) and backslashes (which should also be escaped). Thankfully, \uXXXX-style Unicode escape sequences are not currently supported inside backticks, and "escape the backslash" rule already takes care of them. The deparse() function already knows these rules: name <- 'hello world ` \\uFF' cat(deparse1(as.name(name), backtick=TRUE), '\n') # `hello world \` \\uFF` `hello world \` \\uFF` <- 'hello' `hello world \` \\uFF` # [1] "hello" -- Best regards, Ivan
Michael Chirico
2023-Mar-01 16:48 UTC
[Rd] tab-complete for non-syntactic names could attempt backtick-wrapping
Great suggestion! I've started a patch: https://bugs.r-project.org/show_bug.cgi?id=18479 On Wed, Mar 1, 2023 at 1:56 AM Ivan Krylov <krylov.r00t at gmail.com> wrote:> > ? Wed, 1 Mar 2023 01:36:02 -0800 > Michael Chirico via R-devel <r-devel at r-project.org> ?????: > > > +comps[non_syntactic] <- paste0("`", comps[non_syntactic], "`") > > There are a few more corner cases. For example, comps could contain > backticks (which should be escaped with backslashes) and backslashes > (which should also be escaped). Thankfully, \uXXXX-style Unicode escape > sequences are not currently supported inside backticks, and "escape the > backslash" rule already takes care of them. > > The deparse() function already knows these rules: > > name <- 'hello world ` \\uFF' > cat(deparse1(as.name(name), backtick=TRUE), '\n') > # `hello world \` \\uFF` > `hello world \` \\uFF` <- 'hello' > `hello world \` \\uFF` > # [1] "hello" > > -- > Best regards, > Ivan
Apparently Analagous Threads
- tab-complete for non-syntactic names could attempt backtick-wrapping
- tab-complete for non-syntactic names could attempt backtick-wrapping
- Backtick Hickup
- Backticks wrapping SQL values in polymorphic associations...
- Newbie: undefined method (backtick)body(quote) equals error