source: node_modules/highlight.js/lib/languages/angelscript.js@ 65b6638

main
Last change on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[d24f17c]1/*
2Language: AngelScript
3Author: Melissa Geels <melissa@nimble.tools>
4Category: scripting
5Website: https://www.angelcode.com/angelscript/
6*/
7
8/** @type LanguageFn */
9function angelscript(hljs) {
10 var builtInTypeMode = {
11 className: 'built_in',
12 begin: '\\b(void|bool|int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|string|ref|array|double|float|auto|dictionary)'
13 };
14
15 var objectHandleMode = {
16 className: 'symbol',
17 begin: '[a-zA-Z0-9_]+@'
18 };
19
20 var genericMode = {
21 className: 'keyword',
22 begin: '<', end: '>',
23 contains: [ builtInTypeMode, objectHandleMode ]
24 };
25
26 builtInTypeMode.contains = [ genericMode ];
27 objectHandleMode.contains = [ genericMode ];
28
29 return {
30 name: 'AngelScript',
31 aliases: ['asc'],
32
33 keywords:
34 'for in|0 break continue while do|0 return if else case switch namespace is cast ' +
35 'or and xor not get|0 in inout|10 out override set|0 private public const default|0 ' +
36 'final shared external mixin|10 enum typedef funcdef this super import from interface ' +
37 'abstract|0 try catch protected explicit property',
38
39 // avoid close detection with C# and JS
40 illegal: '(^using\\s+[A-Za-z0-9_\\.]+;$|\\bfunction\\s*[^\\(])',
41
42 contains: [
43 { // 'strings'
44 className: 'string',
45 begin: '\'', end: '\'',
46 illegal: '\\n',
47 contains: [ hljs.BACKSLASH_ESCAPE ],
48 relevance: 0
49 },
50
51 // """heredoc strings"""
52 {
53 className: 'string',
54 begin: '"""', end: '"""'
55 },
56
57 { // "strings"
58 className: 'string',
59 begin: '"', end: '"',
60 illegal: '\\n',
61 contains: [ hljs.BACKSLASH_ESCAPE ],
62 relevance: 0
63 },
64
65 hljs.C_LINE_COMMENT_MODE, // single-line comments
66 hljs.C_BLOCK_COMMENT_MODE, // comment blocks
67
68 { // metadata
69 className: 'string',
70 begin: '^\\s*\\[', end: '\\]',
71 },
72
73 { // interface or namespace declaration
74 beginKeywords: 'interface namespace', end: /\{/,
75 illegal: '[;.\\-]',
76 contains: [
77 { // interface or namespace name
78 className: 'symbol',
79 begin: '[a-zA-Z0-9_]+'
80 }
81 ]
82 },
83
84 { // class declaration
85 beginKeywords: 'class', end: /\{/,
86 illegal: '[;.\\-]',
87 contains: [
88 { // class name
89 className: 'symbol',
90 begin: '[a-zA-Z0-9_]+',
91 contains: [
92 {
93 begin: '[:,]\\s*',
94 contains: [
95 {
96 className: 'symbol',
97 begin: '[a-zA-Z0-9_]+'
98 }
99 ]
100 }
101 ]
102 }
103 ]
104 },
105
106 builtInTypeMode, // built-in types
107 objectHandleMode, // object handles
108
109 { // literals
110 className: 'literal',
111 begin: '\\b(null|true|false)'
112 },
113
114 { // numbers
115 className: 'number',
116 relevance: 0,
117 begin: '(-?)(\\b0[xXbBoOdD][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?f?|\\.\\d+f?)([eE][-+]?\\d+f?)?)'
118 }
119 ]
120 };
121}
122
123module.exports = angelscript;
Note: See TracBrowser for help on using the repository browser.