vendor/assets/javascripts/ace/mode-dart.js in ace-rails-ap-3.0.1 vs vendor/assets/javascripts/ace/mode-dart.js in ace-rails-ap-3.0.2
- old
+ new
@@ -3,26 +3,32 @@
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var DocCommentHighlightRules = function() {
-
this.$rules = {
"start" : [ {
token : "comment.doc.tag",
regex : "@[\\w\\d_]+" // TODO: fix email addresses
- }, {
- token : "comment.doc.tag",
- regex : "\\bTODO\\b"
- }, {
- defaultToken : "comment.doc"
+ },
+ DocCommentHighlightRules.getTagRule(),
+ {
+ defaultToken : "comment.doc",
+ caseInsensitive: true
}]
};
};
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
+DocCommentHighlightRules.getTagRule = function(start) {
+ return {
+ token : "comment.doc.tag.storage.type",
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
+ };
+}
+
DocCommentHighlightRules.getStartRule = function(start) {
return {
token : "comment.doc", // doc comment
regex : "\\/\\*(?=\\*)",
next : start
@@ -87,15 +93,16 @@
"constant.language": builtinConstants
}, "identifier");
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
- this.$rules = {
+ this.$rules = {
"start" : [
{
token : "comment",
- regex : "\\/\\/.*$"
+ regex : "//",
+ next : "singleLineComment"
},
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi line comment
regex : "\\/\\*",
@@ -158,28 +165,39 @@
}, {
token : "comment", // comment spanning whole line
regex : ".+"
}
],
+ "singleLineComment" : [
+ {
+ token : "comment",
+ regex : /\\$/,
+ next : "singleLineComment"
+ }, {
+ token : "comment",
+ regex : /$/,
+ next : "start"
+ }, {
+ defaultToken: "comment"
+ }
+ ],
"qqstring" : [
{
token : "string",
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
next : "start"
}, {
- token : "string",
- regex : '.+'
+ defaultToken : "string"
}
],
"qstring" : [
{
token : "string",
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
next : "start"
}, {
- token : "string",
- regex : '.+'
+ defaultToken : "string"
}
],
"directive" : [
{
token : "constant.other.multiline",
@@ -273,14 +291,14 @@
["text", "paren.rparen", "punctuation.operator"];
var SAFE_INSERT_BEFORE_TOKENS =
["text", "paren.rparen", "punctuation.operator", "comment"];
var context;
-var contextCache = {}
+var contextCache = {};
var initContext = function(editor) {
var id = -1;
if (editor.multiSelect) {
- id = editor.selection.id;
+ id = editor.selection.index;
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
contextCache = {rangeCount: editor.multiSelect.rangeCount};
}
if (contextCache[id])
return context = contextCache[id];