l0bsterssg

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

haxe.js (3608B)


      1 /*
      2 Language: Haxe
      3 Description: Haxe is an open source toolkit based on a modern, high level, strictly typed programming language.
      4 Author: Christopher Kaster <ikasoki@gmail.com> (Based on the actionscript.js language file by Alexander Myadzel)
      5 Contributors: Kenton Hamaluik <kentonh@gmail.com>
      6 Website: https://haxe.org
      7 */
      8 
      9 function haxe(hljs) {
     10 
     11   var HAXE_BASIC_TYPES = 'Int Float String Bool Dynamic Void Array ';
     12 
     13   return {
     14     name: 'Haxe',
     15     aliases: ['hx'],
     16     keywords: {
     17       keyword: 'break case cast catch continue default do dynamic else enum extern ' +
     18                'for function here if import in inline never new override package private get set ' +
     19                'public return static super switch this throw trace try typedef untyped using var while ' +
     20                HAXE_BASIC_TYPES,
     21       built_in:
     22         'trace this',
     23       literal:
     24         'true false null _'
     25     },
     26     contains: [
     27       { className: 'string', // interpolate-able strings
     28         begin: '\'', end: '\'',
     29         contains: [
     30           hljs.BACKSLASH_ESCAPE,
     31           { className: 'subst', // interpolation
     32             begin: '\\$\\{', end: '\\}'
     33           },
     34           { className: 'subst', // interpolation
     35             begin: '\\$', end: '\\W}'
     36           }
     37         ]
     38       },
     39       hljs.QUOTE_STRING_MODE,
     40       hljs.C_LINE_COMMENT_MODE,
     41       hljs.C_BLOCK_COMMENT_MODE,
     42       hljs.C_NUMBER_MODE,
     43       { className: 'meta', // compiler meta
     44         begin: '@:', end: '$'
     45       },
     46       { className: 'meta', // compiler conditionals
     47         begin: '#', end: '$',
     48         keywords: {'meta-keyword': 'if else elseif end error'}
     49       },
     50       { className: 'type', // function types
     51         begin: ':[ \t]*', end: '[^A-Za-z0-9_ \t\\->]',
     52         excludeBegin: true, excludeEnd: true,
     53         relevance: 0
     54       },
     55       { className: 'type', // types
     56         begin: ':[ \t]*', end: '\\W',
     57         excludeBegin: true, excludeEnd: true
     58       },
     59       { className: 'type', // instantiation
     60         begin: 'new *', end: '\\W',
     61         excludeBegin: true, excludeEnd: true
     62       },
     63       { className: 'class', // enums
     64         beginKeywords: 'enum', end: '\\{',
     65         contains: [
     66           hljs.TITLE_MODE
     67         ]
     68       },
     69       { className: 'class', // abstracts
     70         beginKeywords: 'abstract', end: '[\\{$]',
     71         contains: [
     72           { className: 'type',
     73             begin: '\\(', end: '\\)',
     74             excludeBegin: true, excludeEnd: true
     75           },
     76           { className: 'type',
     77             begin: 'from +', end: '\\W',
     78             excludeBegin: true, excludeEnd: true
     79           },
     80           { className: 'type',
     81             begin: 'to +', end: '\\W',
     82             excludeBegin: true, excludeEnd: true
     83           },
     84           hljs.TITLE_MODE
     85         ],
     86         keywords: {
     87           keyword: 'abstract from to'
     88         }
     89       },
     90       { className: 'class', // classes
     91         begin: '\\b(class|interface) +', end: '[\\{$]',  excludeEnd: true,
     92         keywords: 'class interface',
     93         contains: [
     94           { className: 'keyword',
     95             begin: '\\b(extends|implements) +',
     96             keywords: 'extends implements',
     97             contains: [
     98               {
     99                 className: 'type',
    100                 begin: hljs.IDENT_RE,
    101                 relevance: 0
    102               }
    103             ]
    104           },
    105           hljs.TITLE_MODE
    106         ]
    107       },
    108       { className: 'function',
    109         beginKeywords: 'function', end: '\\(', excludeEnd: true,
    110         illegal: '\\S',
    111         contains: [
    112           hljs.TITLE_MODE
    113         ]
    114       }
    115     ],
    116     illegal: /<\//
    117   };
    118 }
    119 
    120 module.exports = haxe;