Debian Codegraph @

tests/languages/bqn/strings.test

raw
1 "String Literal"
2 'c'
3 'not a string or character'
4 ""Not A String
5 ""Not A String""
6 """There is a double quote at the start of this string."
7 "'this is a string'"
8 "'c'"
9 # "Comment, not String"
10 "String, # Not Comment"
11 "
12
13 ----------------------------------------------------
14
15 [
16 ["string-literal", "\"String Literal\""],
17
18 ["character-literal", "'c'"],
19
20 "\r\n'",
21 ["word-name", "not"],
22 ["word-name", "a"],
23 ["word-name", "string"],
24 ["word-name", "or"],
25 ["word-name", "character"],
26 "'\r\n",
27
28 ["string-literal", "\"\""],
29 ["word-name", "Not"],
30 ["word-name", "A"],
31 ["word-name", "String"],
32
33 ["string-literal", "\"\""],
34 ["word-name", "Not"],
35 ["word-name", "A"],
36 ["word-name", "String"],
37 ["string-literal", "\"\""],
38
39 ["string-literal", "\"\"\"There is a double quote at the start of this string.\""],
40
41 ["string-literal", "\"'this is a string'\""],
42
43 ["string-literal", "\"'c'\""],
44
45 ["comment", "# \"Comment, not String\""],
46
47 ["string-literal", "\"String, # Not Comment\""],
48
49 "\r\n\""
50 ]
51
52 ----------------------------------------------------
53
54 Strings—lists of characters—are written with double quotes "", and characters
55 with single quotes '' with a single character in between. Only one character
56 ever needs to be escaped: a double quote in a string is written twice. So
57 """" is a one-character string of ", and if two string literals are next to
58 each other, they have to be separated by a space. Character literals don't
59 have even one escape, as the length is already known. Other than the double
60 quote, character and string literals can contain any character directly:
61 newlines, null characters, or other Unicode.