l0bsterssg

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

oxygene.js (2949B)


      1 /*
      2 Language: Oxygene
      3 Author: Carlo Kok <ck@remobjects.com>
      4 Description: Oxygene is built on the foundation of Object Pascal, revamped and extended to be a modern language for the twenty-first century.
      5 Website: https://www.elementscompiler.com/elements/default.aspx
      6 */
      7 
      8 function oxygene(hljs) {
      9   var OXYGENE_KEYWORDS = {
     10     $pattern: /\.?\w+/,
     11     keyword: 'abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue '+
     12     'create default delegate desc distinct div do downto dynamic each else empty end ensure enum equals event except exit extension external false '+
     13     'final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited '+
     14     'inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of '+
     15     'old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly '+
     16     'record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple '+
     17     'type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal '+
     18     'register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained'
     19   };
     20   var CURLY_COMMENT = hljs.COMMENT(
     21     '{',
     22     '}',
     23     {
     24       relevance: 0
     25     }
     26   );
     27   var PAREN_COMMENT = hljs.COMMENT(
     28     '\\(\\*',
     29     '\\*\\)',
     30     {
     31       relevance: 10
     32     }
     33   );
     34   var STRING = {
     35     className: 'string',
     36     begin: '\'', end: '\'',
     37     contains: [{begin: '\'\''}]
     38   };
     39   var CHAR_STRING = {
     40     className: 'string', begin: '(#\\d+)+'
     41   };
     42   var FUNCTION = {
     43     className: 'function',
     44     beginKeywords: 'function constructor destructor procedure method', end: '[:;]',
     45     keywords: 'function constructor|10 destructor|10 procedure|10 method|10',
     46     contains: [
     47       hljs.TITLE_MODE,
     48       {
     49         className: 'params',
     50         begin: '\\(', end: '\\)',
     51         keywords: OXYGENE_KEYWORDS,
     52         contains: [STRING, CHAR_STRING]
     53       },
     54       CURLY_COMMENT, PAREN_COMMENT
     55     ]
     56   };
     57   return {
     58     name: 'Oxygene',
     59     case_insensitive: true,
     60     keywords: OXYGENE_KEYWORDS,
     61     illegal: '("|\\$[G-Zg-z]|\\/\\*|</|=>|->)',
     62     contains: [
     63       CURLY_COMMENT, PAREN_COMMENT, hljs.C_LINE_COMMENT_MODE,
     64       STRING, CHAR_STRING,
     65       hljs.NUMBER_MODE,
     66       FUNCTION,
     67       {
     68         className: 'class',
     69         begin: '=\\bclass\\b', end: 'end;',
     70         keywords: OXYGENE_KEYWORDS,
     71         contains: [
     72           STRING, CHAR_STRING,
     73           CURLY_COMMENT, PAREN_COMMENT, hljs.C_LINE_COMMENT_MODE,
     74           FUNCTION
     75         ]
     76       }
     77     ]
     78   };
     79 }
     80 
     81 module.exports = oxygene;