]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/angelscript.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / angelscript.js
1 /*! `angelscript` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: AngelScript
7 Author: Melissa Geels <melissa@nimble.tools>
8 Category: scripting
9 Website: https://www.angelcode.com/angelscript/
10 */
11
12 /** @type LanguageFn */
13 function angelscript(hljs) {
14 const builtInTypeMode = {
15 className: 'built_in',
16 begin: '\\b(void|bool|int8|int16|int32|int64|int|uint8|uint16|uint32|uint64|uint|string|ref|array|double|float|auto|dictionary)'
17 };
18
19 const objectHandleMode = {
20 className: 'symbol',
21 begin: '[a-zA-Z0-9_]+@'
22 };
23
24 const genericMode = {
25 className: 'keyword',
26 begin: '<',
27 end: '>',
28 contains: [
29 builtInTypeMode,
30 objectHandleMode
31 ]
32 };
33
34 builtInTypeMode.contains = [ genericMode ];
35 objectHandleMode.contains = [ genericMode ];
36
37 const KEYWORDS = [
38 "for",
39 "in|0",
40 "break",
41 "continue",
42 "while",
43 "do|0",
44 "return",
45 "if",
46 "else",
47 "case",
48 "switch",
49 "namespace",
50 "is",
51 "cast",
52 "or",
53 "and",
54 "xor",
55 "not",
56 "get|0",
57 "in",
58 "inout|10",
59 "out",
60 "override",
61 "set|0",
62 "private",
63 "public",
64 "const",
65 "default|0",
66 "final",
67 "shared",
68 "external",
69 "mixin|10",
70 "enum",
71 "typedef",
72 "funcdef",
73 "this",
74 "super",
75 "import",
76 "from",
77 "interface",
78 "abstract|0",
79 "try",
80 "catch",
81 "protected",
82 "explicit",
83 "property"
84 ];
85
86 return {
87 name: 'AngelScript',
88 aliases: [ 'asc' ],
89
90 keywords: KEYWORDS,
91
92 // avoid close detection with C# and JS
93 illegal: '(^using\\s+[A-Za-z0-9_\\.]+;$|\\bfunction\\s*[^\\(])',
94
95 contains: [
96 { // 'strings'
97 className: 'string',
98 begin: '\'',
99 end: '\'',
100 illegal: '\\n',
101 contains: [ hljs.BACKSLASH_ESCAPE ],
102 relevance: 0
103 },
104
105 // """heredoc strings"""
106 {
107 className: 'string',
108 begin: '"""',
109 end: '"""'
110 },
111
112 { // "strings"
113 className: 'string',
114 begin: '"',
115 end: '"',
116 illegal: '\\n',
117 contains: [ hljs.BACKSLASH_ESCAPE ],
118 relevance: 0
119 },
120
121 hljs.C_LINE_COMMENT_MODE, // single-line comments
122 hljs.C_BLOCK_COMMENT_MODE, // comment blocks
123
124 { // metadata
125 className: 'string',
126 begin: '^\\s*\\[',
127 end: '\\]'
128 },
129
130 { // interface or namespace declaration
131 beginKeywords: 'interface namespace',
132 end: /\{/,
133 illegal: '[;.\\-]',
134 contains: [
135 { // interface or namespace name
136 className: 'symbol',
137 begin: '[a-zA-Z0-9_]+'
138 }
139 ]
140 },
141
142 { // class declaration
143 beginKeywords: 'class',
144 end: /\{/,
145 illegal: '[;.\\-]',
146 contains: [
147 { // class name
148 className: 'symbol',
149 begin: '[a-zA-Z0-9_]+',
150 contains: [
151 {
152 begin: '[:,]\\s*',
153 contains: [
154 {
155 className: 'symbol',
156 begin: '[a-zA-Z0-9_]+'
157 }
158 ]
159 }
160 ]
161 }
162 ]
163 },
164
165 builtInTypeMode, // built-in types
166 objectHandleMode, // object handles
167
168 { // literals
169 className: 'literal',
170 begin: '\\b(null|true|false)'
171 },
172
173 { // numbers
174 className: 'number',
175 relevance: 0,
176 begin: '(-?)(\\b0[xXbBoOdD][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?f?|\\.\\d+f?)([eE][-+]?\\d+f?)?)'
177 }
178 ]
179 };
180 }
181
182 return angelscript;
183
184 })();
185 ;
186 export default hljsGrammar;