From 76230003b68a12150170004d1c80eafa1b78301e Mon Sep 17 00:00:00 2001 From: Robik Date: Sun, 24 Nov 2013 11:25:11 +0100 Subject: [PATCH] Removed unused code; Added missing keywords; Added defaultToken --- lib/ace/mode/d_highlight_rules.js | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/lib/ace/mode/d_highlight_rules.js b/lib/ace/mode/d_highlight_rules.js index 02700183..b0a0923e 100644 --- a/lib/ace/mode/d_highlight_rules.js +++ b/lib/ace/mode/d_highlight_rules.js @@ -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: '(?