overleaf/services/web/public/js/ace/mode/space_highlight_rules.js
2014-02-12 10:23:40 +00:00

56 lines
1.3 KiB
JavaScript
Executable file

define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var SpaceHighlightRules = function() {
// Todo: support multiline values that escape the newline with spaces.
this.$rules = {
"start" : [
{
token : "empty_line",
regex : / */,
next : "key"
},
{
token : "empty_line",
regex : /$/,
next : "key"
}
],
"key" : [
{
token : "variable",
regex : /\S+/
},
{
token : "empty_line",
regex : /$/,
next : "start"
},{
token : "keyword.operator",
regex : / /,
next : "value"
}
],
"value" : [
{
token : "keyword.operator",
regex : /$/,
next : "start"
},
{
token : "string",
regex : /[^$]/
}
]
};
};
oop.inherits(SpaceHighlightRules, TextHighlightRules);
exports.SpaceHighlightRules = SpaceHighlightRules;
});