Refinement
Includes proper MUSH substitution/register highlighting
This commit is contained in:
parent
7099a2604c
commit
00c5b8cecc
1 changed files with 27 additions and 47 deletions
|
|
@ -10,6 +10,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
|||
|
||||
var MushCodeRules = function() {
|
||||
|
||||
|
||||
var keywords = (
|
||||
"@if|"+
|
||||
"@ifelse|"+
|
||||
|
|
@ -22,6 +23,9 @@ var MushCodeRules = function() {
|
|||
"@touch|"+
|
||||
"@ataste|"+
|
||||
"@osound|"+
|
||||
"@ahear|"+
|
||||
"@aahear|"+
|
||||
"@amhear|"+
|
||||
"@otouch|"+
|
||||
"@otaste|"+
|
||||
"@drop|"+
|
||||
|
|
@ -285,6 +289,7 @@ var MushCodeRules = function() {
|
|||
"encrypt|"+
|
||||
"escape|"+
|
||||
"if|"+
|
||||
"ifelse|"+
|
||||
"lcstr|"+
|
||||
"left|"+
|
||||
"lit|"+
|
||||
|
|
@ -398,7 +403,7 @@ var MushCodeRules = function() {
|
|||
"@@|"+
|
||||
"bakerdays|"+
|
||||
"bodybuild|"+
|
||||
"box|"+
|
||||
"box|"+
|
||||
"capall|"+
|
||||
"catalog|"+
|
||||
"children|"+
|
||||
|
|
@ -485,14 +490,11 @@ var MushCodeRules = function() {
|
|||
"piechartlabel|"+
|
||||
"createmaze|"+
|
||||
"drawmaze|"+
|
||||
"drawwireframe"
|
||||
);
|
||||
|
||||
//var futureReserved = "";
|
||||
"drawwireframe"
|
||||
);
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"invalid.deprecated": "debugger",
|
||||
"support.function": builtinFunctions,
|
||||
//"invalid.illegal": futureReserved,
|
||||
"constant.language": builtinConstants,
|
||||
"keyword": keywords
|
||||
}, "identifier");
|
||||
|
|
@ -513,30 +515,24 @@ var MushCodeRules = function() {
|
|||
var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
|
||||
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "comment",
|
||||
regex : ";.*$"
|
||||
}, {
|
||||
token : "string", // """ string
|
||||
regex : strPre + '"{3}(?:[^\\\\]|\\\\.)*?"{3}'
|
||||
}, {
|
||||
token : "string", // multi line """ string start
|
||||
regex : strPre + '"{3}.*$',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "string", // " string
|
||||
regex : strPre + '"(?:[^\\\\]|\\\\.)*?"'
|
||||
}, {
|
||||
token : "string", // ''' string
|
||||
regex : strPre + "'{3}(?:[^\\\\]|\\\\.)*?'{3}"
|
||||
}, {
|
||||
token : "string", // multi line ''' string start
|
||||
regex : strPre + "'{3}.*$",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string", // ' string
|
||||
regex : strPre + "'(?:[^\\\\]|\\\\.)*?'"
|
||||
}, {
|
||||
"start" : [
|
||||
{
|
||||
token : "variable", // mush substitution register
|
||||
regex : "%[0-9]{1}"
|
||||
},
|
||||
{
|
||||
token : "variable", // mush substitution register
|
||||
regex : "%q[0-9A-Za-z]{1}"
|
||||
},
|
||||
{
|
||||
token : "variable", // mush special character register
|
||||
regex : "%[a-zA-Z]{1}"
|
||||
},
|
||||
{
|
||||
token: "variable.language",
|
||||
regex: "%[a-z0-9-_]+"
|
||||
},
|
||||
{
|
||||
token : "constant.numeric", // imaginary
|
||||
regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
|
||||
}, {
|
||||
|
|
@ -553,7 +549,7 @@ var MushCodeRules = function() {
|
|||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||
regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|#|%|<<|>>|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[\\[\\(\\{]"
|
||||
|
|
@ -564,22 +560,6 @@ var MushCodeRules = function() {
|
|||
token : "text",
|
||||
regex : "\\s+"
|
||||
} ],
|
||||
"qqstring" : [ {
|
||||
token : "string", // multi line """ string end
|
||||
regex : '(?:[^\\\\]|\\\\.)*?"{3}',
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '.+'
|
||||
} ],
|
||||
"qstring" : [ {
|
||||
token : "string", // multi line ''' string end
|
||||
regex : "(?:[^\\\\]|\\\\.)*?'{3}",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '.+'
|
||||
} ]
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue