Created
April 18, 2018 22:15
-
-
Save komali2/b046a23497afbb7aec869fcd1c576f43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function(require, exports) { | |
"use strict"; | |
require('brace'); | |
var oop = acequire("ace/lib/oop"); | |
var DocCommentHighlightRules = acequire("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules; | |
var TextHighlightRules = acequire("ace/mode/text_highlight_rules").TextHighlightRules; | |
var ThingHighlightRules = function(options) { | |
var keywordMapper = this.createKeywordMapper({ | |
"variable.language": | |
"array|blob|getroottable|date|this|time|math|clock|", // Squirrel | |
"constant.language.boolean": "true|false" | |
}, "identifier"); | |
this.$rules = { | |
"no_regex" : [ | |
DocCommentHighlightRules.getStartRule("doc-start"), | |
{ | |
token : ["keyword.operator", "string"], | |
regex : '(@)(")', | |
next : "vstring" | |
}, | |
], | |
// regular expressions are only allowed after certain tokens. This | |
// makes sure we don't mix up regexps with the divison operator | |
"start": [ | |
DocCommentHighlightRules.getStartRule("doc-start"), | |
{ | |
token : "comment", // multi line comment | |
regex : "\\/\\*", | |
next : "comment_regex_allowed" | |
}, | |
], | |
"regex": [ | |
{ | |
// escapes | |
token: "regexp.keyword.operator", | |
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" | |
}, | |
], | |
}; | |
this.embedRules(DocCommentHighlightRules, "doc-", | |
[DocCommentHighlightRules.getEndRule("no_regex")]); | |
this.normalizeRules(); | |
}; | |
oop.inherits(ThingHighlightRules, TextHighlightRules); | |
exports.ThingHighlightRules = ThingHighlightRules; | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment