/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-toml.js

  • Committer: galaxyAbstractor
  • Date: 2013-04-10 15:58:59 UTC
  • mfrom: (20.1.1 lenasys)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: galaxyabstractor@gmail.com-20130410155859-cih60kaz5es8savt
CodeIgniter implementation of basic CMS system

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ***** BEGIN LICENSE BLOCK *****
 
2
 * Distributed under the BSD license:
 
3
 *
 
4
 * Copyright (c) 2013, Ajax.org B.V.
 
5
 * All rights reserved.
 
6
 *
 
7
 * Redistribution and use in source and binary forms, with or without
 
8
 * modification, are permitted provided that the following conditions are met:
 
9
 *     * Redistributions of source code must retain the above copyright
 
10
 *       notice, this list of conditions and the following disclaimer.
 
11
 *     * Redistributions in binary form must reproduce the above copyright
 
12
 *       notice, this list of conditions and the following disclaimer in the
 
13
 *       documentation and/or other materials provided with the distribution.
 
14
 *     * Neither the name of Ajax.org B.V. nor the
 
15
 *       names of its contributors may be used to endorse or promote products
 
16
 *       derived from this software without specific prior written permission.
 
17
 *
 
18
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 
19
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
20
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
21
 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
 
22
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 
23
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
24
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 
25
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 
27
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
28
 *
 
29
 *
 
30
 * Contributor(s):
 
31
 *
 
32
 * Garen J. Torikian
 
33
 *
 
34
 * ***** END LICENSE BLOCK ***** */
 
35
 
 
36
define('ace/mode/toml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/toml_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
 
37
 
 
38
 
 
39
var oop = require("../lib/oop");
 
40
var TextMode = require("./text").Mode;
 
41
var Tokenizer = require("../tokenizer").Tokenizer;
 
42
var TomlHighlightRules = require("./toml_highlight_rules").TomlHighlightRules;
 
43
var FoldMode = require("./folding/cstyle").FoldMode;
 
44
 
 
45
var Mode = function() {
 
46
    var highlighter = new TomlHighlightRules();
 
47
    this.foldingRules = new FoldMode();
 
48
    this.$tokenizer = new Tokenizer(highlighter.getRules());
 
49
};
 
50
oop.inherits(Mode, TextMode);
 
51
 
 
52
(function() {
 
53
    this.lineCommentStart = "#";
 
54
}).call(Mode.prototype);
 
55
 
 
56
exports.Mode = Mode;
 
57
});
 
58
 
 
59
define('ace/mode/toml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
 
60
 
 
61
 
 
62
var oop = require("../lib/oop");
 
63
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
 
64
 
 
65
var TomlHighlightRules = function() {
 
66
    var keywordMapper = this.createKeywordMapper({
 
67
        "constant.language.boolean": "true|false"
 
68
    }, "identifier");
 
69
 
 
70
    var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
 
71
 
 
72
    this.$rules = {
 
73
    "start": [
 
74
        {
 
75
            token: "comment.toml",
 
76
            regex: /#.*$/
 
77
        },
 
78
        {
 
79
            token : "string",
 
80
            regex : '"(?=.)',
 
81
            next  : "qqstring"
 
82
        },
 
83
        {
 
84
            token: ["variable.keygroup.toml"],
 
85
            regex: "(?:^\\s*)(\\[([^\\]]+)\\])"
 
86
        },
 
87
        {
 
88
            token : keywordMapper,
 
89
            regex : identifierRe
 
90
        },
 
91
        {
 
92
           token : "support.date.toml",
 
93
           regex: "\\d{4}-\\d{2}-\\d{2}(T)\\d{2}:\\d{2}:\\d{2}(Z)"
 
94
        },
 
95
        {
 
96
           token: "constant.numeric.toml",
 
97
           regex: "-?\\d+(\\.?\\d+)?"
 
98
        }
 
99
    ],
 
100
    "qqstring" : [
 
101
        {
 
102
            token : "string",
 
103
            regex : "\\\\$",
 
104
            next  : "qqstring",
 
105
        },
 
106
        {
 
107
            token : "constant.language.escape",
 
108
            regex : '\\\\[0tnr"\\\\]'
 
109
        },
 
110
        {
 
111
            token : "string",
 
112
            regex : '"|$',
 
113
            next  : "start",
 
114
        },
 
115
        {
 
116
            defaultToken: "string"
 
117
        }
 
118
    ]
 
119
    }
 
120
 
 
121
};
 
122
 
 
123
oop.inherits(TomlHighlightRules, TextHighlightRules);
 
124
 
 
125
exports.TomlHighlightRules = TomlHighlightRules;
 
126
});
 
127
 
 
128
define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
 
129
 
 
130
 
 
131
var oop = require("../../lib/oop");
 
132
var Range = require("../../range").Range;
 
133
var BaseFoldMode = require("./fold_mode").FoldMode;
 
134
 
 
135
var FoldMode = exports.FoldMode = function(commentRegex) {
 
136
    if (commentRegex) {
 
137
        this.foldingStartMarker = new RegExp(
 
138
            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
 
139
        );
 
140
        this.foldingStopMarker = new RegExp(
 
141
            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
 
142
        );
 
143
    }
 
144
};
 
145
oop.inherits(FoldMode, BaseFoldMode);
 
146
 
 
147
(function() {
 
148
 
 
149
    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
 
150
    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
 
151
 
 
152
    this.getFoldWidgetRange = function(session, foldStyle, row) {
 
153
        var line = session.getLine(row);
 
154
        var match = line.match(this.foldingStartMarker);
 
155
        if (match) {
 
156
            var i = match.index;
 
157
 
 
158
            if (match[1])
 
159
                return this.openingBracketBlock(session, match[1], row, i);
 
160
 
 
161
            return session.getCommentFoldRange(row, i + match[0].length, 1);
 
162
        }
 
163
 
 
164
        if (foldStyle !== "markbeginend")
 
165
            return;
 
166
 
 
167
        var match = line.match(this.foldingStopMarker);
 
168
        if (match) {
 
169
            var i = match.index + match[0].length;
 
170
 
 
171
            if (match[1])
 
172
                return this.closingBracketBlock(session, match[1], row, i);
 
173
 
 
174
            return session.getCommentFoldRange(row, i, -1);
 
175
        }
 
176
    };
 
177
 
 
178
}).call(FoldMode.prototype);
 
179
 
 
180
});