Skip to content

Instantly share code, notes, and snippets.

@komali2
Created April 18, 2018 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komali2/b046a23497afbb7aec869fcd1c576f43 to your computer and use it in GitHub Desktop.
Save komali2/b046a23497afbb7aec869fcd1c576f43 to your computer and use it in GitHub Desktop.
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