1
/* ***** BEGIN LICENSE BLOCK *****
2
* Distributed under the BSD license:
4
* Copyright (c) 2013, Ajax.org B.V.
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.
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.
34
* ***** END LICENSE BLOCK ***** */
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) {
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;
45
var Mode = function() {
46
var highlighter = new TomlHighlightRules();
47
this.foldingRules = new FoldMode();
48
this.$tokenizer = new Tokenizer(highlighter.getRules());
50
oop.inherits(Mode, TextMode);
53
this.lineCommentStart = "#";
54
}).call(Mode.prototype);
59
define('ace/mode/toml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
62
var oop = require("../lib/oop");
63
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
65
var TomlHighlightRules = function() {
66
var keywordMapper = this.createKeywordMapper({
67
"constant.language.boolean": "true|false"
70
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
75
token: "comment.toml",
84
token: ["variable.keygroup.toml"],
85
regex: "(?:^\\s*)(\\[([^\\]]+)\\])"
88
token : keywordMapper,
92
token : "support.date.toml",
93
regex: "\\d{4}-\\d{2}-\\d{2}(T)\\d{2}:\\d{2}:\\d{2}(Z)"
96
token: "constant.numeric.toml",
97
regex: "-?\\d+(\\.?\\d+)?"
107
token : "constant.language.escape",
108
regex : '\\\\[0tnr"\\\\]'
116
defaultToken: "string"
123
oop.inherits(TomlHighlightRules, TextHighlightRules);
125
exports.TomlHighlightRules = TomlHighlightRules;
128
define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
131
var oop = require("../../lib/oop");
132
var Range = require("../../range").Range;
133
var BaseFoldMode = require("./fold_mode").FoldMode;
135
var FoldMode = exports.FoldMode = function(commentRegex) {
137
this.foldingStartMarker = new RegExp(
138
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
140
this.foldingStopMarker = new RegExp(
141
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
145
oop.inherits(FoldMode, BaseFoldMode);
149
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
150
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
152
this.getFoldWidgetRange = function(session, foldStyle, row) {
153
var line = session.getLine(row);
154
var match = line.match(this.foldingStartMarker);
159
return this.openingBracketBlock(session, match[1], row, i);
161
return session.getCommentFoldRange(row, i + match[0].length, 1);
164
if (foldStyle !== "markbeginend")
167
var match = line.match(this.foldingStopMarker);
169
var i = match.index + match[0].length;
172
return this.closingBracketBlock(session, match[1], row, i);
174
return session.getCommentFoldRange(row, i, -1);
178
}).call(FoldMode.prototype);