Debian Codegraph @

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

raw symbols SCIP
1 ace.define("ace/mode/applescript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
2 var oop = require("../lib/oop");
3 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
4 var AppleScriptHighlightRules = function () {
5 var keywords = ("about|above|after|against|and|around|as|at|back|before|beginning|" +
6 "behind|below|beneath|beside|between|but|by|considering|" +
7 "contain|contains|continue|copy|div|does|eighth|else|end|equal|" +
8 "equals|error|every|exit|fifth|first|for|fourth|from|front|" +
9 "get|given|global|if|ignoring|in|into|is|it|its|last|local|me|" +
10 "middle|mod|my|ninth|not|of|on|onto|or|over|prop|property|put|ref|" +
11 "reference|repeat|returning|script|second|set|seventh|since|" +
12 "sixth|some|tell|tenth|that|the|then|third|through|thru|" +
13 "timeout|times|to|transaction|try|until|where|while|whose|with|without");
14 var builtinConstants = ("AppleScript|false|linefeed|return|pi|quote|result|space|tab|true");
15 var builtinFunctions = ("activate|beep|count|delay|launch|log|offset|read|round|run|say|" +
16 "summarize|write");
17 var builtinTypes = ("alias|application|boolean|class|constant|date|file|integer|list|" +
18 "number|real|record|string|text|character|characters|contents|day|" +
19 "frontmost|id|item|length|month|name|paragraph|paragraphs|rest|" +
20 "reverse|running|time|version|weekday|word|words|year");
21 var keywordMapper = this.createKeywordMapper({
22 "support.function": builtinFunctions,
23 "constant.language": builtinConstants,
24 "support.type": builtinTypes,
25 "keyword": keywords
26 }, "identifier");
27 this.$rules = {
28 "start": [
29 {
30 token: "comment",
31 regex: "--.*$"
32 },
33 {
34 token: "comment", // multi line comment
35 regex: "\\(\\*",
36 next: "comment"
37 },
38 {
39 token: "string", // " string
40 regex: '".*?"'
41 },
42 {
43 token: "support.type",
44 regex: '\\b(POSIX file|POSIX path|(date|time) string|quoted form)\\b'
45 },
46 {
47 token: "support.function",
48 regex: '\\b(clipboard info|the clipboard|info for|list (disks|folder)|' +
49 'mount volume|path to|(close|open for) access|(get|set) eof|' +
50 'current date|do shell script|get volume settings|random number|' +
51 'set volume|system attribute|system info|time to GMT|' +
52 '(load|run|store) script|scripting components|' +
53 'ASCII (character|number)|localized string|' +
54 'choose (application|color|file|file name|' +
55 'folder|from list|remote application|URL)|' +
56 'display (alert|dialog))\\b|^\\s*return\\b'
57 },
58 {
59 token: "constant.language",
60 regex: '\\b(text item delimiters|current application|missing value)\\b'
61 },
62 {
63 token: "keyword",
64 regex: '\\b(apart from|aside from|instead of|out of|greater than|' +
65 "isn't|(doesn't|does not) (equal|come before|come after|contain)|" +
66 '(greater|less) than( or equal)?|(starts?|ends|begins?) with|' +
67 'contained by|comes (before|after)|a (ref|reference))\\b'
68 },
69 {
70 token: keywordMapper,
71 regex: "[a-zA-Z][a-zA-Z0-9_]*\\b"
72 }
73 ],
74 "comment": [
75 {
76 token: "comment", // closing comment
77 regex: "\\*\\)",
78 next: "start"
79 }, {
80 defaultToken: "comment"
81 }
82 ]
83 };
84 this.normalizeRules();
85 };
86 oop.inherits(AppleScriptHighlightRules, TextHighlightRules);
87 exports.AppleScriptHighlightRules = AppleScriptHighlightRules;
88
89 });
90
91 ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
92 var oop = require("../../lib/oop");
93 var Range = require("../../range").Range;
94 var BaseFoldMode = require("./fold_mode").FoldMode;
95 var FoldMode = exports.FoldMode = function (commentRegex) {
96 if (commentRegex) {
97 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
98 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
99 }
100 };
101 oop.inherits(FoldMode, BaseFoldMode);
102 (function () {
103 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
104 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
105 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
106 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
107 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
108 this._getFoldWidgetBase = this.getFoldWidget;
109 this.getFoldWidget = function (session, foldStyle, row) {
110 var line = session.getLine(row);
111 if (this.singleLineBlockCommentRe.test(line)) {
112 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
113 return "";
114 }
115 var fw = this._getFoldWidgetBase(session, foldStyle, row);
116 if (!fw && this.startRegionRe.test(line))
117 return "start"; // lineCommentRegionStart
118 return fw;
119 };
120 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
121 var line = session.getLine(row);
122 if (this.startRegionRe.test(line))
123 return this.getCommentRegionBlock(session, line, row);
124 var match = line.match(this.foldingStartMarker);
125 if (match) {
126 var i = match.index;
127 if (match[1])
128 return this.openingBracketBlock(session, match[1], row, i);
129 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
130 if (range && !range.isMultiLine()) {
131 if (forceMultiline) {
132 range = this.getSectionRange(session, row);
133 }
134 else if (foldStyle != "all")
135 range = null;
136 }
137 return range;
138 }
139 if (foldStyle === "markbegin")
140 return;
141 var match = line.match(this.foldingStopMarker);
142 if (match) {
143 var i = match.index + match[0].length;
144 if (match[1])
145 return this.closingBracketBlock(session, match[1], row, i);
146 return session.getCommentFoldRange(row, i, -1);
147 }
148 };
149 this.getSectionRange = function (session, row) {
150 var line = session.getLine(row);
151 var startIndent = line.search(/\S/);
152 var startRow = row;
153 var startColumn = line.length;
154 row = row + 1;
155 var endRow = row;
156 var maxRow = session.getLength();
157 while (++row < maxRow) {
158 line = session.getLine(row);
159 var indent = line.search(/\S/);
160 if (indent === -1)
161 continue;
162 if (startIndent > indent)
163 break;
164 var subRange = this.getFoldWidgetRange(session, "all", row);
165 if (subRange) {
166 if (subRange.start.row <= startRow) {
167 break;
168 }
169 else if (subRange.isMultiLine()) {
170 row = subRange.end.row;
171 }
172 else if (startIndent == indent) {
173 break;
174 }
175 }
176 endRow = row;
177 }
178 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
179 };
180 this.getCommentRegionBlock = function (session, line, row) {
181 var startColumn = line.search(/\s*$/);
182 var maxRow = session.getLength();
183 var startRow = row;
184 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
185 var depth = 1;
186 while (++row < maxRow) {
187 line = session.getLine(row);
188 var m = re.exec(line);
189 if (!m)
190 continue;
191 if (m[1])
192 depth--;
193 else
194 depth++;
195 if (!depth)
196 break;
197 }
198 var endRow = row;
199 if (endRow > startRow) {
200 return new Range(startRow, startColumn, endRow, line.length);
201 }
202 };
203 }).call(FoldMode.prototype);
204
205 });
206
207 ace.define("ace/mode/applescript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/applescript_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
208 var oop = require("../lib/oop");
209 var TextMode = require("./text").Mode;
210 var AppleScriptHighlightRules = require("./applescript_highlight_rules").AppleScriptHighlightRules;
211 var FoldMode = require("./folding/cstyle").FoldMode;
212 var Mode = function () {
213 this.HighlightRules = AppleScriptHighlightRules;
214 this.foldingRules = new FoldMode();
215 this.$behaviour = this.$defaultBehaviour;
216 };
217 oop.inherits(Mode, TextMode);
218 (function () {
219 this.lineCommentStart = "--";
220 this.blockComment = { start: "(*", end: "*)" };
221 this.$id = "ace/mode/applescript";
222 }).call(Mode.prototype);
223 exports.Mode = Mode;
224
225 }); (function() {
226 ace.require(["ace/mode/applescript"], function(m) {
227 if (typeof module == "object" && typeof exports == "object" && module) {
228 module.exports = m;
229 }
230 });
231 })();
232