Skip to main content

r_string_escape

Function r_string_escape 

Source
pub(crate) fn r_string_escape(s: &str) -> String
Expand description

Escape s for the inside of an R double-quoted string literal. Every generated R string literal built from user text goes through this (the precondition requirement text and the author’s messages, the class names in inherits(), lifecycle arguments).

Besides \ and ", a newline, carriage return or tab becomes its escape (a guard stays on one line of the wrappers file), any other control character and every non-ASCII character a \u{..} / \U{..} escape: R code in a package must be ASCII, and R reads these escapes back to the same UTF-8 text. A NUL cannot be written (R strings cannot hold one); the attribute parser rejects it in a message.