Rebased on latest Ace. Added Coffee Fold Mode

This commit is contained in:
Breck 2013-09-09 11:46:03 -07:00
commit 0b5d78736f
5 changed files with 156 additions and 0 deletions

View file

@ -125,6 +125,7 @@ var docs = {
"docs/scss.scss": "SCSS",
"docs/sass.sass": "SASS",
"docs/sh.sh": "SH",
"docs/space.space": "Space",
"docs/stylus.styl": "Stylus",
"docs/sql.sql": {name: "SQL", wrapped: true},
"docs/svg.svg": "SVG",

View file

@ -0,0 +1,56 @@
query
count 10
created 2011-06-21T08:10:46Z
lang en-US
results
photo
0
farm 6
id 5855620975
isfamily 0
isfriend 0
ispublic 1
owner 32021554@N04
secret f1f5e8515d
server 5110
title 7087 bandit cat
1
farm 4
id 5856170534
isfamily 0
isfriend 0
ispublic 1
owner 32021554@N04
secret ff1efb2a6f
server 3217
title 6975 rusty cat
2
farm 6
id 5856172972
isfamily 0
isfriend 0
ispublic 1
owner 51249875@N03
secret 6c6887347c
server 5192
title watermarked-cats
3
farm 6
id 5856168328
isfamily 0
isfriend 0
ispublic 1
owner 32021554@N04
secret 0c1cfdf64c
server 5078
title 7020 mandy cat
4
farm 3
id 5856171774
isfamily 0
isfriend 0
ispublic 1
owner 32021554@N04
secret 7f5a3180ab
server 2696
title 7448 bobby cat

View file

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

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

@ -0,0 +1,42 @@
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() {
// todo: code folding, multiline value support.
// Extra logic goes here--we won't be covering all of this
/* These are all optional pieces of code!
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
return indent;
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, input);
};
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
this.createWorker = function(session) {
var worker = new WorkerClient(["ace"], "ace/mode/mynew_worker", "NewWorker");
worker.attachToDocument(session.getDocument());
return worker;
};
*/
}).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;
});