l0bsterssg

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

angelscript.js (3012B)


      1 /*
      2 Language: AngelScript
      3 Author: Melissa Geels <melissa@nimble.tools>
      4 Category: scripting
      5 Website: https://www.angelcode.com/angelscript/
      6 */
      7 
      8 /** @type LanguageFn */
      9 function angelscript(hljs) {
     10   var builtInTypeMode = {
     11     className: 'built_in',
     12     begin: '\\b(void|bool|int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|string|ref|array|double|float|auto|dictionary)'
     13   };
     14 
     15   var objectHandleMode = {
     16     className: 'symbol',
     17     begin: '[a-zA-Z0-9_]+@'
     18   };
     19 
     20   var genericMode = {
     21     className: 'keyword',
     22     begin: '<', end: '>',
     23     contains: [ builtInTypeMode, objectHandleMode ]
     24   };
     25 
     26   builtInTypeMode.contains = [ genericMode ];
     27   objectHandleMode.contains = [ genericMode ];
     28 
     29   return {
     30     name: 'AngelScript',
     31     aliases: ['asc'],
     32 
     33     keywords:
     34       'for in|0 break continue while do|0 return if else case switch namespace is cast ' +
     35       'or and xor not get|0 in inout|10 out override set|0 private public const default|0 ' +
     36       'final shared external mixin|10 enum typedef funcdef this super import from interface ' +
     37       'abstract|0 try catch protected explicit property',
     38 
     39     // avoid close detection with C# and JS
     40     illegal: '(^using\\s+[A-Za-z0-9_\\.]+;$|\\bfunction\s*[^\\(])',
     41 
     42     contains: [
     43       { // 'strings'
     44         className: 'string',
     45         begin: '\'', end: '\'',
     46         illegal: '\\n',
     47         contains: [ hljs.BACKSLASH_ESCAPE ],
     48         relevance: 0
     49       },
     50 
     51       { // "strings"
     52         className: 'string',
     53         begin: '"', end: '"',
     54         illegal: '\\n',
     55         contains: [ hljs.BACKSLASH_ESCAPE ],
     56         relevance: 0
     57       },
     58 
     59       // """heredoc strings"""
     60       {
     61         className: 'string',
     62         begin: '"""', end: '"""'
     63       },
     64 
     65       hljs.C_LINE_COMMENT_MODE, // single-line comments
     66       hljs.C_BLOCK_COMMENT_MODE, // comment blocks
     67 
     68       { // interface or namespace declaration
     69         beginKeywords: 'interface namespace', end: '{',
     70         illegal: '[;.\\-]',
     71         contains: [
     72           { // interface or namespace name
     73             className: 'symbol',
     74             begin: '[a-zA-Z0-9_]+'
     75           }
     76         ]
     77       },
     78 
     79       { // class declaration
     80         beginKeywords: 'class', end: '{',
     81         illegal: '[;.\\-]',
     82         contains: [
     83           { // class name
     84             className: 'symbol',
     85             begin: '[a-zA-Z0-9_]+',
     86             contains: [
     87               {
     88                 begin: '[:,]\\s*',
     89                 contains: [
     90                   {
     91                     className: 'symbol',
     92                     begin: '[a-zA-Z0-9_]+'
     93                   }
     94                 ]
     95               }
     96             ]
     97           }
     98         ]
     99       },
    100 
    101       builtInTypeMode, // built-in types
    102       objectHandleMode, // object handles
    103 
    104       { // literals
    105         className: 'literal',
    106         begin: '\\b(null|true|false)'
    107       },
    108 
    109       { // numbers
    110         className: 'number',
    111         begin: '(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?f?|\\.\\d+f?)([eE][-+]?\\d+f?)?)'
    112       }
    113     ]
    114   };
    115 }
    116 
    117 module.exports = angelscript;