Skip to content
Snippets Groups Projects
Commit 9f834a94 authored by Ryan Prior's avatar Ryan Prior Committed by Marijn Haverbeke
Browse files

[octave mode] added more builtins, fixed comments

(removed non-octave ... comments, added octave's # comments)
parent 11967c7b
No related branches found
No related tags found
No related merge requests found
......@@ -27,25 +27,16 @@
<div><textarea id="code" name="code">
%numbers
1234
1234i
1234j
.234
.234j
2.23i
23e2
12E1j
123D-4
0x234
[1234 1234i 1234j]
[.234 .234j 2.23i]
[23e2 12E1j 123D-4 0x234]
%strings
'asda''a'
"asda""a"
%identifiers
a
as123
__asd__
a + as123 - __asd__
%operators
-
......@@ -73,10 +64,8 @@ classdef properties events methods
global persistent
%one line comment
...one line comment
%{ multi
line commment %}
1
</textarea></div>
<script>
......
......@@ -13,17 +13,19 @@ CodeMirror.defineMode("octave", function() {
var builtins = wordRegexp([
'error', 'eval', 'function', 'abs', 'acos', 'atan', 'asin', 'cos',
'cosh', 'exp', 'log', 'prod', 'log10', 'max', 'min', 'sign', 'sin', 'sinh',
'cosh', 'exp', 'log', 'prod', 'sum', 'log10', 'max', 'min', 'sign', 'sin', 'sinh',
'sqrt', 'tan', 'reshape', 'break', 'zeros', 'default', 'margin', 'round', 'ones',
'rand', 'syn', 'ceil', 'floor', 'size', 'clear', 'zeros', 'eye', 'mean', 'std', 'cov',
'det', 'eig', 'inv', 'norm', 'rank', 'trace', 'expm', 'logm', 'sqrtm', 'linspace', 'plot',
'title', 'xlabel', 'ylabel', 'legend', 'text', 'meshgrid', 'mesh', 'num2str'
'title', 'xlabel', 'ylabel', 'legend', 'text', 'grid', 'meshgrid', 'mesh', 'num2str',
'fft', 'ifft', 'arrayfun', 'cellfun', 'input', 'fliplr', 'flipud', 'ismember'
]);
var keywords = wordRegexp([
'return', 'case', 'switch', 'else', 'elseif', 'end', 'endif', 'endfunction',
'if', 'otherwise', 'do', 'for', 'while', 'try', 'catch', 'classdef', 'properties', 'events',
'methods', 'global', 'persistent', 'endfor', 'endwhile', 'printf', 'disp', 'until', 'continue'
'methods', 'global', 'persistent', 'endfor', 'endwhile', 'printf', 'sprintf', 'disp', 'until',
'continue', 'pkg'
]);
......@@ -59,7 +61,7 @@ CodeMirror.defineMode("octave", function() {
return 'comment';
}
if (stream.match(/^(%)|(\.\.\.)/)){
if (stream.match(/^[%#]/)){
stream.skipToEnd();
return 'comment';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment