Skip to content

Commit cc953bf

Browse files
Carreaumarijnh
authored andcommitted
[Julia] Add support for unicode identifier.
1 parent 5c06606 commit cc953bf

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

mode/julia/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ <h2>Julia mode</h2>
5151
as123
5252
function_name!
5353

54+
#unicode identifiers
55+
# a = x\ddot
56+
a⃗ = ẍ
57+
# a = v\dot
58+
a⃗ = v̇
59+
#F\vec = m \cdotp a\vec
60+
F⃗ = m·a⃗
61+
5462
#literal identifier multiples
5563
3x
5664
4[1, 2, 3]
@@ -60,6 +68,7 @@ <h2>Julia mode</h2>
6068
x[end-1]
6169
x={"julia"=>"language of technical computing"}
6270

71+
6372
#exception handling
6473
try
6574
f()

mode/julia/julia.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
2020

2121
var operators = parserConf.operators || /^\.?[|&^\\%*+\-<>!=\/]=?|\?|~|:|\$|\.[<>]|<<=?|>>>?=?|\.[<>=]=|->?|\/\/|\bin\b/;
2222
var delimiters = parserConf.delimiters || /^[;,()[\]{}]/;
23-
var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*!*/;
23+
var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*!*/;
2424
var blockOpeners = ["begin", "function", "type", "immutable", "let", "macro", "for", "while", "quote", "if", "else", "elseif", "try", "finally", "catch", "do"];
2525
var blockClosers = ["end", "else", "elseif", "catch", "finally"];
2626
var keywordList = ['if', 'else', 'elseif', 'while', 'for', 'begin', 'let', 'end', 'do', 'try', 'catch', 'finally', 'return', 'break', 'continue', 'global', 'local', 'const', 'export', 'import', 'importall', 'using', 'function', 'macro', 'module', 'baremodule', 'type', 'immutable', 'quote', 'typealias', 'abstract', 'bitstype', 'ccall'];

0 commit comments

Comments
 (0)