Merge pull request #1596 from breck7/master

Rebased on latest Ace. Added Coffee Fold Mode
This commit is contained in:
Harutyun Amirjanyan 2013-09-11 12:17:28 -07:00
commit 4c1497fc29
5 changed files with 135 additions and 0 deletions

View file

@ -121,6 +121,7 @@ var supportedModes = {
Scheme: ["scm|rkt"],
SCSS: ["scss"],
SH: ["sh|bash"],
Space: ["space"],
snippets: ["snippets"],
SQL: ["sql"],
Stylus: ["styl|stylus"],

21
lib/ace/mode/space.js Normal file
View file

@ -0,0 +1,21 @@
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
// defines the parent mode
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var FoldMode = require("./folding/coffee").FoldMode;
// defines the language specific highlighters and folding rules
var SpaceHighlightRules = require("./space_highlight_rules").SpaceHighlightRules;
var Mode = function() {
// set everything up
var highlighter = new SpaceHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.foldingRules = new FoldMode();
};
oop.inherits(Mode, TextMode);
(function() {
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,56 @@
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;
});