1 define(function(require
, exports
, module
) {
4 var oop
= require("../lib/oop");
5 // defines the parent mode
6 var TextMode
= require("./text").Mode
;
7 var Tokenizer
= require("../tokenizer").Tokenizer
;
8 var MatchingBraceOutdent
= require("./matching_brace_outdent").MatchingBraceOutdent
;
9 var CstyleBehaviour
= require("./behaviour/cstyle").CstyleBehaviour
;
11 // defines the language specific highlighters and folding rules
12 var NitHighlightRules
= require("./nit_highlight_rules").NitHighlightRules
;
13 //var NitFoldMode = require("./folding/nit").NitFoldMode;
15 var Mode
= function() {
17 this.HighlightRules
= NitHighlightRules
;
18 this.$outdent
= new MatchingBraceOutdent();
19 this.$behaviour
= new CstyleBehaviour();
20 //this.foldingRules = new NitFoldMode();
22 oop
.inherits(Mode
, TextMode
);
25 // configure comment start/end characters
26 this.lineCommentStart
= "#";
27 //this.blockComment = {start: "/*", end: "*/"};
29 // special logic for indent/outdent.
30 // By default ace keeps indentation of previous line
31 this.getNextLineIndent
= function(state
, line
, tab
) {
32 var indent
= this.$
getIndent(line
);
34 var tokenizedLine
= this.getTokenizer().getLineTokens(line
, state
);
35 var tokens
= tokenizedLine
.tokens
;
37 if (tokens
.length
&& tokens
[tokens
.length
-1].type
== "comment") {
41 if (state
== "start") {
42 //var match = line.match(/^.*[\{\(\[]\s*$/);
43 var match
= line
.match(/(^
class|
class |
if |
else |
else|
do$
)/);
50 this.checkOutdent
= function(state
, line
, input
) {
51 return this.$outdent
.checkOutdent(line
, input
);
53 this.autoOutdent
= function(state
, doc
, row
) {
54 this.$outdent
.autoOutdent(doc
, row
);
57 // create worker for live syntax checking
58 this.createWorker
= function(session
) {
59 /*var worker = new WorkerClient(["ace"], "ace/mode/nit_worker", "NitWorker");
60 worker.attachToDocument(session.getDocument());
61 worker.on("errors", function(e) {
62 session.setAnnotations(e.data);
68 this.$id
= "ace/mode/nit";
69 }).call(Mode
.prototype);