]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/matlab.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / matlab.js
1 /*! `matlab` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: Matlab
7 Author: Denis Bardadym <bardadymchik@gmail.com>
8 Contributors: Eugene Nizhibitsky <nizhibitsky@ya.ru>, Egor Rogov <e.rogov@postgrespro.ru>
9 Website: https://www.mathworks.com/products/matlab.html
10 Category: scientific
11 */
12
13 /*
14 Formal syntax is not published, helpful link:
15 https://github.com/kornilova-l/matlab-IntelliJ-plugin/blob/master/src/main/grammar/Matlab.bnf
16 */
17 function matlab(hljs) {
18 const TRANSPOSE_RE = '(\'|\\.\')+';
19 const TRANSPOSE = {
20 relevance: 0,
21 contains: [ { begin: TRANSPOSE_RE } ]
22 };
23
24 return {
25 name: 'Matlab',
26 keywords: {
27 keyword:
28 'arguments break case catch classdef continue else elseif end enumeration events for function '
29 + 'global if methods otherwise parfor persistent properties return spmd switch try while',
30 built_in:
31 'sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan '
32 + 'atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot '
33 + 'cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog '
34 + 'realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal '
35 + 'cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli '
36 + 'besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma '
37 + 'gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms '
38 + 'nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones '
39 + 'eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length '
40 + 'ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril '
41 + 'triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute '
42 + 'shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i|0 inf nan '
43 + 'isnan isinf isfinite j|0 why compan gallery hadamard hankel hilb invhilb magic pascal '
44 + 'rosser toeplitz vander wilkinson max min nanmax nanmin mean nanmean type table '
45 + 'readtable writetable sortrows sort figure plot plot3 scatter scatter3 cellfun '
46 + 'legend intersect ismember procrustes hold num2cell '
47 },
48 illegal: '(//|"|#|/\\*|\\s+/\\w+)',
49 contains: [
50 {
51 className: 'function',
52 beginKeywords: 'function',
53 end: '$',
54 contains: [
55 hljs.UNDERSCORE_TITLE_MODE,
56 {
57 className: 'params',
58 variants: [
59 {
60 begin: '\\(',
61 end: '\\)'
62 },
63 {
64 begin: '\\[',
65 end: '\\]'
66 }
67 ]
68 }
69 ]
70 },
71 {
72 className: 'built_in',
73 begin: /true|false/,
74 relevance: 0,
75 starts: TRANSPOSE
76 },
77 {
78 begin: '[a-zA-Z][a-zA-Z_0-9]*' + TRANSPOSE_RE,
79 relevance: 0
80 },
81 {
82 className: 'number',
83 begin: hljs.C_NUMBER_RE,
84 relevance: 0,
85 starts: TRANSPOSE
86 },
87 {
88 className: 'string',
89 begin: '\'',
90 end: '\'',
91 contains: [ { begin: '\'\'' } ]
92 },
93 {
94 begin: /\]|\}|\)/,
95 relevance: 0,
96 starts: TRANSPOSE
97 },
98 {
99 className: 'string',
100 begin: '"',
101 end: '"',
102 contains: [ { begin: '""' } ],
103 starts: TRANSPOSE
104 },
105 hljs.COMMENT('^\\s*%\\{\\s*$', '^\\s*%\\}\\s*$'),
106 hljs.COMMENT('%', '$')
107 ]
108 };
109 }
110
111 return matlab;
112
113 })();
114 ;
115 export default hljsGrammar;