/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codeigniter/js/ace/mode-haxe.js

  • Committer: Gustav Hatvigsson
  • Date: 2013-05-30 12:02:31 UTC
  • mfrom: (85.1.28 lenasys)
  • Revision ID: gustav.hartvigsson@gmail.com-20130530120231-ttqgqjqw2w8enn7g
Merged Ohlsons changes:
added function to get ssn and name for the registrationspages in the user model.
added the registrationpage for students.
edited the registration page for instructors
edited the css for both the registrationpages
minor fix to registration css

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
define('ace/mode/haxe', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/haxe_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
 
2
 
 
3
 
 
4
var oop = require("../lib/oop");
 
5
var TextMode = require("./text").Mode;
 
6
var Tokenizer = require("../tokenizer").Tokenizer;
 
7
var HaxeHighlightRules = require("./haxe_highlight_rules").HaxeHighlightRules;
 
8
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
 
9
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
 
10
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
 
11
 
 
12
var Mode = function() {
 
13
    this.$tokenizer = new Tokenizer(new HaxeHighlightRules().getRules());
 
14
    this.$outdent = new MatchingBraceOutdent();
 
15
    this.$behaviour = new CstyleBehaviour();
 
16
    this.foldingRules = new CStyleFoldMode();
 
17
};
 
18
oop.inherits(Mode, TextMode);
 
19
 
 
20
(function() {
 
21
    this.lineCommentStart = "//";
 
22
    this.blockComment = {start: "/*", end: "*/"};
 
23
    
 
24
    this.getNextLineIndent = function(state, line, tab) {
 
25
        var indent = this.$getIndent(line);
 
26
 
 
27
        var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
 
28
        var tokens = tokenizedLine.tokens;
 
29
 
 
30
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
 
31
            return indent;
 
32
        }
 
33
 
 
34
        if (state == "start") {
 
35
            var match = line.match(/^.*[\{\(\[]\s*$/);
 
36
            if (match) {
 
37
                indent += tab;
 
38
            }
 
39
        }
 
40
 
 
41
        return indent;
 
42
    };
 
43
 
 
44
    this.checkOutdent = function(state, line, input) {
 
45
        return this.$outdent.checkOutdent(line, input);
 
46
    };
 
47
 
 
48
    this.autoOutdent = function(state, doc, row) {
 
49
        this.$outdent.autoOutdent(doc, row);
 
50
    };
 
51
 
 
52
}).call(Mode.prototype);
 
53
 
 
54
exports.Mode = Mode;
 
55
});
 
56
define('ace/mode/haxe_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
 
57
 
 
58
 
 
59
var oop = require("../lib/oop");
 
60
 
 
61
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
 
62
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
 
63
 
 
64
var HaxeHighlightRules = function() {
 
65
 
 
66
    var keywords = (
 
67
        "break|case|cast|catch|class|continue|default|else|enum|extends|for|function|if|implements|import|in|inline|interface|new|override|package|private|public|return|static|super|switch|this|throw|trace|try|typedef|untyped|var|while|Array|Void|Bool|Int|UInt|Float|Dynamic|String|List|Hash|IntHash|Error|Unknown|Type|Std"
 
68
    );
 
69
 
 
70
    var buildinConstants = (
 
71
        "null|true|false"
 
72
    );
 
73
 
 
74
    var keywordMapper = this.createKeywordMapper({
 
75
        "variable.language": "this",
 
76
        "keyword": keywords,
 
77
        "constant.language": buildinConstants
 
78
    }, "identifier");
 
79
 
 
80
    this.$rules = {
 
81
        "start" : [
 
82
            {
 
83
                token : "comment",
 
84
                regex : "\\/\\/.*$"
 
85
            },
 
86
            DocCommentHighlightRules.getStartRule("doc-start"),
 
87
            {
 
88
                token : "comment", // multi line comment
 
89
                regex : "\\/\\*",
 
90
                next : "comment"
 
91
            }, {
 
92
                token : "string.regexp",
 
93
                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
 
94
            }, {
 
95
                token : "string", // single line
 
96
                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
 
97
            }, {
 
98
                token : "string", // single line
 
99
                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
 
100
            }, {
 
101
                token : "constant.numeric", // hex
 
102
                regex : "0[xX][0-9a-fA-F]+\\b"
 
103
            }, {
 
104
                token : "constant.numeric", // float
 
105
                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
 
106
            }, {
 
107
                token : "constant.language.boolean",
 
108
                regex : "(?:true|false)\\b"
 
109
            }, {
 
110
                token : keywordMapper,
 
111
                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
 
112
            }, {
 
113
                token : "keyword.operator",
 
114
                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
 
115
            }, {
 
116
                token : "punctuation.operator",
 
117
                regex : "\\?|\\:|\\,|\\;|\\."
 
118
            }, {
 
119
                token : "paren.lparen",
 
120
                regex : "[[({<]"
 
121
            }, {
 
122
                token : "paren.rparen",
 
123
                regex : "[\\])}>]"
 
124
            }, {
 
125
                token : "text",
 
126
                regex : "\\s+"
 
127
            }
 
128
        ],
 
129
        "comment" : [
 
130
            {
 
131
                token : "comment", // closing comment
 
132
                regex : ".*?\\*\\/",
 
133
                next : "start"
 
134
            }, {
 
135
                token : "comment", // comment spanning whole line
 
136
                regex : ".+"
 
137
            }
 
138
        ]
 
139
    };
 
140
 
 
141
    this.embedRules(DocCommentHighlightRules, "doc-",
 
142
        [ DocCommentHighlightRules.getEndRule("start") ]);
 
143
};
 
144
 
 
145
oop.inherits(HaxeHighlightRules, TextHighlightRules);
 
146
 
 
147
exports.HaxeHighlightRules = HaxeHighlightRules;
 
148
});
 
