Fixed boolean constants and null.

This commit is contained in:
John Kane 2011-09-30 00:14:00 +01:00
commit 24fb491b95

View file

@ -11,11 +11,6 @@ var PowershellHighlightRules = function() {
("function|if|else|elseif|switch|while|default|for|do|until|break|continue|foreach|return|filter|in|trap|throw|param|begin|process|end").split("|") ("function|if|else|elseif|switch|while|default|for|do|until|break|continue|foreach|return|filter|in|trap|throw|param|begin|process|end").split("|")
); );
var buildinConstants = lang.arrayToMap(
("$Null|$True|$False").split("|")
);
// regexp must not have capturing parentheses. Use (?:) instead. // regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -24,9 +19,6 @@ var PowershellHighlightRules = function() {
{ {
token : "comment", token : "comment",
regex : "#.*$" regex : "#.*$"
}, {
token : "string.regexp",
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
}, { }, {
token : "string", // single line token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
@ -41,15 +33,14 @@ var PowershellHighlightRules = function() {
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, { }, {
token : "constant.language.boolean", token : "constant.language.boolean",
regex : "(?:true|false)\\b" regex : "[$](?:[Tt]rue|[Ff]alse)\\b"
}, {
token : "constant.language.boolean",
regex : "[$][Nn]ull\\b"
}, { }, {
token : function(value) { token : function(value) {
if (value == "this") if (keywords.hasOwnProperty(value))
return "variable.language";
else if (keywords.hasOwnProperty(value))
return "keyword"; return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else else
return "identifier"; return "identifier";
}, },