Removed unused code; Added missing keywords; Added defaultToken

This commit is contained in:
Robik 2013-11-24 11:25:11 +01:00
commit 76230003b6

View file

@ -38,18 +38,19 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var DHighlightRules = function() {
var keywords = (
"this|super|import|module|body|mixin|__traits|invariant|alias|asm|delete|typeof|typeid|sizeof|cast|new|in"
"this|super|import|module|body|mixin|__traits|invariant|alias|asm|delete|"+
"typeof|typeid|sizeof|cast|new|in|is|typedef|__vector|__parameters"
);
var keywordControls = (
"break|case|continue|default|do|else|for|foreach|foreach_reverse|goto|if|" +
"return|switch|while|catch|try|throw|finally|version"
"return|switch|while|catch|try|throw|finally|version|assert|unittest|with"
);
var types = (
"auto|bool|char|dchar|wchar|byte|ubyte|" +
"auto|bool|char|dchar|wchar|byte|ubyte|float|double|real|" +
"cfloat|creal|cdouble|cent|ifloat|ireal|idouble|" +
"int|long|short|void|uint|ulong|ushort|" +
"int|long|short|void|uint|ulong|ushort|ucent|" +
"function|delegate|string|wstring|dstring|size_t|ptrdiff_t|hash_t|Object"
);
@ -60,7 +61,7 @@ var DHighlightRules = function() {
);
var storages = (
"class|struct|union|template|interface|enum"
"class|struct|union|template|interface|enum|macro"
);
var stringEscapesSeq = {
@ -94,10 +95,6 @@ var DHighlightRules = function() {
"constant.language": builtinConstants
}, "identifier");
var paramsTokensFunc = function(grp) {
console.log(grp);
};
var identifierRe = "[a-zA-Z_\u00a1-\uffff][a-zA-Z\\d_\u00a1-\uffff]*\\b";
// regexp must not have capturing parentheses. Use (?:) instead.
@ -197,8 +194,7 @@ var DHighlightRules = function() {
regex : ".*?\\*\\/",
next : "start"
}, {
token : "comment", // comment spanning whole line
regex : ".+"
defaultToken: 'comment'
}
],
"plus-comment" : [
@ -207,8 +203,7 @@ var DHighlightRules = function() {
regex : ".*?\\+\\/",
next : "start"
}, {
token : "comment", // comment spanning whole line
regex : ".+"
defaultToken: 'comment'
}
],
@ -219,8 +214,7 @@ var DHighlightRules = function() {
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"[cdw]?',
next : "start"
}, {
token : "string",
regex : '.+'
defaultToken: 'string'
}
],
@ -231,8 +225,7 @@ var DHighlightRules = function() {
regex : '(?:(?:\\\\.)|(?:[^`\\\\]))*?`[cdw]?',
next : "start"
}, {
token : "string",
regex : '.+'
defaultToken: 'string'
}
],
@ -328,7 +321,7 @@ var DHighlightRules = function() {
DHighlightRules.metaData = {
comment: 'D language',
fileTypes: [ 'd', 'di' ],
firstLineMatch: '^#!.*\\bg?dmd\\b.',
firstLineMatch: '^#!.*\\b[glr]?dmd\\b.',
foldingStartMarker: '(?x)/\\*\\*(?!\\*)|^(?![^{]*?//|[^{]*?/\\*(?!.*?\\*/.*?\\{)).*?\\{\\s*($|//|/\\*(?!.*?\\*/.*\\S))',
foldingStopMarker: '(?<!\\*)\\*\\*/|^\\s*\\}',
keyEquivalent: '^~D',