0
This repository has been archived on 2024-08-27. You can view files and clone it, but cannot push or open issues or pull requests.
highlight_js-rails/vendor/assets/javascripts/highlight_js/languages/matlab.js
2015-01-25 16:00:01 +01:00

105 lines
3.3 KiB
JavaScript

/*
Language: Matlab
Author: Denis Bardadym <bardadymchik@gmail.com>
Contributors: Eugene Nizhibitsky <nizhibitsky@ya.ru>
Category: scientific
*/
function(hljs) {
var COMMON_CONTAINS = [
hljs.C_NUMBER_MODE,
{
className: 'string',
begin: '\'', end: '\'',
contains: [hljs.BACKSLASH_ESCAPE, {begin: '\'\''}]
}
];
var TRANSPOSE = {
relevance: 0,
contains: [
{
className: 'operator', begin: /'['\.]*/
}
]
};
return {
keywords: {
keyword:
'break case catch classdef continue else elseif end enumerated events for function ' +
'global if methods otherwise parfor persistent properties return spmd switch try while',
built_in:
'sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan ' +
'atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot ' +
'cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog ' +
'realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal ' +
'cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli ' +
'besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma ' +
'gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms ' +
'nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones ' +
'eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length ' +
'ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril ' +
'triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute ' +
'shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i inf nan ' +
'isnan isinf isfinite j why compan gallery hadamard hankel hilb invhilb magic pascal ' +
'rosser toeplitz vander wilkinson'
},
illegal: '(//|"|#|/\\*|\\s+/\\w+)',
contains: [
{
className: 'function',
beginKeywords: 'function', end: '$',
contains: [
hljs.UNDERSCORE_TITLE_MODE,
{
className: 'params',
begin: '\\(', end: '\\)'
},
{
className: 'params',
begin: '\\[', end: '\\]'
}
]
},
{
begin: /[a-zA-Z_][a-zA-Z_0-9]*'['\.]*/,
returnBegin: true,
relevance: 0,
contains: [
{begin: /[a-zA-Z_][a-zA-Z_0-9]*/, relevance: 0},
TRANSPOSE.contains[0]
]
},
{
className: 'matrix',
begin: '\\[', end: '\\]',
contains: COMMON_CONTAINS,
relevance: 0,
starts: TRANSPOSE
},
{
className: 'cell',
begin: '\\{', end: /}/,
contains: COMMON_CONTAINS,
relevance: 0,
starts: TRANSPOSE
},
{
// transpose operators at the end of a function call
begin: /\)/,
relevance: 0,
starts: TRANSPOSE
},
{
// Block comment
className: 'comment',
begin: '^\\s*\\%\\{\\s*$', end: '^\\s*\\%\\}\\s*$'
},
{
className: 'comment',
begin: '\\%', end: '$'
}
].concat(COMMON_CONTAINS)
};
}