149
 
 
150
define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
 
151
 
 
152
 
 
153
var oop = require("../lib/oop");
 
154
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
 
155
 
 
156
var DocCommentHighlightRules = function() {
 
157
 
 
158
    this.$rules = {
 
159
        "start" : [ {
 
160
            token : "comment.doc.tag",
 
161
            regex : "@[\\w\\d_]+" // TODO: fix email addresses
 
162
        }, {
 
163
            token : "comment.doc.tag",
 
164
            regex : "\\bTODO\\b"
 
165
        }, {
 
166
            defaultToken : "comment.doc"
 
167
        }]
 
168
    };
 
169
};
 
170
 
 
171
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
 
172
 
 
173
DocCommentHighlightRules.getStartRule = function(start) {
 
174
    return {
 
175
        token : "comment.doc", // doc comment
 
176
        regex : "\\/\\*(?=\\*)",
 
177
        next  : start
 
178
    };
 
179
};
 
180
 
 
181
DocCommentHighlightRules.getEndRule = function (start) {
 
182
    return {
 
183
        token : "comment.doc", // closing comment
 
184
        regex : "\\*\\/",
 
185
        next  : start
 
186
    };
 
187
};
 
188
 
 
189
 
 
190
exports.DocCommentHighlightRules = DocCommentHighlightRules;
 
191
 
 
192
});
 
193
 
 
194
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
 
195
 
 
196
 
 
197
var Range = require("../range").Range;
 
198
 
 
199
var MatchingBraceOutdent = function() {};
 
200
 
 
201
(function() {
 
202
 
 
203
    this.checkOutdent = function(line, input) {
 
204
        if (! /^\s+$/.test(line))
 
205
            return false;
 
206
 
 
207
        return /^\s*\}/.test(input);
 
208
    };
 
209
 
 
210
    this.autoOutdent = function(doc, row) {
 
211
        var line = doc.getLine(row);
 
212
        var match = line.match(/^(\s*\})/);
 
213
 
 
214
        if (!match) return 0;
 
215
 
 
216
        var column = match[1].length;
 
217
        var openBracePos = doc.findMatchingBracket({row: row, column: column});
 
218
 
 
219
        if (!openBracePos || openBracePos.row == row) return 0;
 
220
 
 
221
        var indent = this.$getIndent(doc.getLine(openBracePos.row));
 
222
        doc.replace(new Range(row, 0, row, column-1), indent);
 
223
    };
 
224
 
 
225
    this.$getIndent = function(line) {
 
226
        return line.match(/^\s*/)[0];
 
227
    };
 
228
 
 
229
}).call(MatchingBraceOutdent.prototype);
 
230
 
 
231
exports.MatchingBraceOutdent = MatchingBraceOutdent;
 
232
});
 
233
 
 
234
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
 
235
 
 
236
 
 
237
var oop = require("../../lib/oop");
 
238
var Behaviour = require("../behaviour").Behaviour;
 
239
var TokenIterator = require("../../token_iterator").TokenIterator;
 
240
var lang = require("../../lib/lang");
 
241
 
 
242
var SAFE_INSERT_IN_TOKENS =
 
243
    ["text", "paren.rparen", "punctuation.operator"];
 
