l0bsterssg

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

pony.js (2072B)


      1 /*
      2 Language: Pony
      3 Author: Joe Eli McIlvain <joe.eli.mac@gmail.com>
      4 Description: Pony is an open-source, object-oriented, actor-model,
      5              capabilities-secure, high performance programming language.
      6 Website: https://www.ponylang.io
      7 */
      8 
      9 function pony(hljs) {
     10   var KEYWORDS = {
     11     keyword:
     12       'actor addressof and as be break class compile_error compile_intrinsic ' +
     13       'consume continue delegate digestof do else elseif embed end error ' +
     14       'for fun if ifdef in interface is isnt lambda let match new not object ' +
     15       'or primitive recover repeat return struct then trait try type until ' +
     16       'use var where while with xor',
     17     meta:
     18       'iso val tag trn box ref',
     19     literal:
     20       'this false true'
     21   };
     22 
     23   var TRIPLE_QUOTE_STRING_MODE = {
     24     className: 'string',
     25     begin: '"""', end: '"""',
     26     relevance: 10
     27   };
     28 
     29   var QUOTE_STRING_MODE = {
     30     className: 'string',
     31     begin: '"', end: '"',
     32     contains: [hljs.BACKSLASH_ESCAPE]
     33   };
     34 
     35   var SINGLE_QUOTE_CHAR_MODE = {
     36     className: 'string',
     37     begin: '\'', end: '\'',
     38     contains: [hljs.BACKSLASH_ESCAPE],
     39     relevance: 0
     40   };
     41 
     42   var TYPE_NAME = {
     43     className: 'type',
     44     begin: '\\b_?[A-Z][\\w]*',
     45     relevance: 0
     46   };
     47 
     48   var PRIMED_NAME = {
     49     begin: hljs.IDENT_RE + '\'', relevance: 0
     50   };
     51 
     52   var NUMBER_MODE = {
     53     className: 'number',
     54     begin: '(-?)(\\b0[xX][a-fA-F0-9]+|\\b0[bB][01]+|(\\b\\d+(_\\d+)?(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)',
     55     relevance: 0
     56   };
     57 
     58   /**
     59    * The `FUNCTION` and `CLASS` modes were intentionally removed to simplify
     60    * highlighting and fix cases like
     61    * ```
     62    * interface Iterator[A: A]
     63    *   fun has_next(): Bool
     64    *   fun next(): A?
     65    * ```
     66    * where it is valid to have a function head without a body
     67    */
     68 
     69   return {
     70     name: 'Pony',
     71     keywords: KEYWORDS,
     72     contains: [
     73       TYPE_NAME,
     74       TRIPLE_QUOTE_STRING_MODE,
     75       QUOTE_STRING_MODE,
     76       SINGLE_QUOTE_CHAR_MODE,
     77       PRIMED_NAME,
     78       NUMBER_MODE,
     79       hljs.C_LINE_COMMENT_MODE,
     80       hljs.C_BLOCK_COMMENT_MODE
     81     ]
     82   };
     83 }
     84 
     85 module.exports = pony;