-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample-ace.txt
173 lines (158 loc) · 5.9 KB
/
sample-ace.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var GmlLangHighlightRules = function() {
var docComment = DocCommentHighlightRules;
var builtinFunctions = lang.arrayToMap(
('%s').split('| ')
);
var keywords = lang.arrayToMap(
('if|then|else|and|or|while|do|for|switch|case|until|div|mod').split('|')
);
var languageConstructs = lang.arrayToMap(
('repeat|break|continue|exit|return|var|globalvar|with').split('|')
);
var builtinConstants = lang.arrayToMap(
('%s').split('| ')
);
var builtinVariables = lang.arrayToMap(
('%s').split('| ')
);
var builtinVariablesReadOnly = lang.arrayToMap(
('%s').split('| ')
);
var builtinFunctionsDeprecated = lang.arrayToMap(
('%s').split('| ')
);
var futureReserved = lang.arrayToMap([]);
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = {
"start" : [
{
token : "comment",
regex : "\\/\\/.*$"
},
/*{
token : "comment",
regex : "#.*$"
},
//docComment.getStartRule("doc-start"),
,*/{
token : "comment", // multi line comment
regex : "\\/\\*",
next : "comment"
}, {
token : "string.regexp",
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"
}, {
token : "string", // " string start
regex : '"',
next : "qqstring"
}, {
token : "string", // ' string start
regex : "'",
next : "qstring"
}, {
token : "constant.numeric", // hex
regex : "\\$[0-9a-fA-F]+\\b"
}, /*{
token: "constant.language",
regex: "\\b(?:c_(?:white|red|orange)|fa_(?:left|right|middle|bottom))\\b"
},/*{
token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
},*/ {
token : function(value) {
if (keywords.hasOwnProperty(value))
return "keyword";
else if (languageConstructs.hasOwnProperty(value))
return "keyword";
else if (builtinConstants.hasOwnProperty(value))
return "constant.language";
else if (builtinVariables.hasOwnProperty(value))
return "variable.language";
else if (builtinVariablesReadOnly.hasOwnProperty(value))
return "variable.language";
//else if (futureReserved.hasOwnProperty(value))
// return "invalid.illegal";
else if (builtinFunctions.hasOwnProperty(value))
return "support.function";
else if (builtinFunctionsDeprecated.hasOwnProperty(value))
return "invalid.deprecated";
/*else
//if(value.match(/^(\$[a-zA-Z][a-zA-Z0-9_]*|self|parent)$/))
if(value.match(/^([a-zA-Z][a-zA-Z0-9_]*)$/))
return "variable";*/
return "identifier";
},
// [orig comments from PHP]
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
},{
token : "keyword.operator",
regex : "!|\\$|%s|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%s=|\\+=|\\-=|&=|\\^=|\\b(?:asdf)"
}, {
token : "lparen",
regex : "[[({]"
}, {
token : "rparen",
regex : "[\\])}]"
}, {
token : "text",
regex : "\\s+"
}
],
"comment" : [
{
token : "comment", // closing comment
regex : ".*?\\*\\/",
next : "start"
}, {
token : "comment", // comment spanning whole line
regex : ".+"
}
],
"qqstring" : [
/*{
token : "constant.language.escape",
regex : '\\\\(?:[nrtvef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})'
}, {
token : "constant.language.escape",
regex : /\$[\w\d]+(?:\[[\w\d]+\])?/
}, {
token : "constant.language.escape",
regex : /\$\{[^"\}]+\}?/ // this is wrong but ok for now
}, */{
token : "string",
regex : '"',
next : "start"
}, {
token : "string",
regex : '.+?'
}
],
"qstring" : [
/*{
token : "constant.language.escape",
regex : "\\\\['\\\\]"
}, */{
token : "string",
regex : "'",
next : "start"
}, {
token : "string",
regex : ".+?"
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(GmlLangHighlightRules, TextHighlightRules);
exports.GmlLangHighlightRules = GmlLangHighlightRules;
});