244
var SAFE_INSERT_BEFORE_TOKENS =
 
245
    ["text", "paren.rparen", "punctuation.operator", "comment"];
 
246
 
 
247
 
 
248
var autoInsertedBrackets = 0;
 
249
var autoInsertedRow = -1;
 
250
var autoInsertedLineEnd = "";
 
251
var maybeInsertedBrackets = 0;
 
252
var maybeInsertedRow = -1;
 
253
var maybeInsertedLineStart = "";
 
254
var maybeInsertedLineEnd = "";
 
255
 
 
256
var CstyleBehaviour = function () {
 
257
    
 
258
    CstyleBehaviour.isSaneInsertion = function(editor, session) {
 
259
        var cursor = editor.getCursorPosition();
 
260
        var iterator = new TokenIterator(session, cursor.row, cursor.column);
 
261
        if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
 
262
            var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
 
263
            if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
 
264
                return false;
 
265
        }
 
266
        iterator.stepForward();
 
267
        return iterator.getCurrentTokenRow() !== cursor.row ||
 
268
            this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
 
269
    };
 
270
    
 
271
    CstyleBehaviour.$matchTokenType = function(token, types) {
 
272
        return types.indexOf(token.type || token) > -1;
 
273
    };
 
274
    
 
275
    CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
 
276
        var cursor = editor.getCursorPosition();
 
277
        var line = session.doc.getLine(cursor.row);
 
278
        if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
 
279
            autoInsertedBrackets = 0;
 
280
        autoInsertedRow = cursor.row;
 
281
        autoInsertedLineEnd = bracket + line.substr(cursor.column);
 
282
        autoInsertedBrackets++;
 
283
    };
 
284
    
 
285
    CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
 
286
        var cursor = editor.getCursorPosition();
 
287
        var line = session.doc.getLine(cursor.row);
 
288
        if (!this.isMaybeInsertedClosing(cursor, line))
 
289
            maybeInsertedBrackets = 0;
 
290
        maybeInsertedRow = cursor.row;
 
291
        maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
 
292
        maybeInsertedLineEnd = line.substr(cursor.column);
 
293
        maybeInsertedBrackets++;
 
294
    };
 
295
    
 
296
    CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
 
297
        return autoInsertedBrackets > 0 &&
 
298
            cursor.row === autoInsertedRow &&
 
299
            bracket === autoInsertedLineEnd[0] &&
 
300
            line.substr(cursor.column) === autoInsertedLineEnd;
 
301
    };
 
302
    
 
303
    CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
 
304
        return maybeInsertedBrackets > 0 &&
 
305
            cursor.row === maybeInsertedRow &&
 
306
            line.substr(cursor.column) === maybeInsertedLineEnd &&
 
307
            line.substr(0, cursor.column) == maybeInsertedLineStart;
 
308
    };
 
309
    
 
310
    CstyleBehaviour.popAutoInsertedClosing = function() {
 
311
        autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
 
312
        autoInsertedBrackets--;
 
313
    };
 
314
    
 
315
    CstyleBehaviour.clearMaybeInsertedClosing = function() {
 
316
        maybeInsertedBrackets = 0;
 
317
        maybeInsertedRow = -1;
 
318
    };
 
319
 
 
320
    this.add("braces", "insertion", function (state, action, editor, session, text) {
 
321
        var cursor = editor.getCursorPosition();
 
322
        var line = session.doc.getLine(cursor.row);
 
323
        if (text == '{') {
 
324
            var selection = editor.getSelectionRange();
 
325
            var selected = session.doc.getTextRange(selection);
 
326
            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
 
327
                return {
 
328
                    text: '{' + selected + '}',
 
329
                    selection: false
 
330
                };
 
331
            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
 
332
                if (/[\]\}\)]/.test(line[cursor.column])) {
 
333
                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
 
334
                    return {
 
335
                        text: '{}',
 
336
                        selection: [1, 1]
 
337
                    };
 
338
                } else {
 
339
                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
 
340
                    return {
 
341
                        text: '{',
 
342
                        selection: [1, 1]
 
343
                    };
 
344
                }
 
345
            }
 
346
        } else if (text == '}') {
 
347
            var rightChar = line.substring(cursor.column, cursor.column + 1);
 
348
            if (rightChar == '}') {
 
349
                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
 
350
                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
 
351
                    CstyleBehaviour.popAutoInsertedClosing();
 
352
                    return {
 
353
                        text: '',
 
354
                        selection: [1, 1]
 
355
                    };
 
356
                }
 
357
            }
 
