tests/testthat/references/strings.R

# ------------------------------------------------------------------------------
# strings

"foo"
"foo
bar"
"foo


bar"
"#"

'foo'
'#'

# ------------------------------------------------------------------------------
# strings without content

""
''

# ------------------------------------------------------------------------------
# strings with escape sequences

"\\"
"\ "
"\n"
"\t"
"\r"
"\""
'\''

"\0"
"\1"
"\7"
"\12"
"\123"
"\1234"

"\x1"
"\x01"
"\x012"

"\u1"
"\u01"
"\u001"
"\u0001"
"\u00011"

"\u{1}"
"\u{01}"
"\u{001}"
"\u{0001}"

"\U{1}"
"\U{01}"
"\U{001}"
"\U{0001}"
"\U{00001}"
"\U{000001}"
"\U{0000001}"
"\U{00000001}"

"\U1"
"\U01"
"\U001"
"\U0001"
"\U00001"
"\U000001"
"\U0000001"
"\U00000001"
"\U000000011"

"foo\"bar"
"foo\"bar\""
"foo\ "
"foo\
"

# ------------------------------------------------------------------------------
# invalid strings 1

"\u{00001}"

# ------------------------------------------------------------------------------
# invalid strings 2

"\U{000000001}"

# ------------------------------------------------------------------------------
# invalid strings 3

"\8"

# ------------------------------------------------------------------------------
# invalid strings 4

"\x"

# ------------------------------------------------------------------------------
# raw strings

r"(raw string)"
R"{another raw string}"
R"--[yet another ]- raw string]--"
r()

Try the treesitter.r package in your browser

Any scripts or data that you put into this service are public.

treesitter.r documentation built on Sept. 12, 2024, 7:06 a.m.