Debian Codegraph @

extensions/CodeEditor/modules/lib/ace/mode-livescript.js

raw symbols SCIP
1 ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
2 var Range = require("../range").Range;
3 var MatchingBraceOutdent = function () { };
4 (function () {
5 this.checkOutdent = function (line, input) {
6 if (!/^\s+$/.test(line))
7 return false;
8 return /^\s*\}/.test(input);
9 };
10 this.autoOutdent = function (doc, row) {
11 var line = doc.getLine(row);
12 var match = line.match(/^(\s*\})/);
13 if (!match)
14 return 0;
15 var column = match[1].length;
16 var openBracePos = doc.findMatchingBracket({ row: row, column: column });
17 if (!openBracePos || openBracePos.row == row)
18 return 0;
19 var indent = this.$getIndent(doc.getLine(openBracePos.row));
20 doc.replace(new Range(row, 0, row, column - 1), indent);
21 };
22 this.$getIndent = function (line) {
23 return line.match(/^\s*/)[0];
24 };
25 }).call(MatchingBraceOutdent.prototype);
26 exports.MatchingBraceOutdent = MatchingBraceOutdent;
27
28 });
29
30 ace.define("ace/mode/livescript",["require","exports","module","ace/tokenizer","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/text"], function(require, exports, module){var identifier, LiveScriptMode, keywordend, stringfill;
31 identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*';
32 exports.Mode = LiveScriptMode = (function (superclass) {
33 var indenter, prototype = extend$((import$(LiveScriptMode, superclass).displayName = 'LiveScriptMode', LiveScriptMode), superclass).prototype, constructor = LiveScriptMode;
34 function LiveScriptMode() {
35 var that;
36 this.$tokenizer = new (require('../tokenizer')).Tokenizer(LiveScriptMode.Rules);
37 if (that = require('../mode/matching_brace_outdent')) {
38 this.$outdent = new that.MatchingBraceOutdent;
39 }
40 this.$id = "ace/mode/livescript";
41 this.$behaviour = new (require("./behaviour/cstyle").CstyleBehaviour)();
42 }
43 indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$');
44 prototype.getNextLineIndent = function (state, line, tab) {
45 var indent, tokens;
46 indent = this.$getIndent(line);
47 tokens = this.$tokenizer.getLineTokens(line, state).tokens;
48 if (!(tokens.length && tokens[tokens.length - 1].type === 'comment')) {
49 if (state === 'start' && indenter.test(line)) {
50 indent += tab;
51 }
52 }
53 return indent;
54 };
55 prototype.lineCommentStart = "#";
56 prototype.blockComment = { start: "###", end: "###" };
57 prototype.checkOutdent = function (state, line, input) {
58 var ref$;
59 return (ref$ = this.$outdent) != null ? ref$.checkOutdent(line, input) : void 8;
60 };
61 prototype.autoOutdent = function (state, doc, row) {
62 var ref$;
63 return (ref$ = this.$outdent) != null ? ref$.autoOutdent(doc, row) : void 8;
64 };
65 return LiveScriptMode;
66 }(require('../mode/text').Mode));
67 keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
68 stringfill = {
69 defaultToken: 'string'
70 };
71 LiveScriptMode.Rules = {
72 start: [
73 {
74 token: 'keyword',
75 regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)' + keywordend
76 }, {
77 token: 'constant.language',
78 regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend
79 }, {
80 token: 'invalid.illegal',
81 regex: '(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)' + keywordend
82 }, {
83 token: 'language.support.class',
84 regex: '(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)' + keywordend
85 }, {
86 token: 'language.support.function',
87 regex: '(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)' + keywordend
88 }, {
89 token: 'variable.language',
90 regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend
91 }, {
92 token: 'identifier',
93 regex: identifier + '\\s*:(?![:=])'
94 }, {
95 token: 'variable',
96 regex: identifier
97 }, {
98 token: 'keyword.operator',
99 regex: '(?:\\.{3}|\\s+\\?)'
100 }, {
101 token: 'keyword.variable',
102 regex: '(?:@+|::|\\.\\.)',
103 next: 'key'
104 }, {
105 token: 'keyword.operator',
106 regex: '\\.\\s*',
107 next: 'key'
108 }, {
109 token: 'string',
110 regex: '\\\\\\S[^\\s,;)}\\]]*'
111 }, {
112 token: 'string.doc',
113 regex: '\'\'\'',
114 next: 'qdoc'
115 }, {
116 token: 'string.doc',
117 regex: '"""',
118 next: 'qqdoc'
119 }, {
120 token: 'string',
121 regex: '\'',
122 next: 'qstring'
123 }, {
124 token: 'string',
125 regex: '"',
126 next: 'qqstring'
127 }, {
128 token: 'string',
129 regex: '`',
130 next: 'js'
131 }, {
132 token: 'string',
133 regex: '<\\[',
134 next: 'words'
135 }, {
136 token: 'string.regex',
137 regex: '//',
138 next: 'heregex'
139 }, {
140 token: 'comment.doc',
141 regex: '/\\*',
142 next: 'comment'
143 }, {
144 token: 'comment',
145 regex: '#.*'
146 }, {
147 token: 'string.regex',
148 regex: '\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}',
149 next: 'key'
150 }, {
151 token: 'constant.numeric',
152 regex: '(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)'
153 }, {
154 token: 'lparen',
155 regex: '[({[]'
156 }, {
157 token: 'rparen',
158 regex: '[)}\\]]',
159 next: 'key'
160 }, {
161 token: 'keyword.operator',
162 regex: '[\\^!|&%+\\-]+'
163 }, {
164 token: 'text',
165 regex: '\\s+'
166 }
167 ],
168 heregex: [
169 {
170 token: 'string.regex',
171 regex: '.*?//[gimy$?]{0,4}',
172 next: 'start'
173 }, {
174 token: 'string.regex',
175 regex: '\\s*#{'
176 }, {
177 token: 'comment.regex',
178 regex: '\\s+(?:#.*)?'
179 }, {
180 defaultToken: 'string.regex'
181 }
182 ],
183 key: [
184 {
185 token: 'keyword.operator',
186 regex: '[.?@!]+'
187 }, {
188 token: 'identifier',
189 regex: identifier,
190 next: 'start'
191 }, {
192 token: 'text',
193 regex: '',
194 next: 'start'
195 }
196 ],
197 comment: [
198 {
199 token: 'comment.doc',
200 regex: '.*?\\*/',
201 next: 'start'
202 }, {
203 defaultToken: 'comment.doc'
204 }
205 ],
206 qdoc: [
207 {
208 token: 'string',
209 regex: ".*?'''",
210 next: 'key'
211 }, stringfill
212 ],
213 qqdoc: [
214 {
215 token: 'string',
216 regex: '.*?"""',
217 next: 'key'
218 }, stringfill
219 ],
220 qstring: [
221 {
222 token: 'string',
223 regex: '[^\\\\\']*(?:\\\\.[^\\\\\']*)*\'',
224 next: 'key'
225 }, stringfill
226 ],
227 qqstring: [
228 {
229 token: 'string',
230 regex: '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
231 next: 'key'
232 }, stringfill
233 ],
234 js: [
235 {
236 token: 'string',
237 regex: '[^\\\\`]*(?:\\\\.[^\\\\`]*)*`',
238 next: 'key'
239 }, stringfill
240 ],
241 words: [
242 {
243 token: 'string',
244 regex: '.*?\\]>',
245 next: 'key'
246 }, stringfill
247 ]
248 };
249 function extend$(sub, sup) {
250 function fun() { }
251 fun.prototype = (sub.superclass = sup).prototype;
252 (sub.prototype = new fun).constructor = sub;
253 if (typeof sup.extended == 'function')
254 sup.extended(sub);
255 return sub;
256 }
257 function import$(obj, src) {
258 var own = {}.hasOwnProperty;
259 for (var key in src)
260 if (own.call(src, key))
261 obj[key] = src[key];
262 return obj;
263 }
264
265 }); (function() {
266 ace.require(["ace/mode/livescript"], function(m) {
267 if (typeof module == "object" && typeof exports == "object" && module) {
268 module.exports = m;
269 }
270 });
271 })();
272