358
        } else if (text == "\n" || text == "\r\n") {
 
359
            var closing = "";
 
360
            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
 
361
                closing = lang.stringRepeat("}", maybeInsertedBrackets);
 
362
                CstyleBehaviour.clearMaybeInsertedClosing();
 
363
            }
 
364
            var rightChar = line.substring(cursor.column, cursor.column + 1);
 
365
            if (rightChar == '}' || closing !== "") {
 
366
                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
 
367
                if (!openBracePos)
 
368
                     return null;
 
369
 
 
370
                var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
 
371
                var next_indent = this.$getIndent(line);
 
372
 
 
373
                return {
 
374
                    text: '\n' + indent + '\n' + next_indent + closing,
 
375
                    selection: [1, indent.length, 1, indent.length]
 
376
                };
 
377
            }
 
378
        }
 
379
    });
 
380
 
 
381
    this.add("braces", "deletion", function (state, action, editor, session, range) {
 
382
        var selected = session.doc.getTextRange(range);
 
383
        if (!range.isMultiLine() && selected == '{') {
 
384
            var line = session.doc.getLine(range.start.row);
 
385
            var rightChar = line.substring(range.end.column, range.end.column + 1);
 
386
            if (rightChar == '}') {
 
387
                range.end.column++;
 
388
                return range;
 
389
            } else {
 
390
                maybeInsertedBrackets--;
 
391
            }
 
392
        }
 
393
    });
 
394
 
 
395
    this.add("parens", "insertion", function (state, action, editor, session, text) {
 
396
        if (text == '(') {
 
397
            var selection = editor.getSelectionRange();
 
398
            var selected = session.doc.getTextRange(selection);
 
399
            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
 
400
                return {
 
401
                    text: '(' + selected + ')',
 
402
                    selection: false
 
403
                };
 
404
            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
 
405
                CstyleBehaviour.recordAutoInsert(editor, session, ")");
 
406
                return {
 
407
                    text: '()',
 
408
                    selection: [1, 1]
 
409
                };
 
410
            }
 
411
        } else if (text == ')') {
 
412
            var cursor = editor.getCursorPosition();
 
413
            var line = session.doc.getLine(cursor.row);
 
414
            var rightChar = line.substring(cursor.column, cursor.column + 1);
 
415
            if (rightChar == ')') {
 
416
                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
 
417
                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
 
418
                    CstyleBehaviour.popAutoInsertedClosing();
 
419
                    return {
 
420
                        text: '',
 
421
                        selection: [1, 1]
 
422
                    };
 
423
                }
 
424
            }
 
425
        }
 
426
    });
 
427
 
 
428
    this.add("parens", "deletion", function (state, action, editor, session, range) {
 
429
        var selected = session.doc.getTextRange(range);
 
430
        if (!range.isMultiLine() && selected == '(') {
 
431
            var line = session.doc.getLine(range.start.row);
 
432
            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
 
433
            if (rightChar == ')') {
 
434
                range.end.column++;
 
435
                return range;
 
436
            }
 
437
        }
 
438
    });
 
439
 
 
440
    this.add("brackets", "insertion", function (state, action, editor, session, text) {
 
441
        if (text == '[') {
 
442
            var selection = editor.getSelectionRange();
 
443
            var selected = session.doc.getTextRange(selection);
 
444
            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
 
445
                return {
 
446
                    text: '[' + selected + ']',
 
447
                    selection: false
 
448
                };
 
449
            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
 
450
                CstyleBehaviour.recordAutoInsert(editor, session, "]");
 
451
                return {
 
452
                    text: '[]',
 
453
                    selection: [1, 1]
 
454
                };
 
455
            }
 
456
        } else if (text == ']') {
 
457
            var cursor = editor.getCursorPosition();
 
458
            var line = session.doc.getLine(cursor.row);
 
459
            var rightChar = line.substring(cursor.column, cursor.column + 1);
 
460
            if (rightChar == ']') {
 
461
                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
 
462
                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
 
463
                    CstyleBehaviour.popAutoInsertedClosing();
 
464
                    return {
 
465
                        text: '',
 
466
                        selection: [1, 1]
 
467
                    };
 
468
                }
 
469
            }
 
470
        }
 
471
    });
 
472
 
 
473
    this.add("brackets", "deletion", function (state, action, editor, session, range) {
 
474
        var selected = session.doc.getTextRange(range);
 
475
        if (!range.isMultiLine() && selected == '[') {
 
476
            var line = session.doc.getLine(range.start.row);
 
477
            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
 
478
            if (rightChar == ']') {
 
479
                range.end.column++;
 
480
                return range;
 
481
            }
 
482
        }
 
483
    });
 
