l0bsterssg

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

actionscript.js (2260B)


      1 /*
      2 Language: ActionScript
      3 Author: Alexander Myadzel <myadzel@gmail.com>
      4 Category: scripting
      5 */
      6 
      7 /** @type LanguageFn */
      8 function actionscript(hljs) {
      9   var IDENT_RE = '[a-zA-Z_$][a-zA-Z0-9_$]*';
     10   var IDENT_FUNC_RETURN_TYPE_RE = '([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)';
     11 
     12   var AS3_REST_ARG_MODE = {
     13     className: 'rest_arg',
     14     begin: '[.]{3}', end: IDENT_RE,
     15     relevance: 10
     16   };
     17 
     18   return {
     19     name: 'ActionScript',
     20     aliases: ['as'],
     21     keywords: {
     22       keyword: 'as break case catch class const continue default delete do dynamic each ' +
     23         'else extends final finally for function get if implements import in include ' +
     24         'instanceof interface internal is namespace native new override package private ' +
     25         'protected public return set static super switch this throw try typeof use var void ' +
     26         'while with',
     27       literal: 'true false null undefined'
     28     },
     29     contains: [
     30       hljs.APOS_STRING_MODE,
     31       hljs.QUOTE_STRING_MODE,
     32       hljs.C_LINE_COMMENT_MODE,
     33       hljs.C_BLOCK_COMMENT_MODE,
     34       hljs.C_NUMBER_MODE,
     35       {
     36         className: 'class',
     37         beginKeywords: 'package', end: '{',
     38         contains: [hljs.TITLE_MODE]
     39       },
     40       {
     41         className: 'class',
     42         beginKeywords: 'class interface', end: '{', excludeEnd: true,
     43         contains: [
     44           {
     45             beginKeywords: 'extends implements'
     46           },
     47           hljs.TITLE_MODE
     48         ]
     49       },
     50       {
     51         className: 'meta',
     52         beginKeywords: 'import include', end: ';',
     53         keywords: {'meta-keyword': 'import include'}
     54       },
     55       {
     56         className: 'function',
     57         beginKeywords: 'function', end: '[{;]', excludeEnd: true,
     58         illegal: '\\S',
     59         contains: [
     60           hljs.TITLE_MODE,
     61           {
     62             className: 'params',
     63             begin: '\\(', end: '\\)',
     64             contains: [
     65               hljs.APOS_STRING_MODE,
     66               hljs.QUOTE_STRING_MODE,
     67               hljs.C_LINE_COMMENT_MODE,
     68               hljs.C_BLOCK_COMMENT_MODE,
     69               AS3_REST_ARG_MODE
     70             ]
     71           },
     72           {
     73             begin: ':\\s*' + IDENT_FUNC_RETURN_TYPE_RE
     74           }
     75         ]
     76       },
     77       hljs.METHOD_GUARD
     78     ],
     79     illegal: /#/
     80   };
     81 }
     82 
     83 module.exports = actionscript;