commit
fe4a01b1bc
8 changed files with 333 additions and 4 deletions
|
|
@ -123,6 +123,7 @@ var docs = {
|
|||
"docs/tex.tex": "Tex",
|
||||
"docs/textile.textile": {name: "Textile", wrapped: true},
|
||||
"docs/tmSnippet.tmSnippet": "tmSnippet",
|
||||
"docs/toml.toml": "TOML",
|
||||
"docs/typescript.ts": "Typescript",
|
||||
"docs/vbscript.vbs": "VBScript",
|
||||
"docs/xml.xml": "XML",
|
||||
|
|
|
|||
29
demo/kitchen-sink/docs/toml.toml
Normal file
29
demo/kitchen-sink/docs/toml.toml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# This is a TOML document. Boom.
|
||||
|
||||
title = "TOML Example"
|
||||
|
||||
[owner]
|
||||
name = "Tom Preston-Werner"
|
||||
organization = "GitHub"
|
||||
bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
|
||||
dob = 1979-05-27T07:32:00Z # First class dates? Why not?
|
||||
|
||||
[database]
|
||||
server = "192.168.1.1"
|
||||
ports = [ 8001, 8001, 8002 ]
|
||||
connection_max = 5000
|
||||
enabled = true
|
||||
|
||||
[servers]
|
||||
|
||||
# You can indent as you please. Tabs or spaces. TOML don't care.
|
||||
[servers.alpha]
|
||||
ip = "10.0.0.1"
|
||||
dc = "eqdc10"
|
||||
|
||||
[servers.beta]
|
||||
ip = "10.0.0.2"
|
||||
dc = "eqdc10"
|
||||
|
||||
[clients]
|
||||
data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it
|
||||
|
|
@ -95,6 +95,7 @@ var modesByName = {
|
|||
text: ["Text" , "txt"],
|
||||
textile: ["Textile" , "textile"],
|
||||
tm_snippet: ["tmSnippet" , "tmSnippet"],
|
||||
toml: ["toml" , "toml"],
|
||||
typescript: ["Typescript" , "typescript|ts|str"],
|
||||
vbscript: ["VBScript" , "vbs"],
|
||||
xml: ["XML" , "xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
if (typeof document == "undefined")
|
||||
return;
|
||||
|
||||
var XHTML_NS = "http://www.w3.org/1999/xhtml";
|
||||
|
||||
exports.getDocumentHead = function(doc) {
|
||||
|
|
|
|||
131
lib/ace/mode/_test/tokens_toml.json
Normal file
131
lib/ace/mode/_test/tokens_toml.json
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
[[
|
||||
"start",
|
||||
["comment.toml","# This is a TOML document. Boom."]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["identifier","title"],
|
||||
["text"," = "],
|
||||
["string","\"TOML Example\""]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["variable.keygroup.toml","[owner]"]
|
||||
],[
|
||||
"start",
|
||||
["identifier","name"],
|
||||
["text"," = "],
|
||||
["string","\"Tom Preston-Werner\""]
|
||||
],[
|
||||
"start",
|
||||
["identifier","organization"],
|
||||
["text"," = "],
|
||||
["string","\"GitHub\""]
|
||||
],[
|
||||
"start",
|
||||
["identifier","bio"],
|
||||
["text"," = "],
|
||||
["string","\"GitHub Cofounder & CEO"],
|
||||
["constant.language.escape","\\n"],
|
||||
["string","Likes tater tots and beer.\""]
|
||||
],[
|
||||
"start",
|
||||
["identifier","dob"],
|
||||
["text"," = "],
|
||||
["support.date.toml","1979-05-27T07:32:00Z"],
|
||||
["text"," "],
|
||||
["comment.toml","# First class dates? Why not?"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["variable.keygroup.toml","[database]"]
|
||||
],[
|
||||
"start",
|
||||
["identifier","server"],
|
||||
["text"," = "],
|
||||
["string","\"192.168.1.1\""]
|
||||
],[
|
||||
"start",
|
||||
["identifier","ports"],
|
||||
["text"," = [ "],
|
||||
["constant.numeric.toml","8001"],
|
||||
["text",", "],
|
||||
["constant.numeric.toml","8001"],
|
||||
["text",", "],
|
||||
["constant.numeric.toml","8002"],
|
||||
["text"," ]"]
|
||||
],[
|
||||
"start",
|
||||
["identifier","connection_max"],
|
||||
["text"," = "],
|
||||
["constant.numeric.toml","5000"]
|
||||
],[
|
||||
"start",
|
||||
["identifier","enabled"],
|
||||
["text"," = "],
|
||||
["constant.language.boolean","true"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["variable.keygroup.toml","[servers]"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["comment.toml","# You can indent as you please. Tabs or spaces. TOML don't care."]
|
||||
],[
|
||||
"start",
|
||||
["variable.keygroup.toml"," [servers.alpha]"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["identifier","ip"],
|
||||
["text"," = "],
|
||||
["string","\"10.0.0.1\""]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["identifier","dc"],
|
||||
["text"," = "],
|
||||
["string","\"eqdc10\""]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["variable.keygroup.toml"," [servers.beta]"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["identifier","ip"],
|
||||
["text"," = "],
|
||||
["string","\"10.0.0.2\""]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["identifier","dc"],
|
||||
["text"," = "],
|
||||
["string","\"eqdc10\""]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["variable.keygroup.toml","[clients]"]
|
||||
],[
|
||||
"start",
|
||||
["identifier","data"],
|
||||
["text"," = [ ["],
|
||||
["string","\"gamma\""],
|
||||
["text",", "],
|
||||
["string","\"delta\""],
|
||||
["text","], ["],
|
||||
["constant.numeric.toml","1"],
|
||||
["text",", "],
|
||||
["constant.numeric.toml","2"],
|
||||
["text","] ] "],
|
||||
["comment.toml","# just an update to make sure parsers support it"]
|
||||
]]
|
||||
59
lib/ace/mode/toml.js
Normal file
59
lib/ace/mode/toml.js
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2013, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Garen J. Torikian
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var TomlHighlightRules = require("./toml_highlight_rules").TomlHighlightRules;
|
||||
// TODO: pick appropriate fold mode
|
||||
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
var highlighter = new TomlHighlightRules();
|
||||
this.foldingRules = new FoldMode();
|
||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.lineCommentStart = "#";
|
||||
// Extra logic goes here.
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
103
lib/ace/mode/toml_highlight_rules.js
Normal file
103
lib/ace/mode/toml_highlight_rules.js
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2013, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Garen J. Torikian
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var TomlHighlightRules = function() {
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"constant.language.boolean": "true|false"
|
||||
}, "identifier");
|
||||
|
||||
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
|
||||
|
||||
this.$rules = {
|
||||
"start": [
|
||||
{
|
||||
token: "comment.toml",
|
||||
regex: /#.*$/
|
||||
},
|
||||
{
|
||||
token : "string",
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
},
|
||||
{
|
||||
token: ["variable.keygroup.toml"],
|
||||
regex: "(?:^\\s*)(\\[([^\\]]+)\\])"
|
||||
},
|
||||
{
|
||||
token : keywordMapper,
|
||||
regex : identifierRe
|
||||
},
|
||||
{
|
||||
token : "support.date.toml",
|
||||
regex: "\\d{4}-\\d{2}-\\d{2}(T)\\d{2}:\\d{2}:\\d{2}(Z)"
|
||||
},
|
||||
{
|
||||
token: "constant.numeric.toml",
|
||||
regex: "-?\\d+(\\.?\\d+)?"
|
||||
}
|
||||
],
|
||||
"qqstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
},
|
||||
{
|
||||
token : "constant.language.escape",
|
||||
regex : '\\\\[0tnr"\\\\]'
|
||||
},
|
||||
{
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
},
|
||||
{
|
||||
defaultToken: "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
oop.inherits(TomlHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.TomlHighlightRules = TomlHighlightRules;
|
||||
});
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (c) 2012, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
|
@ -55,7 +55,9 @@ var Mode = function() {
|
|||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
// Extra logic goes here.
|
||||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
// Extra logic goes here.
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue