]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/haxe.js
1 /*! `haxe` grammar compiled for Highlight.js 11.11.1 */
3 var hljsGrammar
= (function () {
8 Description: Haxe is an open source toolkit based on a modern, high level, strictly typed programming language.
9 Author: Christopher Kaster <ikasoki@gmail.com> (Based on the actionscript.js language file by Alexander Myadzel)
10 Contributors: Kenton Hamaluik <kentonh@gmail.com>
11 Website: https://haxe.org
16 const IDENT_RE
= '[a-zA-Z_$][a-zA-Z0-9_$]*';
18 // C_NUMBER_RE with underscores and literal suffixes
19 const HAXE_NUMBER_RE
= /(-?)(\b0[xX][a-fA-F0-9_]+|(\b\d+(\.[\d_]*)?|\.[\d_]+)(([eE][-+]?\d+)|i32|u32|i64|f64)?)/;
21 const HAXE_BASIC_TYPES
= 'Int Float String Bool Dynamic Void Array ';
27 keyword: 'abstract break case cast catch continue default do dynamic else enum extern '
28 + 'final for function here if import in inline is macro never new override package private get set '
29 + 'public return static super switch this throw trace try typedef untyped using var while '
38 className: 'string', // interpolate-able strings
42 hljs
.BACKSLASH_ESCAPE
,
44 className: 'subst', // interpolation
49 className: 'subst', // interpolation
55 hljs
.QUOTE_STRING_MODE
,
56 hljs
.C_LINE_COMMENT_MODE
,
57 hljs
.C_BLOCK_COMMENT_MODE
,
60 begin: HAXE_NUMBER_RE
,
64 className: 'variable',
65 begin: "\\$" + IDENT_RE
,
68 className: 'meta', // compiler meta
74 className: 'meta', // compiler conditionals
77 keywords: { keyword: 'if else elseif end error' }
80 className: 'type', // function types
82 end: /[^A
-Za
-z0
-9_
\t\->]/,
88 className: 'type', // types
95 className: 'type', // instantiation
102 className: 'title.class', // enums
103 beginKeywords: 'enum',
105 contains: [ hljs
.TITLE_MODE
]
108 className: 'title.class', // abstracts
109 begin: '\\babstract\\b(?=\\s*' + hljs
.IDENT_RE
+ '\\s*\\()',
135 keywords: { keyword: 'abstract from to' }
138 className: 'title.class', // classes
139 begin: /\b(class|interface) +/,
142 keywords: 'class interface',
145 className: 'keyword',
146 begin: /\b(extends|implements) +/,
147 keywords: 'extends implements',
151 begin: hljs
.IDENT_RE
,
160 className: 'title.function',
161 beginKeywords: 'function',
165 contains: [ hljs
.TITLE_MODE
]
176 hljs
.registerLanguage('haxe', hljsGrammar
);