Skip to content
Permalink
Browse files
Julia: Added char token (#3223)
  • Loading branch information
RunDevelopment committed Dec 5, 2021
1 parent 5af1601 commit 3a876df01dcbda9d725b1d1f1b7bda6222753e4a
Showing with 39 additions and 31 deletions.
  1. +6 −2 components/prism-julia.js
  2. +1 −1 components/prism-julia.min.js
  3. +31 −0 tests/languages/julia/char_feature.test
  4. +1 −28 tests/languages/julia/string_feature.test
@@ -11,11 +11,15 @@ Prism.languages.julia = {
greedy: true
},
'string': {
// https://docs.julialang.org/en/v1/manual/strings/#man-characters-1
// https://docs.julialang.org/en/v1/manual/strings/#String-Basics-1
// https://docs.julialang.org/en/v1/manual/strings/#non-standard-string-literals-1
// https://docs.julialang.org/en/v1/manual/running-external-programs/#Running-External-Programs-1
pattern: /"""[\s\S]+?"""|(?:\b\w+)?"(?:\\.|[^"\\\r\n])*"|(^|[^\w'])'(?:\\[^\r\n][^'\r\n]*|[^\\\r\n])'|`(?:[^\\`\r\n]|\\.)*`/,
pattern: /"""[\s\S]+?"""|(?:\b\w+)?"(?:\\.|[^"\\\r\n])*"|`(?:[^\\`\r\n]|\\.)*`/,
greedy: true
},
'char': {
// https://docs.julialang.org/en/v1/manual/strings/#man-characters-1
pattern: /(^|[^\w'])'(?:\\[^\r\n][^'\r\n]*|[^\\\r\n])'/,
lookbehind: true,
greedy: true
},

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1,31 @@
'x'
'\''
'\u2200'
'\x80'
'\xe2\x88'
'∀'

# not a character
A'b
A'b''

----------------------------------------------------

[
["char", "'x'"],
["char", "'\\''"],
["char", "'\\u2200'"],
["char", "'\\x80'"],
["char", "'\\xe2\\x88'"],
["char", "'∀'"],

["comment", "# not a character"],

"\r\nA",
["operator", "'"],
"b\r\nA",
["operator", "'"],
"b",
["operator", "'"],
["operator", "'"]
]
@@ -2,13 +2,6 @@
"fo\"o"
"\xe2\x88"

'x'
'\''
'\u2200'
'\x80'
'\xe2\x88'
'∀'

"""foo"""
"""fo"o
bar"""
@@ -22,24 +15,13 @@ b"DATA\xff\u2200"
v"0.3-"
raw"\\ \\\""

# not a character
A'b
A'b''

----------------------------------------------------

[
["string", "\"\""],
["string", "\"fo\\\"o\""],
["string", "\"\\xe2\\x88\""],

["string", "'x'"],
["string", "'\\''"],
["string", "'\\u2200'"],
["string", "'\\x80'"],
["string", "'\\xe2\\x88'"],
["string", "'∀'"],

["string", "\"\"\"foo\"\"\""],
["string", "\"\"\"fo\"o\r\nbar\"\"\""],

@@ -50,16 +32,7 @@ A'b''
["string", "s\"\\g<0>1\""],
["string", "b\"DATA\\xff\\u2200\""],
["string", "v\"0.3-\""],
["string", "raw\"\\\\ \\\\\\\"\""],

["comment", "# not a character"],
"\r\nA",
["operator", "'"],
"b\r\nA",
["operator", "'"],
"b",
["operator", "'"],
["operator", "'"]
["string", "raw\"\\\\ \\\\\\\"\""]
]

----------------------------------------------------

0 comments on commit 3a876df

Please sign in to comment.