l0bsterssg

node.js static responsive blog post generator
Log | Files | Refs | README

scilab.js (1966B)


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