484
 
 
485
    this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
 
486
        if (text == '"' || text == "'") {
 
487
            var quote = text;
 
488
            var selection = editor.getSelectionRange();
 
489
            var selected = session.doc.getTextRange(selection);
 
490
            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
 
491
                return {
 
492
                    text: quote + selected + quote,
 
493
                    selection: false
 
494
                };
 
495
            } else {
 
496
                var cursor = editor.getCursorPosition();
 
497
                var line = session.doc.getLine(cursor.row);
 
498
                var leftChar = line.substring(cursor.column-1, cursor.column);
 
499
                if (leftChar == '\\') {
 
500
                    return null;
 
501
                }
 
502
                var tokens = session.getTokens(selection.start.row);
 
503
                var col = 0, token;
 
504
                var quotepos = -1; // Track whether we're inside an open quote.
 
505
 
 
506
                for (var x = 0; x < tokens.length; x++) {
 
507
                    token = tokens[x];
 
508
                    if (token.type == "string") {
 
509
                      quotepos = -1;
 
510
                    } else if (quotepos < 0) {
 
511
                      quotepos = token.value.indexOf(quote);
 
512
                    }
 
513
                    if ((token.value.length + col) > selection.start.column) {
 
514
                        break;
 
515
                    }
 
516
                    col += tokens[x].value.length;
 
517
                }
 
518
                if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
 
519
                    if (!CstyleBehaviour.isSaneInsertion(editor, session))
 
520
                        return;
 
521
                    return {
 
522
                        text: quote + quote,
 
523
                        selection: [1,1]
 
524
                    };
 
525
                } else if (token && token.type === "string") {
 
526
                    var rightChar = line.substring(cursor.column, cursor.column + 1);
 
527
                    if (rightChar == quote) {
 
528
                        return {
 
529
                            text: '',
 
530
                            selection: [1, 1]
 
531
                        };
 
532
                    }
 
533
                }
 
534
            }
 
535
        }
 
536
    });
 
537
 
 
538
    this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
 
539
        var selected = session.doc.getTextRange(range);
 
540
        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
 
541
            var line = session.doc.getLine(range.start.row);
 
542
            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
 
543
            if (rightChar == selected) {
 
544
                range.end.column++;
 
545
                return range;
 
546
            }
 
547
        }
 
548
    });
 
549
 
 
550
};
 
551
 
 
552
oop.inherits(CstyleBehaviour, Behaviour);
 
553
 
 
554
exports.CstyleBehaviour = CstyleBehaviour;
 
555
});
 
556
 
 
557
define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
 
558
 
 
559
 
 
560
var oop = require("../../lib/oop");
 
561
var Range = require("../../range").Range;
 
562
var BaseFoldMode = require("./fold_mode").FoldMode;
 
563
 
 
564
var FoldMode = exports.FoldMode = function(commentRegex) {
 
565
    if (commentRegex) {
 
566
        this.foldingStartMarker = new RegExp(
 
567
            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
 
568
        );
 
569
        this.foldingStopMarker = new RegExp(
 
570
            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
 
571
        );
 
572
    }
 
573
};
 
574
oop.inherits(FoldMode, BaseFoldMode);
 
575
 
 
576
(function() {
 
577
 
 
578
    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
 
579
    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
 
580
 
 
581
    this.getFoldWidgetRange = function(session, foldStyle, row) {
 
582
        var line = session.getLine(row);
 
583
        var match = line.match(this.foldingStartMarker);
 
584
        if (match) {
 
585
            var i = match.index;
 
586
 
 
587
            if (match[1])
 
588
                return this.openingBracketBlock(session, match[1], row, i);
 
589
 
 
590
            return session.getCommentFoldRange(row, i + match[0].length, 1);
 
591
        }
 
592
 
 
593
        if (foldStyle !== "markbeginend")
 
594
            return;
 
595
 
 
596
        var match = line.match(this.foldingStopMarker);
 
597
        if (match) {
 
598
            var i = match.index + match[0].length;
 
599
 
 
600
            if (match[1])
 
601
                return this.closingBracketBlock(session, match[1], row, i);
 
602
 
 
603
            return session.getCommentFoldRange(row, i, -1);
 
604
        }
 
605
    };
 
606
 
 
607
}).call(FoldMode.prototype);
 
608
 
 
609
});