File size: 9,613 Bytes
08c964e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
ace.define(
	'ace/mode/sh_highlight_rules',
	['require', 'exports', 'module', 'ace/lib/oop', 'ace/mode/text_highlight_rules'],
	function (e, t, n) {
		'use strict'
		var r = e('../lib/oop'),
			i = e('./text_highlight_rules').TextHighlightRules,
			s = (t.reservedKeywords =
				'!|{|}|case|do|done|elif|else|esac|fi|for|if|in|then|until|while|&|;|export|local|read|typeset|unset|elif|select|set|function|declare|readonly'),
			o = (t.languageConstructs =
				'[|]|alias|bg|bind|break|builtin|cd|command|compgen|complete|continue|dirs|disown|echo|enable|eval|exec|exit|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|popd|printf|pushd|pwd|return|set|shift|shopt|source|suspend|test|times|trap|type|ulimit|umask|unalias|wait'),
			u = function () {
				var e = this.createKeywordMapper(
						{ keyword: s, 'support.function.builtin': o, 'invalid.deprecated': 'debugger' },
						'identifier'
					),
					t = '(?:(?:[1-9]\\d*)|(?:0))',
					n = '(?:\\.\\d+)',
					r = '(?:\\d+)',
					i = '(?:(?:' + r + '?' + n + ')|(?:' + r + '\\.))',
					u = '(?:(?:' + i + '|' + r + ')' + ')',
					a = '(?:' + u + '|' + i + ')',
					f = '(?:&' + r + ')',
					l = '[a-zA-Z_][a-zA-Z0-9_]*',
					c = '(?:' + l + '(?==))',
					h = '(?:\\$(?:SHLVL|\\$|\\!|\\?))',
					p = '(?:' + l + '\\s*\\(\\))'
				;(this.$rules = {
					start: [
						{ token: 'constant', regex: /\\./ },
						{ token: ['text', 'comment'], regex: /(^|\s)(#.*)$/ },
						{
							token: 'string.start',
							regex: '"',
							push: [
								{ token: 'constant.language.escape', regex: /\\(?:[$`"\\]|$)/ },
								{ include: 'variables' },
								{ token: 'keyword.operator', regex: /`/ },
								{ token: 'string.end', regex: '"', next: 'pop' },
								{ defaultToken: 'string' },
							],
						},
						{
							token: 'string',
							regex: "\\$'",
							push: [
								{
									token: 'constant.language.escape',
									regex:
										/\\(?:[abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/,
								},
								{ token: 'string', regex: "'", next: 'pop' },
								{ defaultToken: 'string' },
							],
						},
						{ regex: '<<<', token: 'keyword.operator' },
						{
							stateName: 'heredoc',
							regex: '(<<-?)(\\s*)([\'"`]?)([\\w\\-]+)([\'"`]?)',
							onMatch: function (e, t, n) {
								var r = e[2] == '-' ? 'indentedHeredoc' : 'heredoc',
									i = e.split(this.splitRegex)
								return (
									n.push(r, i[4]),
									[
										{ type: 'constant', value: i[1] },
										{ type: 'text', value: i[2] },
										{ type: 'string', value: i[3] },
										{ type: 'support.class', value: i[4] },
										{ type: 'string', value: i[5] },
									]
								)
							},
							rules: {
								heredoc: [
									{
										onMatch: function (e, t, n) {
											return e === n[1]
												? (n.shift(), n.shift(), (this.next = n[0] || 'start'), 'support.class')
												: ((this.next = ''), 'string')
										},
										regex: '.*$',
										next: 'start',
									},
								],
								indentedHeredoc: [
									{ token: 'string', regex: '^	+' },
									{
										onMatch: function (e, t, n) {
											return e === n[1]
												? (n.shift(), n.shift(), (this.next = n[0] || 'start'), 'support.class')
												: ((this.next = ''), 'string')
										},
										regex: '.*$',
										next: 'start',
									},
								],
							},
						},
						{
							regex: '$',
							token: 'empty',
							next: function (e, t) {
								return t[0] === 'heredoc' || t[0] === 'indentedHeredoc' ? t[0] : e
							},
						},
						{
							token: ['keyword', 'text', 'text', 'text', 'variable'],
							regex: /(declare|local|readonly)(\s+)(?:(-[fixar]+)(\s+))?([a-zA-Z_][a-zA-Z0-9_]*\b)/,
						},
						{ token: 'variable.language', regex: h },
						{ token: 'variable', regex: c },
						{ include: 'variables' },
						{ token: 'support.function', regex: p },
						{ token: 'support.function', regex: f },
						{ token: 'string', start: "'", end: "'" },
						{ token: 'constant.numeric', regex: a },
						{ token: 'constant.numeric', regex: t + '\\b' },
						{ token: e, regex: '[a-zA-Z_][a-zA-Z0-9_]*\\b' },
						{
							token: 'keyword.operator',
							regex: '\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!=|[%&|`]',
						},
						{ token: 'punctuation.operator', regex: ';' },
						{ token: 'paren.lparen', regex: '[\\[\\(\\{]' },
						{ token: 'paren.rparen', regex: '[\\]]' },
						{ token: 'paren.rparen', regex: '[\\)\\}]', next: 'pop' },
					],
					variables: [
						{ token: 'variable', regex: /(\$)(\w+)/ },
						{ token: ['variable', 'paren.lparen'], regex: /(\$)(\()/, push: 'start' },
						{
							token: [
								'variable',
								'paren.lparen',
								'keyword.operator',
								'variable',
								'keyword.operator',
							],
							regex: /(\$)(\{)([#!]?)(\w+|[*@#?\-$!0_])(:[?+\-=]?|##?|%%?|,,?\/|\^\^?)?/,
							push: 'start',
						},
						{ token: 'variable', regex: /\$[*@#?\-$!0_]/ },
						{ token: ['variable', 'paren.lparen'], regex: /(\$)(\{)/, push: 'start' },
					],
				}),
					this.normalizeRules()
			}
		r.inherits(u, i), (t.ShHighlightRules = u)
	}
),
	ace.define(
		'ace/mode/makefile_highlight_rules',
		[
			'require',
			'exports',
			'module',
			'ace/lib/oop',
			'ace/mode/text_highlight_rules',
			'ace/mode/sh_highlight_rules',
		],
		function (e, t, n) {
			'use strict'
			var r = e('../lib/oop'),
				i = e('./text_highlight_rules').TextHighlightRules,
				s = e('./sh_highlight_rules'),
				o = function () {
					var e = this.createKeywordMapper(
						{
							keyword: s.reservedKeywords,
							'support.function.builtin': s.languageConstructs,
							'invalid.deprecated': 'debugger',
						},
						'string'
					)
					this.$rules = {
						start: [
							{ token: 'string.interpolated.backtick.makefile', regex: '`', next: 'shell-start' },
							{
								token: 'punctuation.definition.comment.makefile',
								regex: /#(?=.)/,
								next: 'comment',
							},
							{
								token: ['keyword.control.makefile'],
								regex:
									'^(?:\\s*\\b)(\\-??include|ifeq|ifneq|ifdef|ifndef|else|endif|vpath|export|unexport|define|endef|override)(?:\\b)',
							},
							{
								token: ['entity.name.function.makefile', 'text'],
								regex: '^([^\\t ]+(?:\\s[^\\t ]+)*:)(\\s*.*)',
							},
						],
						comment: [
							{ token: 'punctuation.definition.comment.makefile', regex: /.+\\/ },
							{ token: 'punctuation.definition.comment.makefile', regex: '.+', next: 'start' },
						],
						'shell-start': [
							{ token: e, regex: '[a-zA-Z_$][a-zA-Z0-9_$]*\\b' },
							{ token: 'string', regex: '\\w+' },
							{ token: 'string.interpolated.backtick.makefile', regex: '`', next: 'start' },
						],
					}
				}
			r.inherits(o, i), (t.MakefileHighlightRules = o)
		}
	),
	ace.define(
		'ace/mode/folding/coffee',
		['require', 'exports', 'module', 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'],
		function (e, t, n) {
			'use strict'
			var r = e('../../lib/oop'),
				i = e('./fold_mode').FoldMode,
				s = e('../../range').Range,
				o = (t.FoldMode = function () {})
			r.inherits(o, i),
				function () {
					;(this.getFoldWidgetRange = function (e, t, n) {
						var r = this.indentationBlock(e, n)
						if (r) return r
						var i = /\S/,
							o = e.getLine(n),
							u = o.search(i)
						if (u == -1 || o[u] != '#') return
						var a = o.length,
							f = e.getLength(),
							l = n,
							c = n
						while (++n < f) {
							o = e.getLine(n)
							var h = o.search(i)
							if (h == -1) continue
							if (o[h] != '#') break
							c = n
						}
						if (c > l) {
							var p = e.getLine(c).length
							return new s(l, a, c, p)
						}
					}),
						(this.getFoldWidget = function (e, t, n) {
							var r = e.getLine(n),
								i = r.search(/\S/),
								s = e.getLine(n + 1),
								o = e.getLine(n - 1),
								u = o.search(/\S/),
								a = s.search(/\S/)
							if (i == -1) return (e.foldWidgets[n - 1] = u != -1 && u < a ? 'start' : ''), ''
							if (u == -1) {
								if (i == a && r[i] == '#' && s[i] == '#')
									return (e.foldWidgets[n - 1] = ''), (e.foldWidgets[n + 1] = ''), 'start'
							} else if (
								u == i &&
								r[i] == '#' &&
								o[i] == '#' &&
								e.getLine(n - 2).search(/\S/) == -1
							)
								return (e.foldWidgets[n - 1] = 'start'), (e.foldWidgets[n + 1] = ''), ''
							return (
								u != -1 && u < i ? (e.foldWidgets[n - 1] = 'start') : (e.foldWidgets[n - 1] = ''),
								i < a ? 'start' : ''
							)
						})
				}.call(o.prototype)
		}
	),
	ace.define(
		'ace/mode/makefile',
		[
			'require',
			'exports',
			'module',
			'ace/lib/oop',
			'ace/mode/text',
			'ace/mode/makefile_highlight_rules',
			'ace/mode/folding/coffee',
		],
		function (e, t, n) {
			'use strict'
			var r = e('../lib/oop'),
				i = e('./text').Mode,
				s = e('./makefile_highlight_rules').MakefileHighlightRules,
				o = e('./folding/coffee').FoldMode,
				u = function () {
					;(this.HighlightRules = s),
						(this.foldingRules = new o()),
						(this.$behaviour = this.$defaultBehaviour)
				}
			r.inherits(u, i),
				function () {
					;(this.lineCommentStart = '#'),
						(this.$indentWithTabs = !0),
						(this.$id = 'ace/mode/makefile'),
						(this.snippetFileId = 'ace/snippets/makefile')
				}.call(u.prototype),
				(t.Mode = u)
		}
	)
;(function () {
	ace.require(['ace/mode/makefile'], function (m) {
		if (typeof module == 'object' && typeof exports == 'object' && module) {
			module.exports = m
		}
	})
})()