]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/matlab.js
1 /*! `matlab` grammar compiled for Highlight.js 11.11.1 */
3 var hljsGrammar
= (function () {
8 Author: Denis Bardadym <bardadymchik@gmail.com>
9 Contributors: Eugene Nizhibitsky <nizhibitsky@ya.ru>, Egor Rogov <e.rogov@postgrespro.ru>
10 Website: https://www.mathworks.com/products/matlab.html
15 Formal syntax is not published, helpful link:
16 https://github.com/kornilova-l/matlab-IntelliJ-plugin/blob/master/src/main/grammar/Matlab.bnf
18 function matlab(hljs
) {
19 const TRANSPOSE_RE
= '(\'|\\.\')+';
22 contains: [ { begin: TRANSPOSE_RE
} ]
29 'arguments break case catch classdef continue else elseif end enumeration events for function '
30 + 'global if methods otherwise parfor persistent properties return spmd switch try while',
32 'sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan '
33 + 'atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot '
34 + 'cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog '
35 + 'realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal '
36 + 'cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli '
37 + 'besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma '
38 + 'gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms '
39 + 'nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones '
40 + 'eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length '
41 + 'ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril '
42 + 'triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute '
43 + 'shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i|0 inf nan '
44 + 'isnan isinf isfinite j|0 why compan gallery hadamard hankel hilb invhilb magic pascal '
45 + 'rosser toeplitz vander wilkinson max min nanmax nanmin mean nanmean type table '
46 + 'readtable writetable sortrows sort figure plot plot3 scatter scatter3 cellfun '
47 + 'legend intersect ismember procrustes hold num2cell '
49 illegal: '(//|"|#|/\\*|\\s+/\\w+)',
52 className: 'function',
53 beginKeywords: 'function',
56 hljs
.UNDERSCORE_TITLE_MODE
,
73 className: 'built_in',
79 begin: '[a-zA-Z][a-zA-Z_0-9]*' + TRANSPOSE_RE
,
84 begin: hljs
.C_NUMBER_RE
,
92 contains: [ { begin: '\'\'' } ]
103 contains: [ { begin: '""' } ],
106 hljs
.COMMENT('^\\s*%\\{\\s*$', '^\\s*%\\}\\s*$'),
107 hljs
.COMMENT('%', '$')
116 hljs
.registerLanguage('matlab', hljsGrammar
);