]> luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/scilab.js
Initial commit.
[flow-web.git] / static / highlight / languages / scilab.js
1 /*! `scilab` grammar compiled for Highlight.js 11.11.1 */
2 (function(){
3 var hljsGrammar = (function () {
4 'use strict';
5
6 /*
7 Language: Scilab
8 Author: Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com>
9 Origin: matlab.js
10 Description: Scilab is a port from Matlab
11 Website: https://www.scilab.org
12 Category: scientific
13 */
14
15 function scilab(hljs) {
16 const COMMON_CONTAINS = [
17 hljs.C_NUMBER_MODE,
18 {
19 className: 'string',
20 begin: '\'|\"',
21 end: '\'|\"',
22 contains: [
23 hljs.BACKSLASH_ESCAPE,
24 { begin: '\'\'' }
25 ]
26 }
27 ];
28
29 return {
30 name: 'Scilab',
31 aliases: [ 'sci' ],
32 keywords: {
33 $pattern: /%?\w+/,
34 keyword: 'abort break case clear catch continue do elseif else endfunction end for function '
35 + 'global if pause return resume select try then while',
36 literal:
37 '%f %F %t %T %pi %eps %inf %nan %e %i %z %s',
38 built_in: // Scilab has more than 2000 functions. Just list the most commons
39 'abs and acos asin atan ceil cd chdir clearglobal cosh cos cumprod deff disp error '
40 + 'exec execstr exists exp eye gettext floor fprintf fread fsolve imag isdef isempty '
41 + 'isinfisnan isvector lasterror length load linspace list listfiles log10 log2 log '
42 + 'max min msprintf mclose mopen ones or pathconvert poly printf prod pwd rand real '
43 + 'round sinh sin size gsort sprintf sqrt strcat strcmps tring sum system tanh tan '
44 + 'type typename warning zeros matrix'
45 },
46 illegal: '("|#|/\\*|\\s+/\\w+)',
47 contains: [
48 {
49 className: 'function',
50 beginKeywords: 'function',
51 end: '$',
52 contains: [
53 hljs.UNDERSCORE_TITLE_MODE,
54 {
55 className: 'params',
56 begin: '\\(',
57 end: '\\)'
58 }
59 ]
60 },
61 // seems to be a guard against [ident]' or [ident].
62 // perhaps to prevent attributes from flagging as keywords?
63 {
64 begin: '[a-zA-Z_][a-zA-Z_0-9]*[\\.\']+',
65 relevance: 0
66 },
67 {
68 begin: '\\[',
69 end: '\\][\\.\']*',
70 relevance: 0,
71 contains: COMMON_CONTAINS
72 },
73 hljs.COMMENT('//', '$')
74 ].concat(COMMON_CONTAINS)
75 };
76 }
77
78 return scilab;
79
80 })();
81
82 hljs.registerLanguage('scilab', hljsGrammar);
83 })();