Fixed operators and introduced broken lines
This commit is contained in:
parent
df92a99e93
commit
08afa03cb9
1 changed files with 32 additions and 15 deletions
|
|
@ -8,7 +8,7 @@ var PraatHighlightRules = function() {
|
|||
|
||||
var keywords = (
|
||||
"if|then|else|elsif|elif|endif|fi|" +
|
||||
"endfor|" + // other for-related keywords are specified below
|
||||
"endfor|endproc|" + // other for-related keywords are specified below
|
||||
"while|endwhile|" +
|
||||
"repeat|until|" +
|
||||
"select|plus|minus|" +
|
||||
|
|
@ -109,6 +109,18 @@ var PraatHighlightRules = function() {
|
|||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : ["text", "keyword.operator", "text"],
|
||||
regex : /(\s+)((?:\+|-|\/|\*|<|>)=?|==?|!=|%|\^|\||and|or|not)(\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 : "entity.name.type",
|
||||
regex : "(" + objectTypes + ")"
|
||||
}, {
|
||||
|
|
@ -118,9 +130,6 @@ var PraatHighlightRules = function() {
|
|||
token : ["support.function", "text"],
|
||||
regex : "((?:" + functions + ")\\$?)(\\s*(?::|\\())"
|
||||
}, {
|
||||
// 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"
|
||||
|
|
@ -133,6 +142,10 @@ var PraatHighlightRules = function() {
|
|||
}, {
|
||||
token : "string",
|
||||
regex : /"[^"]*"/
|
||||
}, {
|
||||
token : "string",
|
||||
regex : /"[^"]*$/,
|
||||
next : "brokenstring"
|
||||
}, {
|
||||
token : ["text", "keyword", "text", "entity.name.section"], // multi line string start
|
||||
regex : /(^\s*)(\bform\b)(\s+)(.*)/,
|
||||
|
|
@ -140,6 +153,9 @@ var PraatHighlightRules = function() {
|
|||
}, {
|
||||
token : "constant.numeric",
|
||||
regex : /\b[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||
}, {
|
||||
token : ["keyword", "text", "entity.name.function"],
|
||||
regex : /(procedure)(\s+)(\S+)/
|
||||
}, {
|
||||
token : ["entity.name.function", "text"],
|
||||
regex : /(@\S+)(:|\s*\()/
|
||||
|
|
@ -147,17 +163,8 @@ var PraatHighlightRules = function() {
|
|||
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 : /(?:\b((?:\+|-|\/|\*|<|>)=?|==?|!=|%|\^|\||and|or|not)\b)/
|
||||
token : "comment",
|
||||
regex : ";.*$"
|
||||
}, {
|
||||
token : "comment",
|
||||
regex : "#.*$"
|
||||
|
|
@ -210,6 +217,16 @@ var PraatHighlightRules = function() {
|
|||
next : "start"
|
||||
}
|
||||
],
|
||||
"brokenstring" : [
|
||||
{
|
||||
token : ["text", "string"],
|
||||
regex : /(\s*\.{3})([^"]*)/
|
||||
}, {
|
||||
token : "string",
|
||||
regex : /"/,
|
||||
next : "start"
|
||||
}
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue