Raw string literals

Terminal symbol in the grammar: RSTR_LIT.

There are also raw string literals that are preceded with the letter r (or R) and are delimited by matching double quotes (just like ordinary string literals) and do not interpret the escape sequences. This is especially convenient for regular expressions or Windows paths:

  1. var f = openFile(r"C:\texts\text.txt") # a raw string, so ``\t`` is no tab

To produce a single “ within a raw string literal, it has to be doubled:

  1. r"a""b"

Produces:

  1. a"b

r”””” is not possible with this notation, because the three leading quotes introduce a triple quoted string literal. r””” is the same as “”” since triple quoted string literals do not interpret escape sequences either.