more progress

This commit is contained in:
sevin7676 2015-04-17 10:00:13 -04:00
commit 76ac79f116

View file

@ -43,8 +43,8 @@ var SqlServerHighlightRules = function() {
* Once I'm certain that this is not missing anything it can be 'compiled' into a cleaner/faster format that is not executing stuff on the fly for no reason. * Once I'm certain that this is not missing anything it can be 'compiled' into a cleaner/faster format that is not executing stuff on the fly for no reason.
*/ */
// some of these are other types but I want sytanx highlighting to match SSMS // https://msdn.microsoft.com/en-us/library/ms189773.aspx
var builtinConstants = "TRUE|FALSE|NULL|IS|IN"; var logicalOperators = "ALL|AND|ANY|BETWEEN|EXISTS|IN|LIKE|NOT|OR|SOME";
// multiple pages for built in functions, the following code works for all // multiple pages for built in functions, the following code works for all
@ -115,7 +115,7 @@ var SqlServerHighlightRules = function() {
//remove any other built in things from key word list //remove any other built in things from key word list
keywords = keywords.split('|'); keywords = keywords.split('|');
keywords = keywords.filter(function(value, index, self) { keywords = keywords.filter(function(value, index, self) {
return builtinConstants.split('|').indexOf(value) === -1 && builtinFunctions.split('|').indexOf(value) === -1 && dataTypes.split('|').indexOf(value) === -1; return logicalOperators.split('|').indexOf(value) === -1 && builtinFunctions.split('|').indexOf(value) === -1 && dataTypes.split('|').indexOf(value) === -1;
}); });
keywords = keywords.sort().join('|'); keywords = keywords.sort().join('|');
@ -123,7 +123,7 @@ var SqlServerHighlightRules = function() {
"support.function": builtinFunctions, "support.function": builtinFunctions,
"keyword": keywords, "keyword": keywords,
"keyword.set": setStatements, "keyword.set": setStatements,
"constant.language": builtinConstants, "constant.language": logicalOperators,
"storage.type": dataTypes "storage.type": dataTypes
}, "identifier", true); }, "identifier", true);
@ -153,13 +153,12 @@ var SqlServerHighlightRules = function() {
regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, { }, {
token: keywordMapper, token: keywordMapper,
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex: "@{0,2}[a-zA-Z_$][a-zA-Z0-9_$]*\\b" //up to 2 @symbols for some build in functions
} }, {
/* this works to make variables designated with @ symbol show as a single token... but it screws up built in functions that start with @ symbol
, {
token: "constant.class", token: "constant.class",
regex: "@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex: "@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}*/, { }, {
//https://msdn.microsoft.com/en-us/library/ms174986.aspx
token: "keyword.operator", token: "keyword.operator",
regex: "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=" regex: "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
}, { }, {
@ -168,10 +167,12 @@ var SqlServerHighlightRules = function() {
}, { }, {
token: "paren.rparen", token: "paren.rparen",
regex: "[\\)]" regex: "[\\)]"
}, { }
/*, {
token : "text", token : "text",
regex : "\\s+" regex : "\\s+"
} ] }*/
]
}; };
this.normalizeRules(); this.normalizeRules();
}; };