63 # functions |
63 # functions |
64 (r'(function)((?:\s|\\\s)+)', |
64 (r'(function)((?:\s|\\\s)+)', |
65 bygroups(Keyword, Name.Function), 'funcname'), |
65 bygroups(Keyword, Name.Function), 'funcname'), |
66 |
66 |
67 # types |
67 # types |
68 (r'(type|typealias|abstract)((?:\s|\\\s)+)', |
68 (r'(type|typealias|abstract|immutable)((?:\s|\\\s)+)', |
69 bygroups(Keyword, Name.Class), 'typename'), |
69 bygroups(Keyword, Name.Class), 'typename'), |
70 |
70 |
71 # operators |
71 # operators |
72 (r'==|!=|<=|>=|->|&&|\|\||::|<:|[-~+/*%=<>&^|.?!$]', Operator), |
72 (r'==|!=|<=|>=|->|&&|\|\||::|<:|[-~+/*%=<>&^|.?!$]', Operator), |
73 (r'\.\*|\.\^|\.\\|\.\/|\\', Operator), |
73 (r'\.\*|\.\^|\.\\|\.\/|\\', Operator), |
130 (r'[=#]', Comment.Multiline), |
130 (r'[=#]', Comment.Multiline), |
131 ], |
131 ], |
132 'string': [ |
132 'string': [ |
133 (r'"', String, '#pop'), |
133 (r'"', String, '#pop'), |
134 (r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings |
134 (r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings |
135 (r'\$(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?', |
135 # Interpolation is defined as "$" followed by the shortest full |
136 String.Interpol), |
136 # expression, which is something we can't parse. |
137 (r'[^\\"$]+', String), |
137 # Include the most common cases here: $word, and $(paren'd expr). |
138 # quotes, dollar signs, and backslashes must be parsed one at a time |
138 (r'\$[a-zA-Z_]+', String.Interpol), |
139 (r'["\\]', String), |
139 (r'\$\(', String.Interpol, 'in-intp'), |
140 # unhandled string formatting sign |
140 # @printf and @sprintf formats |
141 (r'\$', String) |
141 (r'%[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[diouxXeEfFgGcrs%]', |
142 ], |
142 String.Interpol), |
|
143 (r'[^$%"\\]+', String), |
|
144 # unhandled special signs |
|
145 (r'[$%"\\]', String), |
|
146 ], |
|
147 'in-intp': [ |
|
148 (r'[^()]+', String.Interpol), |
|
149 (r'\(', String.Interpol, '#push'), |
|
150 (r'\)', String.Interpol, '#pop'), |
|
151 ] |
143 } |
152 } |
144 |
153 |
145 def analyse_text(text): |
154 def analyse_text(text): |
146 return shebang_matches(text, r'julia') |
155 return shebang_matches(text, r'julia') |
147 |
156 |