Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[octave mode] added more builtins, fixed comments

(removed non-octave ... comments, added octave's # comments)
  • Loading branch information...
commit 9f834a94de21e9298e12e8b5d2f7ca4267129ef2 1 parent 11967c7
@ryanprior ryanprior authored marijnh committed
Showing with 10 additions and 19 deletions.
  1. +4 −15 mode/octave/index.html
  2. +6 −4 mode/octave/octave.js
View
19 mode/octave/index.html
@@ -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 @@
global persistent
%one line comment
-...one line comment
%{ multi
line commment %}
-1
</textarea></div>
<script>
View
10 mode/octave/octave.js
@@ -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';
}
Please sign in to comment.
Something went wrong with that request. Please try again.