diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 11:33:32 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 11:33:32 +0000 |
commit | 1f403ad2197fc7442409f434ee574f3e6b46fb73 (patch) | |
tree | 0299c6dd11d5edfa918a29b6456bc1875f1d288c /tests/snippets/rust/test_rawstrings.txt | |
parent | Initial commit. (diff) | |
download | pygments-1f403ad2197fc7442409f434ee574f3e6b46fb73.tar.xz pygments-1f403ad2197fc7442409f434ee574f3e6b46fb73.zip |
Adding upstream version 2.14.0+dfsg.upstream/2.14.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/snippets/rust/test_rawstrings.txt')
-rw-r--r-- | tests/snippets/rust/test_rawstrings.txt | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/tests/snippets/rust/test_rawstrings.txt b/tests/snippets/rust/test_rawstrings.txt new file mode 100644 index 0000000..69524f9 --- /dev/null +++ b/tests/snippets/rust/test_rawstrings.txt @@ -0,0 +1,117 @@ +---input--- +fn main() { + let raw_str = r"Escapes don't work + + here: \x3F \u{211D}"; + println!("{}", raw_str); + + // If you need quotes in a raw string, add a pair of #s + let quotes = r#"And then I said: + + "There is no escape!""#; + println!("{}", quotes); + + // If you need "# in your string, just use more #s in the delimiter. + // There is no limit for the number of #s you can use. + let longer_delimiter = r###"A string + with "# in it. And even "##!"###; + println!("{}", longer_delimiter); +} + +---tokens--- +'fn' Keyword +' ' Text +'main' Name.Function +'(' Punctuation +')' Punctuation +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'let' Keyword.Declaration +' ' Text.Whitespace +'raw_str' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'r"Escapes don\'t work\n\n here: \\x3F \\u{211D}"' Literal.String +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'println!' Name.Function.Magic +'(' Punctuation +'"' Literal.String +'{}' Literal.String +'"' Literal.String +',' Punctuation +' ' Text.Whitespace +'raw_str' Name +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +' ' Text.Whitespace +'// If you need quotes in a raw string, add a pair of #s\n' Comment.Single + +' ' Text.Whitespace +'let' Keyword.Declaration +' ' Text.Whitespace +'quotes' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'r#"And then I said:\n\n "There is no escape!""#' Literal.String +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'println!' Name.Function.Magic +'(' Punctuation +'"' Literal.String +'{}' Literal.String +'"' Literal.String +',' Punctuation +' ' Text.Whitespace +'quotes' Name +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +' ' Text.Whitespace +'// If you need "# in your string, just use more #s in the delimiter.\n' Comment.Single + +' ' Text.Whitespace +'// There is no limit for the number of #s you can use.\n' Comment.Single + +' ' Text.Whitespace +'let' Keyword.Declaration +' ' Text.Whitespace +'longer_delimiter' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'r###"A string\n with "# in it. And even "##!"###' Literal.String +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'println!' Name.Function.Magic +'(' Punctuation +'"' Literal.String +'{}' Literal.String +'"' Literal.String +',' Punctuation +' ' Text.Whitespace +'longer_delimiter' Name +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace |