more progress
This commit is contained in:
parent
1a6e2f83f2
commit
76ac79f116
1 changed files with 37 additions and 36 deletions
|
|
@ -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.
|
||||
*/
|
||||
|
||||
// some of these are other types but I want sytanx highlighting to match SSMS
|
||||
var builtinConstants = "TRUE|FALSE|NULL|IS|IN";
|
||||
// https://msdn.microsoft.com/en-us/library/ms189773.aspx
|
||||
var logicalOperators = "ALL|AND|ANY|BETWEEN|EXISTS|IN|LIKE|NOT|OR|SOME";
|
||||
|
||||
|
||||
// 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
|
||||
keywords = keywords.split('|');
|
||||
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('|');
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ var SqlServerHighlightRules = function() {
|
|||
"support.function": builtinFunctions,
|
||||
"keyword": keywords,
|
||||
"keyword.set": setStatements,
|
||||
"constant.language": builtinConstants,
|
||||
"constant.language": logicalOperators,
|
||||
"storage.type": dataTypes
|
||||
}, "identifier", true);
|
||||
|
||||
|
|
@ -135,43 +135,44 @@ var SqlServerHighlightRules = function() {
|
|||
}
|
||||
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "comment",
|
||||
regex : "--.*$"
|
||||
}, {
|
||||
token : "comment",
|
||||
start : "/\\*",
|
||||
end : "\\*/"
|
||||
"start": [{
|
||||
token: "comment",
|
||||
regex: "--.*$"
|
||||
}, {
|
||||
token : "string", // " string
|
||||
regex : '".*?"'
|
||||
token: "comment",
|
||||
start: "/\\*",
|
||||
end: "\\*/"
|
||||
}, {
|
||||
token : "string", // ' string
|
||||
regex : "'.*?'"
|
||||
token: "string", // " string
|
||||
regex: '".*?"'
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
token: "string", // ' string
|
||||
regex: "'.*?'"
|
||||
}, {
|
||||
token : keywordMapper,
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
token: "constant.numeric", // float
|
||||
regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
}, {
|
||||
token: keywordMapper,
|
||||
regex: "@{0,2}[a-zA-Z_$][a-zA-Z0-9_$]*\\b" //up to 2 @symbols for some build in functions
|
||||
}, {
|
||||
token: "constant.class",
|
||||
regex: "@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
//https://msdn.microsoft.com/en-us/library/ms174986.aspx
|
||||
token: "keyword.operator",
|
||||
regex: "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||
}, {
|
||||
token: "paren.lparen",
|
||||
regex: "[\\(]"
|
||||
}, {
|
||||
token: "paren.rparen",
|
||||
regex: "[\\)]"
|
||||
}
|
||||
/* 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",
|
||||
regex : "@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}*/, {
|
||||
token : "keyword.operator",
|
||||
regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[\\(]"
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : "[\\)]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
} ]
|
||||
/*, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}*/
|
||||
]
|
||||
};
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue