CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
haxe.js168 linesDownload Raw Back to languages
1/*2Language: Haxe3Description: Haxe is an open source toolkit based on a modern, high level, strictly typed programming language.4Author: Christopher Kaster <ikasoki@gmail.com> (Based on the actionscript.js language file by Alexander Myadzel)5Contributors: Kenton Hamaluik <kentonh@gmail.com>6Website: https://haxe.org7Category: system8*/9 10function haxe(hljs) {11  const IDENT_RE = '[a-zA-Z_$][a-zA-Z0-9_$]*';12 13  // C_NUMBER_RE with underscores and literal suffixes14  const HAXE_NUMBER_RE = /(-?)(\b0[xX][a-fA-F0-9_]+|(\b\d+(\.[\d_]*)?|\.[\d_]+)(([eE][-+]?\d+)|i32|u32|i64|f64)?)/;15 16  const HAXE_BASIC_TYPES = 'Int Float String Bool Dynamic Void Array ';17 18  return {19    name: 'Haxe',20    aliases: [ 'hx' ],21    keywords: {22      keyword: 'abstract break case cast catch continue default do dynamic else enum extern '23               + 'final for function here if import in inline is macro never new override package private get set '24               + 'public return static super switch this throw trace try typedef untyped using var while '25               + HAXE_BASIC_TYPES,26      built_in:27        'trace this',28      literal:29        'true false null _'30    },31    contains: [32      {33        className: 'string', // interpolate-able strings34        begin: '\'',35        end: '\'',36        contains: [37          hljs.BACKSLASH_ESCAPE,38          {39            className: 'subst', // interpolation40            begin: /\$\{/,41            end: /\}/42          },43          {44            className: 'subst', // interpolation45            begin: /\$/,46            end: /\W\}/47          }48        ]49      },50      hljs.QUOTE_STRING_MODE,51      hljs.C_LINE_COMMENT_MODE,52      hljs.C_BLOCK_COMMENT_MODE,53      {54        className: 'number',55        begin: HAXE_NUMBER_RE,56        relevance: 057      },58      {59        className: 'variable',60        begin: "\\$" + IDENT_RE,61      },62      {63        className: 'meta', // compiler meta64        begin: /@:?/,65        end: /\(|$/,66        excludeEnd: true,67      },68      {69        className: 'meta', // compiler conditionals70        begin: '#',71        end: '$',72        keywords: { keyword: 'if else elseif end error' }73      },74      {75        className: 'type', // function types76        begin: /:[ \t]*/,77        end: /[^A-Za-z0-9_ \t\->]/,78        excludeBegin: true,79        excludeEnd: true,80        relevance: 081      },82      {83        className: 'type', // types84        begin: /:[ \t]*/,85        end: /\W/,86        excludeBegin: true,87        excludeEnd: true88      },89      {90        className: 'type', // instantiation91        beginKeywords: 'new',92        end: /\W/,93        excludeBegin: true,94        excludeEnd: true95      },96      {97        className: 'title.class', // enums98        beginKeywords: 'enum',99        end: /\{/,100        contains: [ hljs.TITLE_MODE ]101      },102      {103        className: 'title.class', // abstracts104        begin: '\\babstract\\b(?=\\s*' + hljs.IDENT_RE + '\\s*\\()',105        end: /[\{$]/,106        contains: [107          {108            className: 'type',109            begin: /\(/,110            end: /\)/,111            excludeBegin: true,112            excludeEnd: true113          },114          {115            className: 'type',116            begin: /from +/,117            end: /\W/,118            excludeBegin: true,119            excludeEnd: true120          },121          {122            className: 'type',123            begin: /to +/,124            end: /\W/,125            excludeBegin: true,126            excludeEnd: true127          },128          hljs.TITLE_MODE129        ],130        keywords: { keyword: 'abstract from to' }131      },132      {133        className: 'title.class', // classes134        begin: /\b(class|interface) +/,135        end: /[\{$]/,136        excludeEnd: true,137        keywords: 'class interface',138        contains: [139          {140            className: 'keyword',141            begin: /\b(extends|implements) +/,142            keywords: 'extends implements',143            contains: [144              {145                className: 'type',146                begin: hljs.IDENT_RE,147                relevance: 0148              }149            ]150          },151          hljs.TITLE_MODE152        ]153      },154      {155        className: 'title.function',156        beginKeywords: 'function',157        end: /\(/,158        excludeEnd: true,159        illegal: /\S/,160        contains: [ hljs.TITLE_MODE ]161      }162    ],163    illegal: /<\//164  };165}166 167export { haxe as default };168 
basant307/AI_Governance_Project · CoolFace