Debian Codegraph @

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

raw symbols SCIP
1 ace.define("ace/mode/praat_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 PraatHighlightRules = function () {
5 var keywords = ("if|then|else|elsif|elif|endif|fi|" +
6 "endfor|endproc|" + // related keywords specified below
7 "while|endwhile|" +
8 "repeat|until|" +
9 "select|plus|minus|" +
10 "assert|asserterror");
11 var predefinedVariables = ("macintosh|windows|unix|" +
12 "praatVersion|praatVersion\\$" +
13 "pi|undefined|" +
14 "newline\\$|tab\\$|" +
15 "shellDirectory\\$|homeDirectory\\$|preferencesDirectory\\$|" +
16 "temporaryDirectory\\$|defaultDirectory\\$");
17 var directives = ("clearinfo|endSendPraat");
18 var functions = (
19 "writeInfo|writeInfoLine|appendInfo|appendInfoLine|info\\$|" +
20 "writeFile|writeFileLine|appendFile|appendFileLine|" +
21 "abs|round|floor|ceiling|min|max|imin|imax|" +
22 "sqrt|sin|cos|tan|arcsin|arccos|arctan|arctan2|sinc|sincpi|" +
23 "exp|ln|lnBeta|lnGamma|log10|log2|" +
24 "sinh|cosh|tanh|arcsinh|arccosh|arctanh|" +
25 "sigmoid|invSigmoid|erf|erfc|" +
26 "random(?:Uniform|Integer|Gauss|Poisson|Binomial)|" +
27 "gaussP|gaussQ|invGaussQ|incompleteGammaP|incompleteBeta|" +
28 "chiSquareP|chiSquareQ|invChiSquareQ|studentP|studentQ|invStudentQ|" +
29 "fisherP|fisherQ|invFisherQ|" +
30 "binomialP|binomialQ|invBinomialP|invBinomialQ|" +
31 "hertzToBark|barkToHerz|" +
32 "hertzToMel|melToHertz|" +
33 "hertzToSemitones|semitonesToHerz|" +
34 "erb|hertzToErb|erbToHertz|" +
35 "phonToDifferenceLimens|differenceLimensToPhon|" +
36 "soundPressureToPhon|" +
37 "beta|beta2|besselI|besselK|" +
38 "numberOfColumns|numberOfRows|" +
39 "selected|selected\\$|numberOfSelected|variableExists|" +
40 "index|rindex|startsWith|endsWith|" +
41 "index_regex|rindex_regex|replace_regex\\$|" +
42 "length|extractWord\\$|extractLine\\$|extractNumber|" +
43 "left\\$|right\\$|mid\\$|replace\\$|" +
44 "date\\$|fixed\\$|percent\\$|" +
45 "zero#|linear#|randomUniform#|randomInteger#|randomGauss#|" +
46 "beginPause|endPause|" +
47 "demoShow|demoWindowTitle|demoInput|demoWaitForInput|" +
48 "demoClicked|demoClickedIn|demoX|demoY|" +
49 "demoKeyPressed|demoKey\\$|" +
50 "demoExtraControlKeyPressed|demoShiftKeyPressed|" +
51 "demoCommandKeyPressed|demoOptionKeyPressed|" +
52 "environment\\$|chooseReadFile\\$|" +
53 "chooseDirectory\\$|createDirectory|fileReadable|deleteFile|" +
54 "selectObject|removeObject|plusObject|minusObject|" +
55 "runScript|exitScript|" +
56 "beginSendPraat|endSendPraat|" +
57 "objectsAreIdentical");
58 var objectTypes = ("Activation|AffineTransform|AmplitudeTier|Art|Artword|Autosegment|" +
59 "BarkFilter|CCA|Categories|Cepstrum|Cepstrumc|ChebyshevSeries|" +
60 "ClassificationTable|Cochleagram|Collection|Configuration|" +
61 "Confusion|ContingencyTable|Corpus|Correlation|Covariance|" +
62 "CrossCorrelationTable|CrossCorrelationTables|DTW|Diagonalizer|" +
63 "Discriminant|Dissimilarity|Distance|Distributions|DurationTier|" +
64 "EEG|ERP|ERPTier|Eigen|Excitation|Excitations|ExperimentMFC|FFNet|" +
65 "FeatureWeights|Formant|FormantFilter|FormantGrid|FormantPoint|" +
66 "FormantTier|GaussianMixture|HMM|HMM_Observation|" +
67 "HMM_ObservationSequence|HMM_State|HMM_StateSequence|Harmonicity|" +
68 "ISpline|Index|Intensity|IntensityTier|IntervalTier|KNN|KlattGrid|" +
69 "KlattTable|LFCC|LPC|Label|LegendreSeries|LinearRegression|" +
70 "LogisticRegression|LongSound|Ltas|MFCC|MSpline|ManPages|" +
71 "Manipulation|Matrix|MelFilter|MixingMatrix|Movie|Network|" +
72 "OTGrammar|OTHistory|OTMulti|PCA|PairDistribution|ParamCurve|" +
73 "Pattern|Permutation|Pitch|PitchTier|PointProcess|Polygon|" +
74 "Polynomial|Procrustes|RealPoint|RealTier|ResultsMFC|Roots|SPINET|" +
75 "SSCP|SVD|Salience|ScalarProduct|Similarity|SimpleString|" +
76 "SortedSetOfString|Sound|Speaker|Spectrogram|Spectrum|SpectrumTier|" +
77 "SpeechSynthesizer|SpellingChecker|Strings|StringsIndex|Table|" +
78 "TableOfReal|TextGrid|TextInterval|TextPoint|TextTier|Tier|" +
79 "Transition|VocalTract|Weight|WordList");
80 this.$rules = {
81 "start": [
82 {
83 token: "string.interpolated",
84 regex: /'((?:\.?[a-z][a-zA-Z0-9_.]*)(?:\$|#|:[0-9]+)?)'/
85 }, {
86 token: ["text", "text", "keyword.operator", "text", "keyword"],
87 regex: /(^\s*)(?:(\.?[a-z][a-zA-Z0-9_.]*\$?\s+)(=)(\s+))?(stopwatch)/
88 }, {
89 token: ["text", "keyword", "text", "string"],
90 regex: /(^\s*)(print(?:line|tab)?|echo|exit|pause|send(?:praat|socket)|include|execute|system(?:_nocheck)?)(\s+)(.*)/
91 }, {
92 token: ["text", "keyword"],
93 regex: "(^\\s*)(" + directives + ")$"
94 }, {
95 token: ["text", "keyword.operator", "text"],
96 regex: /(\s+)((?:\+|-|\/|\*|<|>)=?|==?|!=|%|\^|\||and|or|not)(\s+)/
97 }, {
98 token: ["text", "text", "keyword.operator", "text", "keyword", "text", "keyword"],
99 regex: /(^\s*)(?:(\.?[a-z][a-zA-Z0-9_.]*\$?\s+)(=)(\s+))?(?:((?:no)?warn|(?:unix_)?nocheck|noprogress)(\s+))?((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/
100 }, {
101 token: ["text", "keyword", "text", "keyword"],
102 regex: /(^\s*)((?:no(?:warn|check))?)(\s*)(\b(?:editor(?::?)|endeditor)\b)/
103 }, {
104 token: ["text", "keyword", "text", "keyword"],
105 regex: /(^\s*)(?:(demo)?(\s+))((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/
106 }, {
107 token: ["text", "keyword", "text", "keyword"],
108 regex: /^(\s*)(?:(demo)(\s+))?(10|12|14|16|24)$/
109 }, {
110 token: ["text", "support.function", "text"],
111 regex: /(\s*)(do\$?)(\s*:\s*|\s*\(\s*)/
112 }, {
113 token: "entity.name.type",
114 regex: "(" + objectTypes + ")"
115 }, {
116 token: "variable.language",
117 regex: "(" + predefinedVariables + ")"
118 }, {
119 token: ["support.function", "text"],
120 regex: "((?:" + functions + ")\\$?)(\\s*(?::|\\())"
121 }, {
122 token: "keyword",
123 regex: /(\bfor\b)/,
124 next: "for"
125 }, {
126 token: "keyword",
127 regex: "(\\b(?:" + keywords + ")\\b)"
128 }, {
129 token: "string",
130 regex: /"[^"]*"/
131 }, {
132 token: "string",
133 regex: /"[^"]*$/,
134 next: "brokenstring"
135 }, {
136 token: ["text", "keyword", "text", "entity.name.section"],
137 regex: /(^\s*)(\bform\b)(\s+)(.*)/,
138 next: "form"
139 }, {
140 token: "constant.numeric",
141 regex: /\b[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
142 }, {
143 token: ["keyword", "text", "entity.name.function"],
144 regex: /(procedure)(\s+)([^:\s]+)/
145 }, {
146 token: ["entity.name.function", "text"],
147 regex: /(@\S+)(:|\s*\()/
148 }, {
149 token: ["text", "keyword", "text", "entity.name.function"],
150 regex: /(^\s*)(call)(\s+)(\S+)/
151 }, {
152 token: "comment",
153 regex: /(^\s*#|;).*$/
154 }, {
155 token: "text",
156 regex: /\s+/
157 }
158 ],
159 "form": [
160 {
161 token: ["keyword", "text", "constant.numeric"],
162 regex: /((?:optionmenu|choice)\s+)(\S+:\s+)([0-9]+)/
163 }, {
164 token: ["keyword", "constant.numeric"],
165 regex: /((?:option|button)\s+)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b)/
166 }, {
167 token: ["keyword", "string"],
168 regex: /((?:option|button)\s+)(.*)/
169 }, {
170 token: ["keyword", "text", "string"],
171 regex: /((?:sentence|text)\s+)(\S+\s*)(.*)/
172 }, {
173 token: ["keyword", "text", "string", "invalid.illegal"],
174 regex: /(word\s+)(\S+\s*)(\S+)?(\s.*)?/
175 }, {
176 token: ["keyword", "text", "constant.language"],
177 regex: /(boolean\s+)(\S+\s*)(0|1|"?(?:yes|no)"?)/
178 }, {
179 token: ["keyword", "text", "constant.numeric"],
180 regex: /((?:real|natural|positive|integer)\s+)(\S+\s*)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b)/
181 }, {
182 token: ["keyword", "string"],
183 regex: /(comment\s+)(.*)/
184 }, {
185 token: "keyword",
186 regex: 'endform',
187 next: "start"
188 }
189 ],
190 "for": [
191 {
192 token: ["keyword", "text", "constant.numeric", "text"],
193 regex: /(from|to)(\s+)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?)(\s*)/
194 }, {
195 token: ["keyword", "text"],
196 regex: /(from|to)(\s+\S+\s*)/
197 }, {
198 token: "text",
199 regex: /$/,
200 next: "start"
201 }
202 ],
203 "brokenstring": [
204 {
205 token: ["text", "string"],
206 regex: /(\s*\.{3})([^"]*)/
207 }, {
208 token: "string",
209 regex: /"/,
210 next: "start"
211 }
212 ]
213 };
214 };
215 oop.inherits(PraatHighlightRules, TextHighlightRules);
216 exports.PraatHighlightRules = PraatHighlightRules;
217
218 });
219
220 ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
221 var Range = require("../range").Range;
222 var MatchingBraceOutdent = function () { };
223 (function () {
224 this.checkOutdent = function (line, input) {
225 if (!/^\s+$/.test(line))
226 return false;
227 return /^\s*\}/.test(input);
228 };
229 this.autoOutdent = function (doc, row) {
230 var line = doc.getLine(row);
231 var match = line.match(/^(\s*\})/);
232 if (!match)
233 return 0;
234 var column = match[1].length;
235 var openBracePos = doc.findMatchingBracket({ row: row, column: column });
236 if (!openBracePos || openBracePos.row == row)
237 return 0;
238 var indent = this.$getIndent(doc.getLine(openBracePos.row));
239 doc.replace(new Range(row, 0, row, column - 1), indent);
240 };
241 this.$getIndent = function (line) {
242 return line.match(/^\s*/)[0];
243 };
244 }).call(MatchingBraceOutdent.prototype);
245 exports.MatchingBraceOutdent = MatchingBraceOutdent;
246
247 });
248
249 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";
250 var oop = require("../../lib/oop");
251 var Range = require("../../range").Range;
252 var BaseFoldMode = require("./fold_mode").FoldMode;
253 var FoldMode = exports.FoldMode = function (commentRegex) {
254 if (commentRegex) {
255 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
256 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
257 }
258 };
259 oop.inherits(FoldMode, BaseFoldMode);
260 (function () {
261 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
262 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
263 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
264 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
265 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
266 this._getFoldWidgetBase = this.getFoldWidget;
267 this.getFoldWidget = function (session, foldStyle, row) {
268 var line = session.getLine(row);
269 if (this.singleLineBlockCommentRe.test(line)) {
270 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
271 return "";
272 }
273 var fw = this._getFoldWidgetBase(session, foldStyle, row);
274 if (!fw && this.startRegionRe.test(line))
275 return "start"; // lineCommentRegionStart
276 return fw;
277 };
278 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
279 var line = session.getLine(row);
280 if (this.startRegionRe.test(line))
281 return this.getCommentRegionBlock(session, line, row);
282 var match = line.match(this.foldingStartMarker);
283 if (match) {
284 var i = match.index;
285 if (match[1])
286 return this.openingBracketBlock(session, match[1], row, i);
287 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
288 if (range && !range.isMultiLine()) {
289 if (forceMultiline) {
290 range = this.getSectionRange(session, row);
291 }
292 else if (foldStyle != "all")
293 range = null;
294 }
295 return range;
296 }
297 if (foldStyle === "markbegin")
298 return;
299 var match = line.match(this.foldingStopMarker);
300 if (match) {
301 var i = match.index + match[0].length;
302 if (match[1])
303 return this.closingBracketBlock(session, match[1], row, i);
304 return session.getCommentFoldRange(row, i, -1);
305 }
306 };
307 this.getSectionRange = function (session, row) {
308 var line = session.getLine(row);
309 var startIndent = line.search(/\S/);
310 var startRow = row;
311 var startColumn = line.length;
312 row = row + 1;
313 var endRow = row;
314 var maxRow = session.getLength();
315 while (++row < maxRow) {
316 line = session.getLine(row);
317 var indent = line.search(/\S/);
318 if (indent === -1)
319 continue;
320 if (startIndent > indent)
321 break;
322 var subRange = this.getFoldWidgetRange(session, "all", row);
323 if (subRange) {
324 if (subRange.start.row <= startRow) {
325 break;
326 }
327 else if (subRange.isMultiLine()) {
328 row = subRange.end.row;
329 }
330 else if (startIndent == indent) {
331 break;
332 }
333 }
334 endRow = row;
335 }
336 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
337 };
338 this.getCommentRegionBlock = function (session, line, row) {
339 var startColumn = line.search(/\s*$/);
340 var maxRow = session.getLength();
341 var startRow = row;
342 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
343 var depth = 1;
344 while (++row < maxRow) {
345 line = session.getLine(row);
346 var m = re.exec(line);
347 if (!m)
348 continue;
349 if (m[1])
350 depth--;
351 else
352 depth++;
353 if (!depth)
354 break;
355 }
356 var endRow = row;
357 if (endRow > startRow) {
358 return new Range(startRow, startColumn, endRow, line.length);
359 }
360 };
361 }).call(FoldMode.prototype);
362
363 });
364
365 ace.define("ace/mode/praat",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/praat_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
366 var oop = require("../lib/oop");
367 var TextMode = require("./text").Mode;
368 var PraatHighlightRules = require("./praat_highlight_rules").PraatHighlightRules;
369 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
370 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
371 var Mode = function () {
372 this.HighlightRules = PraatHighlightRules;
373 this.$outdent = new MatchingBraceOutdent();
374 this.foldingRules = new CStyleFoldMode();
375 this.$behaviour = this.$defaultBehaviour;
376 };
377 oop.inherits(Mode, TextMode);
378 (function () {
379 this.lineCommentStart = "#";
380 this.getNextLineIndent = function (state, line, tab) {
381 var indent = this.$getIndent(line);
382 var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
383 var tokens = tokenizedLine.tokens;
384 if (tokens.length && tokens[tokens.length - 1].type == "comment") {
385 return indent;
386 }
387 if (state == "start") {
388 var match = line.match(/^.*[\{\(\[:]\s*$/);
389 if (match) {
390 indent += tab;
391 }
392 }
393 return indent;
394 };
395 this.checkOutdent = function (state, line, input) {
396 return this.$outdent.checkOutdent(line, input);
397 };
398 this.autoOutdent = function (state, doc, row) {
399 this.$outdent.autoOutdent(doc, row);
400 };
401 this.$id = "ace/mode/praat";
402 }).call(Mode.prototype);
403 exports.Mode = Mode;
404
405 }); (function() {
406 ace.require(["ace/mode/praat"], function(m) {
407 if (typeof module == "object" && typeof exports == "object" && module) {
408 module.exports = m;
409 }
410 });
411 })();
412