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"],
|
||||
PHP: ["php|phtml"],
|
||||
Powershell: ["ps1"],
|
||||
Praat: ["praat"],
|
||||
Prolog: ["plg|prolog"],
|
||||
Properties: ["properties"],
|
||||
Protobuf: ["proto"],
|
||||
|
|
|
|||
|
|
@ -33,13 +33,13 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
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 Range = require("../range").Range;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = PerlHighlightRules;
|
||||
this.HighlightRules = PraatHighlightRules;
|
||||
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.foldingRules = new CStyleFoldMode({start: "^=(begin|item)\\b", end: "^=(cut)\\b"});
|
||||
|
|
@ -49,11 +49,6 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
|
||||
this.lineCommentStart = "#";
|
||||
this.blockComment = [
|
||||
{start: "=begin", end: "=cut"},
|
||||
{start: "=item", end: "=cut"}
|
||||
];
|
||||
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
|
@ -83,7 +78,7 @@ oop.inherits(Mode, TextMode);
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/perl";
|
||||
this.$id = "ace/mode/praat";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
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) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var PerlHighlightRules = function() {
|
||||
var PraatHighlightRules = function() {
|
||||
|
||||
var keywords = (
|
||||
"base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" +
|
||||
"no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars"
|
||||
"if|then|else|elsif|elif|endif|fi|" +
|
||||
"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 = (
|
||||
"getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" +
|
||||
"gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|" +
|
||||
"getpeername|setpriority|getprotoent|setprotoent|getpriority|" +
|
||||
"endprotoent|getservent|setservent|endservent|sethostent|socketpair|" +
|
||||
"getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|" +
|
||||
"localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|" +
|
||||
"closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|" +
|
||||
"shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|" +
|
||||
"dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|" +
|
||||
"setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|" +
|
||||
"lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|" +
|
||||
"waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|" +
|
||||
"chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|" +
|
||||
"unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|" +
|
||||
"length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|" +
|
||||
"undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|" +
|
||||
"sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|" +
|
||||
"BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|" +
|
||||
"join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|" +
|
||||
"keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|" +
|
||||
"eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|" +
|
||||
"map|die|uc|lc|do"
|
||||
var predefinedVariables = (
|
||||
"macintosh|windows|unix|" +
|
||||
"praatVersion|praatVersion\\$" +
|
||||
"pi|undefined|" +
|
||||
"newline\\$|tab\\$|" +
|
||||
"shellDirectory\\$|homeDirectory\\$|preferencesDirectory\\$|" +
|
||||
"temporaryDirectory\\$|defaultDirectory\\$"
|
||||
);
|
||||
|
||||
var functions = (
|
||||
// Math functions
|
||||
"writeInfo|writeInfoLine|appendInfo|appendInfoLine|" +
|
||||
"writeFile|writeFileLine|appendFile|appendFileLine|" +
|
||||
"abs|round|floor|ceiling|min|max|imin|imax|" +
|
||||
"sqrt|sin|cos|tan|arcsin|arccos|arctan|arctan2|sinc|sincpi|" +
|
||||
"exp|ln|log10|log2|" +
|
||||
"sinh|cosh|tanh|arcsinh|arccosh|actanh|" +
|
||||
"sigmoid|invSigmoid|erf|erfc|" +
|
||||
"randomUniform|randomInteger|randomGauss|randomPoisson|" +
|
||||
"lnGamma|gaussP|gaussQ|invGaussQ|" +
|
||||
"chiSquareP|chiSquareQ|invChiSquareQ|studentP|studentQ|invStudentQ|" +
|
||||
"fisherP|fisherQ|invFisherQ|" +
|
||||
"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({
|
||||
"keyword": keywords,
|
||||
"constant.language": buildinConstants,
|
||||
"support.function": builtinFunctions
|
||||
// "constant.language": buildinConstants,
|
||||
"support.function": functions
|
||||
}, "identifier");
|
||||
|
||||
var inlineIf = this.createKeywordMapper({
|
||||
"keyword": "(if|then|else|fi)",
|
||||
// "constant.language": buildinConstants,
|
||||
"support.function": functions
|
||||
}, "identifier");
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
|
|
@ -80,86 +109,111 @@ var PerlHighlightRules = function() {
|
|||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : "comment.doc",
|
||||
regex : "^=(?:begin|item)\\b",
|
||||
next : "block_comment"
|
||||
token : "entity.name.type",
|
||||
regex : "(" + objectTypes + ")"
|
||||
}, {
|
||||
token : "string.regexp",
|
||||
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
|
||||
token : "variable.language",
|
||||
regex : "(" + predefinedVariables + ")"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
token : ["support.function", "text"],
|
||||
regex : "((?:" + functions + ")\\$?)(\\s*(?::|\\())"
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
regex : '["].*\\\\$',
|
||||
next : "qqstring"
|
||||
// token : ["keyword", "text", "keyword", "text", "keyword", "text"],
|
||||
// regex : /\b(for)(\s+\S+\s*)(?:(from)(\s+[a-z][a-zA-Z0-9_.]*\$?\s*))?(?:(to)(\s+\S+\s*))?/,
|
||||
// }, {
|
||||
token : "keyword",
|
||||
regex : /(\bfor\b)/,
|
||||
next : "for"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||
token : "keyword",
|
||||
regex : "(\\b(?:" + keywords + ")\\b)"
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
regex : "['].*\\\\$",
|
||||
next : "qstring"
|
||||
token : "string.interpolated",
|
||||
regex : /'((?:[a-z][a-zA-Z0-9_]*)(?:\$|#|:[0-9]+)?)'/
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : "0x[0-9a-fA-F]+\\b"
|
||||
token : "string",
|
||||
regex : /"[^"]*"/
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
token : ["text", "keyword", "text", "entity.name.section"], // multi line string start
|
||||
regex : /(^\s*)(\bform\b)(\s+)(.*)/,
|
||||
next : "form"
|
||||
}, {
|
||||
token : keywordMapper,
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
token : "constant.numeric",
|
||||
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",
|
||||
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",
|
||||
regex : "#.*$"
|
||||
}, {
|
||||
token : "lparen",
|
||||
regex : "[[({]"
|
||||
token : "text",
|
||||
regex : /\s+/
|
||||
}
|
||||
],
|
||||
"form" : [
|
||||
{
|
||||
token : ["keyword", "text", "constant.numeric"],
|
||||
regex : /((?:optionmenu|choice)\s+)(\S+:\s+)([0-9]+)/
|
||||
}, {
|
||||
token : "rparen",
|
||||
regex : "[\\])}]"
|
||||
token : ["keyword", "constant.numeric"],
|
||||
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",
|
||||
regex : "\\s+"
|
||||
}
|
||||
],
|
||||
"qqstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
||||
regex : /$/,
|
||||
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