Debian Codegraph @

tests/snippets/rust/test_rawstrings.txt

raw
1 ---input---
2 fn main() {
3 let raw_str = r"Escapes don't work
4
5 here: \x3F \u{211D}";
6 println!("{}", raw_str);
7
8 // If you need quotes in a raw string, add a pair of #s
9 let quotes = r#"And then I said:
10
11 "There is no escape!""#;
12 println!("{}", quotes);
13
14 // If you need "# in your string, just use more #s in the delimiter.
15 // There is no limit for the number of #s you can use.
16 let longer_delimiter = r###"A string
17 with "# in it. And even "##!"###;
18 println!("{}", longer_delimiter);
19 }
20
21 ---tokens---
22 'fn' Keyword
23 ' ' Text.Whitespace
24 'main' Name.Function
25 '(' Punctuation
26 ')' Punctuation
27 ' ' Text.Whitespace
28 '{' Punctuation
29 '\n' Text.Whitespace
30
31 ' ' Text.Whitespace
32 'let' Keyword.Declaration
33 ' ' Text.Whitespace
34 'raw_str' Name
35 ' ' Text.Whitespace
36 '=' Operator
37 ' ' Text.Whitespace
38 'r"Escapes don\'t work\n\n here: \\x3F \\u{211D}"' Literal.String
39 ';' Punctuation
40 '\n' Text.Whitespace
41
42 ' ' Text.Whitespace
43 'println!' Name.Function.Magic
44 '(' Punctuation
45 '"' Literal.String
46 '{}' Literal.String
47 '"' Literal.String
48 ',' Punctuation
49 ' ' Text.Whitespace
50 'raw_str' Name
51 ')' Punctuation
52 ';' Punctuation
53 '\n' Text.Whitespace
54
55 '\n' Text.Whitespace
56
57 ' ' Text.Whitespace
58 '// If you need quotes in a raw string, add a pair of #s\n' Comment.Single
59
60 ' ' Text.Whitespace
61 'let' Keyword.Declaration
62 ' ' Text.Whitespace
63 'quotes' Name
64 ' ' Text.Whitespace
65 '=' Operator
66 ' ' Text.Whitespace
67 'r#"And then I said:\n\n "There is no escape!""#' Literal.String
68 ';' Punctuation
69 '\n' Text.Whitespace
70
71 ' ' Text.Whitespace
72 'println!' Name.Function.Magic
73 '(' Punctuation
74 '"' Literal.String
75 '{}' Literal.String
76 '"' Literal.String
77 ',' Punctuation
78 ' ' Text.Whitespace
79 'quotes' Name
80 ')' Punctuation
81 ';' Punctuation
82 '\n' Text.Whitespace
83
84 '\n' Text.Whitespace
85
86 ' ' Text.Whitespace
87 '// If you need "# in your string, just use more #s in the delimiter.\n' Comment.Single
88
89 ' ' Text.Whitespace
90 '// There is no limit for the number of #s you can use.\n' Comment.Single
91
92 ' ' Text.Whitespace
93 'let' Keyword.Declaration
94 ' ' Text.Whitespace
95 'longer_delimiter' Name
96 ' ' Text.Whitespace
97 '=' Operator
98 ' ' Text.Whitespace
99 'r###"A string\n with "# in it. And even "##!"###' Literal.String
100 ';' Punctuation
101 '\n' Text.Whitespace
102
103 ' ' Text.Whitespace
104 'println!' Name.Function.Magic
105 '(' Punctuation
106 '"' Literal.String
107 '{}' Literal.String
108 '"' Literal.String
109 ',' Punctuation
110 ' ' Text.Whitespace
111 'longer_delimiter' Name
112 ')' Punctuation
113 ';' Punctuation
114 '\n' Text.Whitespace
115
116 '}' Punctuation
117 '\n' Text.Whitespace