66"""fo"o
77// comment
88bar"""
9+ """{"name":"James"}"""
910"foo /* comment */ bar"
10- 'foo // bar'
11+
12+ s"Hello, $name"
13+ s"1 + 1 = ${1 + 1}"
14+ s"New offers starting at $$14.99"
15+ f"$name%s is $height%2.2f meters tall"
16+ json"{ name: $name, id: $id }"
1117
1218----------------------------------------------------
1319
@@ -17,10 +23,68 @@ bar"""
1723
1824 ["triple-quoted-string", "\"\"\"fo\"o\r\nbar\"\"\""],
1925 ["triple-quoted-string", "\"\"\"fo\"o\r\n// comment\r\nbar\"\"\""],
26+ ["triple-quoted-string", "\"\"\"{\"name\":\"James\"}\"\"\""],
2027 ["string", "\"foo /* comment */ bar\""],
21- ["string", "'foo // bar'"]
28+
29+ ["string-interpolation", [
30+ ["id", "s"],
31+ ["string", "\"Hello, "],
32+ ["interpolation", [
33+ ["punctuation", "$"],
34+ ["expression", ["name"]]
35+ ]],
36+ ["string", "\""]
37+ ]],
38+ ["string-interpolation", [
39+ ["id", "s"],
40+ ["string", "\"1 + 1 = "],
41+ ["interpolation", [
42+ ["punctuation", "${"],
43+ ["expression", [
44+ ["number", "1"],
45+ ["operator", "+"],
46+ ["number", "1"]
47+ ]],
48+ ["punctuation", "}"]
49+ ]],
50+ ["string", "\""]
51+ ]],
52+ ["string-interpolation", [
53+ ["id", "s"],
54+ ["string", "\"New offers starting at "],
55+ ["escape", "$$"],
56+ ["string", "14.99\""]
57+ ]],
58+ ["string-interpolation", [
59+ ["id", "f"],
60+ ["string", "\""],
61+ ["interpolation", [
62+ ["punctuation", "$"],
63+ ["expression", ["name"]]
64+ ]],
65+ ["string", "%s is "],
66+ ["interpolation", [
67+ ["punctuation", "$"],
68+ ["expression", ["height"]]
69+ ]],
70+ ["string", "%2.2f meters tall\""]
71+ ]],
72+ ["string-interpolation", [
73+ ["id", "json"],
74+ ["string", "\"{ name: "],
75+ ["interpolation", [
76+ ["punctuation", "$"],
77+ ["expression", ["name"]]
78+ ]],
79+ ["string", ", id: "],
80+ ["interpolation", [
81+ ["punctuation", "$"],
82+ ["expression", ["id"]]
83+ ]],
84+ ["string", " }\""]
85+ ]]
2286]
2387
2488----------------------------------------------------
2589
26- Checks for characters and strings.
90+ Checks for strings.
0 commit comments