1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | function scilab(hljs) {
|
11 | const COMMON_CONTAINS = [
|
12 | hljs.C_NUMBER_MODE,
|
13 | {
|
14 | className: 'string',
|
15 | begin: '\'|\"',
|
16 | end: '\'|\"',
|
17 | contains: [ hljs.BACKSLASH_ESCAPE,
|
18 | {
|
19 | begin: '\'\''
|
20 | } ]
|
21 | }
|
22 | ];
|
23 |
|
24 | return {
|
25 | name: 'Scilab',
|
26 | aliases: [ 'sci' ],
|
27 | keywords: {
|
28 | $pattern: /%?\w+/,
|
29 | keyword: 'abort break case clear catch continue do elseif else endfunction end for function ' +
|
30 | 'global if pause return resume select try then while',
|
31 | literal:
|
32 | '%f %F %t %T %pi %eps %inf %nan %e %i %z %s',
|
33 | built_in:
|
34 | 'abs and acos asin atan ceil cd chdir clearglobal cosh cos cumprod deff disp error ' +
|
35 | 'exec execstr exists exp eye gettext floor fprintf fread fsolve imag isdef isempty ' +
|
36 | 'isinfisnan isvector lasterror length load linspace list listfiles log10 log2 log ' +
|
37 | 'max min msprintf mclose mopen ones or pathconvert poly printf prod pwd rand real ' +
|
38 | 'round sinh sin size gsort sprintf sqrt strcat strcmps tring sum system tanh tan ' +
|
39 | 'type typename warning zeros matrix'
|
40 | },
|
41 | illegal: '("|#|/\\*|\\s+/\\w+)',
|
42 | contains: [
|
43 | {
|
44 | className: 'function',
|
45 | beginKeywords: 'function',
|
46 | end: '$',
|
47 | contains: [
|
48 | hljs.UNDERSCORE_TITLE_MODE,
|
49 | {
|
50 | className: 'params',
|
51 | begin: '\\(',
|
52 | end: '\\)'
|
53 | }
|
54 | ]
|
55 | },
|
56 |
|
57 |
|
58 | {
|
59 | begin: '[a-zA-Z_][a-zA-Z_0-9]*[\\.\']+',
|
60 | relevance: 0
|
61 | },
|
62 | {
|
63 | begin: '\\[',
|
64 | end: '\\][\\.\']*',
|
65 | relevance: 0,
|
66 | contains: COMMON_CONTAINS
|
67 | },
|
68 | hljs.COMMENT('//', '$')
|
69 | ].concat(COMMON_CONTAINS)
|
70 | };
|
71 | }
|
72 |
|
73 | export { scilab as default };
|