Praat syntax highlighter, first release
This commit is contained in:
parent
e4355adae7
commit
df92a99e93
4 changed files with 290 additions and 125 deletions
115
demo/kitchen-sink/docs/praat.praat
Normal file
115
demo/kitchen-sink/docs/praat.praat
Normal file
|
|
@ -0,0 +1,115 @@
|
||||||
|
form Highlighter test
|
||||||
|
sentence My_sentence This should all be a string
|
||||||
|
text My_text This should also all be a string
|
||||||
|
word My_word Only the first word is a string, the rest is invalid
|
||||||
|
boolean Binary 1
|
||||||
|
boolean Text no
|
||||||
|
boolean Quoted "yes"
|
||||||
|
comment This should be a string
|
||||||
|
real left_Range -123.6
|
||||||
|
positive right_Range_max 3.3
|
||||||
|
integer Int 4
|
||||||
|
natural Nat 4
|
||||||
|
endform
|
||||||
|
|
||||||
|
# old-style procedure call
|
||||||
|
call oldStyle "quoted" 2 unquoted string
|
||||||
|
assert oldStyle.local = 1
|
||||||
|
|
||||||
|
# New-style procedure call with parens
|
||||||
|
@newStyle("quoted", 2, "quoted string")
|
||||||
|
if praatVersion >= 5364
|
||||||
|
# New-style procedure call with colon
|
||||||
|
@newStyle: "quoted", 2, "quoted string"
|
||||||
|
endif
|
||||||
|
assert newStyle.local = 1
|
||||||
|
|
||||||
|
# if-block with built-in variables
|
||||||
|
if windows
|
||||||
|
# We are on Windows
|
||||||
|
elsif unix = 1 or !macintosh
|
||||||
|
# We are on Linux
|
||||||
|
else macintosh == 1
|
||||||
|
# We are on Mac
|
||||||
|
endif
|
||||||
|
|
||||||
|
# inline if with inline comment
|
||||||
|
var = if macintosh = 1 then 0 else 1 fi ; This is an inline comment
|
||||||
|
|
||||||
|
# for-loop with explicit from using local variable
|
||||||
|
# and paren-style function calls and variable interpolation
|
||||||
|
n = numberOfSelected("Sound")
|
||||||
|
for i from newStyle.local to n
|
||||||
|
sound'i' = selected("Sound", i)
|
||||||
|
sound[i] = sound'i'
|
||||||
|
endfor
|
||||||
|
|
||||||
|
for i from 1 to n
|
||||||
|
# Different styles of object selection
|
||||||
|
select sound'i'
|
||||||
|
sound = selected()
|
||||||
|
sound$ = selected$("Sound")
|
||||||
|
select Sound 'sound$'
|
||||||
|
selectObject(sound[i])
|
||||||
|
selectObject: sound
|
||||||
|
|
||||||
|
# New-style standalone command call
|
||||||
|
Rename: "SomeName"
|
||||||
|
|
||||||
|
# Command call with assignment
|
||||||
|
duration = Get total duration
|
||||||
|
|
||||||
|
# Multi-line command with modifier
|
||||||
|
pitch = noprogress To Pitch (ac): 0, 75, 15, "no",
|
||||||
|
...0.03, 0.45, 0.01, 0.35, 0.14, 600
|
||||||
|
|
||||||
|
# Old-style command with assignment
|
||||||
|
minimum = Get minimum... 0 0 "Hertz" Parabolic
|
||||||
|
|
||||||
|
# New-style multi-line command call with broken strings
|
||||||
|
table = Create Table with column names: "table", 0,
|
||||||
|
..."file subject speaker
|
||||||
|
...f0 f1 f2 f3 " +
|
||||||
|
..."duration response"
|
||||||
|
|
||||||
|
removeObject: pitch, table
|
||||||
|
|
||||||
|
# Picture window commands
|
||||||
|
selectObject: sound
|
||||||
|
Select inner viewport: 1, 6, 0.5, 1.5
|
||||||
|
Black
|
||||||
|
Draw... 0 0 0 0 "no" Curve
|
||||||
|
Draw inner box
|
||||||
|
Text bottom: "yes", sound$
|
||||||
|
Erase all
|
||||||
|
|
||||||
|
# Demo window commands
|
||||||
|
demo Erase all
|
||||||
|
demo Select inner viewport... 0 100 0 100
|
||||||
|
demo Axes... 0 100 0 100
|
||||||
|
demo Paint rectangle... white 0 100 0 100
|
||||||
|
demo Purple
|
||||||
|
demo Times
|
||||||
|
demo 24
|
||||||
|
# The "to" in "Click to finish" should not be a keyword
|
||||||
|
demo Text... 50 centre 50 half Click to finish
|
||||||
|
demoWaitForInput ( )
|
||||||
|
demo Erase all
|
||||||
|
demo Select inner viewport... 0 100 0 100
|
||||||
|
demo Axes... 0 100 0 100
|
||||||
|
demo Paint rectangle... purple 0 100 0 100
|
||||||
|
demo Yellow
|
||||||
|
demo Times
|
||||||
|
demo 24
|
||||||
|
demo Text... 50 centre 50 half Finished
|
||||||
|
endfor
|
||||||
|
|
||||||
|
# Old-style procedure declaration
|
||||||
|
procedure oldStyle .str1$ .num .str2$
|
||||||
|
.local = 1
|
||||||
|
endproc
|
||||||
|
|
||||||
|
# New-style procedure declaration
|
||||||
|
procedure newStyle (.str1$, .num, .str2$)
|
||||||
|
.local = 1
|
||||||
|
endproc
|
||||||
|
|
@ -113,6 +113,7 @@ var supportedModes = {
|
||||||
pgSQL: ["pgsql"],
|
pgSQL: ["pgsql"],
|
||||||
PHP: ["php|phtml"],
|
PHP: ["php|phtml"],
|
||||||
Powershell: ["ps1"],
|
Powershell: ["ps1"],
|
||||||
|
Praat: ["praat"],
|
||||||
Prolog: ["plg|prolog"],
|
Prolog: ["plg|prolog"],
|
||||||
Properties: ["properties"],
|
Properties: ["properties"],
|
||||||
Protobuf: ["proto"],
|
Protobuf: ["proto"],
|
||||||
|
|
|
||||||
|
|
@ -33,13 +33,13 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
var oop = require("../lib/oop");
|
var oop = require("../lib/oop");
|
||||||
var TextMode = require("./text").Mode;
|
var TextMode = require("./text").Mode;
|
||||||
var PerlHighlightRules = require("./perl_highlight_rules").PerlHighlightRules;
|
var PraatHighlightRules = require("./praat_highlight_rules").PraatHighlightRules;
|
||||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
var Range = require("../range").Range;
|
var Range = require("../range").Range;
|
||||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
var Mode = function() {
|
var Mode = function() {
|
||||||
this.HighlightRules = PerlHighlightRules;
|
this.HighlightRules = PraatHighlightRules;
|
||||||
|
|
||||||
this.$outdent = new MatchingBraceOutdent();
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
this.foldingRules = new CStyleFoldMode({start: "^=(begin|item)\\b", end: "^=(cut)\\b"});
|
this.foldingRules = new CStyleFoldMode({start: "^=(begin|item)\\b", end: "^=(cut)\\b"});
|
||||||
|
|
@ -49,11 +49,6 @@ oop.inherits(Mode, TextMode);
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
this.lineCommentStart = "#";
|
this.lineCommentStart = "#";
|
||||||
this.blockComment = [
|
|
||||||
{start: "=begin", end: "=cut"},
|
|
||||||
{start: "=item", end: "=cut"}
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
@ -83,7 +78,7 @@ oop.inherits(Mode, TextMode);
|
||||||
this.$outdent.autoOutdent(doc, row);
|
this.$outdent.autoOutdent(doc, row);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$id = "ace/mode/perl";
|
this.$id = "ace/mode/praat";
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
exports.Mode = Mode;
|
exports.Mode = Mode;
|
||||||
|
|
|
||||||
|
|
@ -1,77 +1,106 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Distributed under the BSD license:
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Ajax.org B.V.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of Ajax.org B.V. nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var oop = require("../lib/oop");
|
var oop = require("../lib/oop");
|
||||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
var PerlHighlightRules = function() {
|
var PraatHighlightRules = function() {
|
||||||
|
|
||||||
var keywords = (
|
var keywords = (
|
||||||
"base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" +
|
"if|then|else|elsif|elif|endif|fi|" +
|
||||||
"no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars"
|
"endfor|" + // other for-related keywords are specified below
|
||||||
|
"while|endwhile|" +
|
||||||
|
"repeat|until|" +
|
||||||
|
"select|plus|minus|" +
|
||||||
|
"assert"
|
||||||
);
|
);
|
||||||
|
|
||||||
var buildinConstants = ("ARGV|ENV|INC|SIG");
|
// var buildinConstants = ("ARGV|ENV|INC|SIG");
|
||||||
|
|
||||||
var builtinFunctions = (
|
var predefinedVariables = (
|
||||||
"getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" +
|
"macintosh|windows|unix|" +
|
||||||
"gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|" +
|
"praatVersion|praatVersion\\$" +
|
||||||
"getpeername|setpriority|getprotoent|setprotoent|getpriority|" +
|
"pi|undefined|" +
|
||||||
"endprotoent|getservent|setservent|endservent|sethostent|socketpair|" +
|
"newline\\$|tab\\$|" +
|
||||||
"getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|" +
|
"shellDirectory\\$|homeDirectory\\$|preferencesDirectory\\$|" +
|
||||||
"localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|" +
|
"temporaryDirectory\\$|defaultDirectory\\$"
|
||||||
"closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|" +
|
);
|
||||||
"shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|" +
|
|
||||||
"dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|" +
|
var functions = (
|
||||||
"setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|" +
|
// Math functions
|
||||||
"lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|" +
|
"writeInfo|writeInfoLine|appendInfo|appendInfoLine|" +
|
||||||
"waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|" +
|
"writeFile|writeFileLine|appendFile|appendFileLine|" +
|
||||||
"chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|" +
|
"abs|round|floor|ceiling|min|max|imin|imax|" +
|
||||||
"unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|" +
|
"sqrt|sin|cos|tan|arcsin|arccos|arctan|arctan2|sinc|sincpi|" +
|
||||||
"length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|" +
|
"exp|ln|log10|log2|" +
|
||||||
"undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|" +
|
"sinh|cosh|tanh|arcsinh|arccosh|actanh|" +
|
||||||
"sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|" +
|
"sigmoid|invSigmoid|erf|erfc|" +
|
||||||
"BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|" +
|
"randomUniform|randomInteger|randomGauss|randomPoisson|" +
|
||||||
"join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|" +
|
"lnGamma|gaussP|gaussQ|invGaussQ|" +
|
||||||
"keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|" +
|
"chiSquareP|chiSquareQ|invChiSquareQ|studentP|studentQ|invStudentQ|" +
|
||||||
"eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|" +
|
"fisherP|fisherQ|invFisherQ|" +
|
||||||
"map|die|uc|lc|do"
|
"binomialP|binomialQ|invBinomialP|invBinomialQ|" +
|
||||||
|
"hertzToBark|barkToHerz|" +
|
||||||
|
"hertzToMel|melToHertz|" +
|
||||||
|
"hertzToSemitones|semitonesToHerz|" +
|
||||||
|
"erb|hertzToErb|erbToHertz|" +
|
||||||
|
"phonToDifferenceLimens|differenceLimensToPhon|" +
|
||||||
|
"beta|besselI|besselK|" +
|
||||||
|
// String functions
|
||||||
|
"selected|selected$|numberOfSelected|variableExists|"+
|
||||||
|
"index|rindex|startsWith|endsWith|"+
|
||||||
|
"index_regex|rindex_regex|replace_regex$|"+
|
||||||
|
"length|extractWord$|extractLine$|extractNumber|" +
|
||||||
|
"left$|right$|mid$|replace$|" +
|
||||||
|
// Pause functions
|
||||||
|
"beginPause|endPause|" +
|
||||||
|
// Demo functions
|
||||||
|
"demoShow|demoWindowTitle|demoInput|demoWaitForInput|" +
|
||||||
|
"demoClicked|demoClickedIn|demoX|demoY|" +
|
||||||
|
"demoKeyPressed|demoKey$|" +
|
||||||
|
"demoExtraControlKeyPressed|demoShiftKeyPressed|"+
|
||||||
|
"demoCommandKeyPressed|demoOptionKeyPressed|" +
|
||||||
|
// File functions
|
||||||
|
"environment$|" +
|
||||||
|
"chooseDirectory$|createDirectory|fileReadable|deleteFile|" +
|
||||||
|
"selectObject|removeObject|plusObject|minusObject|" +
|
||||||
|
"runScript|exitScript"
|
||||||
|
);
|
||||||
|
|
||||||
|
var objectTypes = (
|
||||||
|
"Collection|Strings|ManPages|SortedSetOfString|Sound|Matrix|Polygon|" +
|
||||||
|
"PointProcess|ParamCurve|Spectrum|Ltas|Spectrogram|Formant|" +
|
||||||
|
"Excitation|Cochleagram|VocalTract|FormantPoint|FormantTier|" +
|
||||||
|
"FormantGrid|Label|Tier|Autosegment|Intensity|Pitch|Harmonicity|" +
|
||||||
|
"Transition|RealPoint|RealTier|PitchTier|IntensityTier|DurationTier|" +
|
||||||
|
"AmplitudeTier|SpectrumTier|Manipulation|TextPoint|TextInterval|" +
|
||||||
|
"TextTier|IntervalTier|TextGrid|LongSound|WordList|SpellingChecker|" +
|
||||||
|
"Movie|Corpus|TableOfReal|Distributions|PairDistribution|Table|" +
|
||||||
|
"LinearRegression|LogisticRegression|Art|Artword|Speaker|Activation|" +
|
||||||
|
"BarkFilter|Categories|Cepstrum|CCA|ChebyshevSeries|" +
|
||||||
|
"ClassificationTable|Confusion|Correlation|Covariance|Discriminant|" +
|
||||||
|
"DTW|Eigen|Excitations|FormantFilter|Index|KlattTable|Permutation|" +
|
||||||
|
"ISpline|LegendreSeries|MelFilter|MSpline|Pattern|PCA|Polynomial|" +
|
||||||
|
"Roots|SimpleString|StringsIndex|SpeechSynthesizer|SPINET|SSCP|SVD|" +
|
||||||
|
"AffineTransform|Procrustes|ContingencyTable|Dissimilarity|" +
|
||||||
|
"Similarity|Configuration|Distance|Salience|ScalarProduct|Weight|" +
|
||||||
|
"KlattGrid|HMM|HMM_State|HMM_Observation|HMM_ObservationSequence|" +
|
||||||
|
"HMM_StateSequence|GaussianMixture|Diagonalizer|MixingMatrix|" +
|
||||||
|
"CrossCorrelationTable|CrossCorrelationTables|Network|OTGrammar|" +
|
||||||
|
"OTHistory|OTMulti|FFNet|Cepstrumc|LPC|LFCC|MFCC|ExperimentMFC|" +
|
||||||
|
"ResultsMFC|EEG|ERPTier|ERP|KNN|FeatureWeights"
|
||||||
);
|
);
|
||||||
|
|
||||||
var keywordMapper = this.createKeywordMapper({
|
var keywordMapper = this.createKeywordMapper({
|
||||||
"keyword": keywords,
|
"keyword": keywords,
|
||||||
"constant.language": buildinConstants,
|
// "constant.language": buildinConstants,
|
||||||
"support.function": builtinFunctions
|
"support.function": functions
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
var inlineIf = this.createKeywordMapper({
|
||||||
|
"keyword": "(if|then|else|fi)",
|
||||||
|
// "constant.language": buildinConstants,
|
||||||
|
"support.function": functions
|
||||||
}, "identifier");
|
}, "identifier");
|
||||||
|
|
||||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||||
|
|
@ -80,86 +109,111 @@ var PerlHighlightRules = function() {
|
||||||
this.$rules = {
|
this.$rules = {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment.doc",
|
token : "entity.name.type",
|
||||||
regex : "^=(?:begin|item)\\b",
|
regex : "(" + objectTypes + ")"
|
||||||
next : "block_comment"
|
|
||||||
}, {
|
}, {
|
||||||
token : "string.regexp",
|
token : "variable.language",
|
||||||
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
|
regex : "(" + predefinedVariables + ")"
|
||||||
}, {
|
}, {
|
||||||
token : "string", // single line
|
token : ["support.function", "text"],
|
||||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
regex : "((?:" + functions + ")\\$?)(\\s*(?::|\\())"
|
||||||
}, {
|
}, {
|
||||||
token : "string", // multi line string start
|
// token : ["keyword", "text", "keyword", "text", "keyword", "text"],
|
||||||
regex : '["].*\\\\$',
|
// regex : /\b(for)(\s+\S+\s*)(?:(from)(\s+[a-z][a-zA-Z0-9_.]*\$?\s*))?(?:(to)(\s+\S+\s*))?/,
|
||||||
next : "qqstring"
|
// }, {
|
||||||
|
token : "keyword",
|
||||||
|
regex : /(\bfor\b)/,
|
||||||
|
next : "for"
|
||||||
}, {
|
}, {
|
||||||
token : "string", // single line
|
token : "keyword",
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : "(\\b(?:" + keywords + ")\\b)"
|
||||||
}, {
|
}, {
|
||||||
token : "string", // multi line string start
|
token : "string.interpolated",
|
||||||
regex : "['].*\\\\$",
|
regex : /'((?:[a-z][a-zA-Z0-9_]*)(?:\$|#|:[0-9]+)?)'/
|
||||||
next : "qstring"
|
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "string",
|
||||||
regex : "0x[0-9a-fA-F]+\\b"
|
regex : /"[^"]*"/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : ["text", "keyword", "text", "entity.name.section"], // multi line string start
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /(^\s*)(\bform\b)(\s+)(.*)/,
|
||||||
|
next : "form"
|
||||||
}, {
|
}, {
|
||||||
token : keywordMapper,
|
token : "constant.numeric",
|
||||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
regex : /\b[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
|
}, {
|
||||||
|
token : ["entity.name.function", "text"],
|
||||||
|
regex : /(@\S+)(:|\s*\()/
|
||||||
|
}, {
|
||||||
|
token : ["text", "keyword", "text", "entity.name.function"],
|
||||||
|
regex : /(^\s*)(call)(\s+)(\S+)/
|
||||||
|
}, {
|
||||||
|
token : ["text", "text", "keyword.operator", "text", "keyword", "text", "keyword"],
|
||||||
|
regex : /(^\s*)(?:([a-z][a-zA-Z0-9_]*\$?\s+)(=)(\s+))?(?:((?:no)?warn|nocheck|noprogress)(\s+))?((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/
|
||||||
|
}, {
|
||||||
|
token : ["text", "keyword", "text", "keyword"],
|
||||||
|
regex : /(^\s*)(?:(demo)?(\s+))((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/
|
||||||
|
}, {
|
||||||
|
token : ["text", "keyword"],
|
||||||
|
regex : /(^\s*)(demo\b)/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "%#|\\$#|\\.\\.\\.|\\|\\|=|>>=|<<=|<=>|&&=|=>|!~|\\^=|&=|\\|=|\\.=|x=|%=|\\/=|\\*=|\\-=|\\+=|=~|\\*\\*|\\-\\-|\\.\\.|\\|\\||&&|\\+\\+|\\->|!=|==|>=|<=|>>|<<|,|=|\\?\\:|\\^|\\||x|%|\\/|\\*|<|&|\\\\|~|!|>|\\.|\\-|\\+|\\-C|\\-b|\\-S|\\-u|\\-t|\\-p|\\-l|\\-d|\\-f|\\-g|\\-s|\\-z|\\-k|\\-e|\\-O|\\-T|\\-B|\\-M|\\-A|\\-X|\\-W|\\-c|\\-R|\\-o|\\-x|\\-w|\\-r|\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)"
|
regex : /(?:\b((?:\+|-|\/|\*|<|>)=?|==?|!=|%|\^|\||and|or|not)\b)/
|
||||||
}, {
|
}, {
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "#.*$"
|
regex : "#.*$"
|
||||||
}, {
|
}, {
|
||||||
token : "lparen",
|
token : "text",
|
||||||
regex : "[[({]"
|
regex : /\s+/
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"form" : [
|
||||||
|
{
|
||||||
|
token : ["keyword", "text", "constant.numeric"],
|
||||||
|
regex : /((?:optionmenu|choice)\s+)(\S+:\s+)([0-9]+)/
|
||||||
}, {
|
}, {
|
||||||
token : "rparen",
|
token : ["keyword", "constant.numeric"],
|
||||||
regex : "[\\])}]"
|
regex : /((?:option|button)\s+)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b)/
|
||||||
|
}, {
|
||||||
|
token : ["keyword", "string"],
|
||||||
|
regex : /((?:option|button)\s+)(.*)/
|
||||||
|
}, {
|
||||||
|
token : ["keyword", "text", "string"],
|
||||||
|
regex : /((?:sentence|text)\s+)(\S+\s*)(.*)/
|
||||||
|
}, {
|
||||||
|
token : ["keyword", "text", "string", "invalid.illegal"],
|
||||||
|
regex : /(word\s+)(\S+\s*)(\S+)?(\s.*)?/
|
||||||
|
}, {
|
||||||
|
token : ["keyword", "text", "constant.language"],
|
||||||
|
regex : /(boolean\s+)(\S+\s*)(0|1|"?(?:yes|no)"?)/
|
||||||
|
}, {
|
||||||
|
token : ["keyword", "text", "constant.numeric"],
|
||||||
|
regex : /((?:real|natural|positive|integer)\s+)(\S+\s*)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b)/
|
||||||
|
}, {
|
||||||
|
token : ["keyword", "string"],
|
||||||
|
regex : /(comment\s+)(.*)/
|
||||||
|
}, {
|
||||||
|
token : "keyword",
|
||||||
|
regex : 'endform',
|
||||||
|
next : "start"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"for" : [
|
||||||
|
{
|
||||||
|
token : ["keyword", "text", "constant.numeric", "text"],
|
||||||
|
regex : /(from|to)(\s+)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?)(\s*)/
|
||||||
|
}, {
|
||||||
|
token : ["keyword", "text"],
|
||||||
|
regex : /(from|to)(\s+\S+\s*)/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /$/,
|
||||||
}
|
|
||||||
],
|
|
||||||
"qqstring" : [
|
|
||||||
{
|
|
||||||
token : "string",
|
|
||||||
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
|
||||||
token : "string",
|
|
||||||
regex : '.+'
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"qstring" : [
|
|
||||||
{
|
|
||||||
token : "string",
|
|
||||||
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
|
||||||
next : "start"
|
|
||||||
}, {
|
|
||||||
token : "string",
|
|
||||||
regex : '.+'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"block_comment": [
|
|
||||||
{
|
|
||||||
token: "comment.doc",
|
|
||||||
regex: "^=cut\\b",
|
|
||||||
next: "start"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
defaultToken: "comment.doc"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
oop.inherits(PerlHighlightRules, TextHighlightRules);
|
oop.inherits(PraatHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
exports.PerlHighlightRules = PerlHighlightRules;
|
exports.PraatHighlightRules = PraatHighlightRules;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue