Skip to content

Commit 3a876df

Browse files
authoredDec 5, 2021
Julia: Added char token (#3223)
1 parent 5af1601 commit 3a876df

File tree

4 files changed

+39
-31
lines changed

4 files changed

+39
-31
lines changed
 

‎components/prism-julia.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ Prism.languages.julia = {
1111
greedy: true
1212
},
1313
'string': {
14-
// https://docs.julialang.org/en/v1/manual/strings/#man-characters-1
1514
// https://docs.julialang.org/en/v1/manual/strings/#String-Basics-1
1615
// https://docs.julialang.org/en/v1/manual/strings/#non-standard-string-literals-1
1716
// https://docs.julialang.org/en/v1/manual/running-external-programs/#Running-External-Programs-1
18-
pattern: /"""[\s\S]+?"""|(?:\b\w+)?"(?:\\.|[^"\\\r\n])*"|(^|[^\w'])'(?:\\[^\r\n][^'\r\n]*|[^\\\r\n])'|`(?:[^\\`\r\n]|\\.)*`/,
17+
pattern: /"""[\s\S]+?"""|(?:\b\w+)?"(?:\\.|[^"\\\r\n])*"|`(?:[^\\`\r\n]|\\.)*`/,
18+
greedy: true
19+
},
20+
'char': {
21+
// https://docs.julialang.org/en/v1/manual/strings/#man-characters-1
22+
pattern: /(^|[^\w'])'(?:\\[^\r\n][^'\r\n]*|[^\\\r\n])'/,
1923
lookbehind: true,
2024
greedy: true
2125
},

‎components/prism-julia.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'x'
2+
'\''
3+
'\u2200'
4+
'\x80'
5+
'\xe2\x88'
6+
'∀'
7+
8+
# not a character
9+
A'b
10+
A'b''
11+
12+
----------------------------------------------------
13+
14+
[
15+
["char", "'x'"],
16+
["char", "'\\''"],
17+
["char", "'\\u2200'"],
18+
["char", "'\\x80'"],
19+
["char", "'\\xe2\\x88'"],
20+
["char", "'∀'"],
21+
22+
["comment", "# not a character"],
23+
24+
"\r\nA",
25+
["operator", "'"],
26+
"b\r\nA",
27+
["operator", "'"],
28+
"b",
29+
["operator", "'"],
30+
["operator", "'"]
31+
]

‎tests/languages/julia/string_feature.test

+1-28
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22
"fo\"o"
33
"\xe2\x88"
44

5-
'x'
6-
'\''
7-
'\u2200'
8-
'\x80'
9-
'\xe2\x88'
10-
'∀'
11-
125
"""foo"""
136
"""fo"o
147
bar"""
@@ -22,24 +15,13 @@ b"DATA\xff\u2200"
2215
v"0.3-"
2316
raw"\\ \\\""
2417

25-
# not a character
26-
A'b
27-
A'b''
28-
2918
----------------------------------------------------
3019

3120
[
3221
["string", "\"\""],
3322
["string", "\"fo\\\"o\""],
3423
["string", "\"\\xe2\\x88\""],
3524

36-
["string", "'x'"],
37-
["string", "'\\''"],
38-
["string", "'\\u2200'"],
39-
["string", "'\\x80'"],
40-
["string", "'\\xe2\\x88'"],
41-
["string", "'∀'"],
42-
4325
["string", "\"\"\"foo\"\"\""],
4426
["string", "\"\"\"fo\"o\r\nbar\"\"\""],
4527

@@ -50,16 +32,7 @@ A'b''
5032
["string", "s\"\\g<0>1\""],
5133
["string", "b\"DATA\\xff\\u2200\""],
5234
["string", "v\"0.3-\""],
53-
["string", "raw\"\\\\ \\\\\\\"\""],
54-
55-
["comment", "# not a character"],
56-
"\r\nA",
57-
["operator", "'"],
58-
"b\r\nA",
59-
["operator", "'"],
60-
"b",
61-
["operator", "'"],
62-
["operator", "'"]
35+
["string", "raw\"\\\\ \\\\\\\"\""]
6336
]
6437

6538
----------------------------------------------------

0 commit comments

Comments
 (0)
Please sign in to comment.