5
if (typeof exports == "object" && typeof module == "object")
6
mod(require("../../lib/codemirror"));
7
else if (typeof define == "function" && define.amd)
8
define(["../../lib/codemirror"], mod);
11
})(function(CodeMirror) {
14
CodeMirror.defineMode("toml", function () {
16
startState: function () {
24
token: function (stream, state) {
26
if (!state.inString && ((stream.peek() == '"') || (stream.peek() == "'"))) {
27
state.stringType = stream.peek();
29
state.inString = true;
31
if (stream.sol() && state.inArray === 0) {
36
while (state.inString && !stream.eol()) {
37
if (stream.peek() === state.stringType) {
39
state.inString = false;
40
} else if (stream.peek() === '\\') {
44
stream.match(/^.[^\\\"\']*/);
47
return state.lhs ? "property string" : "string";
48
} else if (state.inArray && stream.peek() === ']') {
52
} else if (state.lhs && stream.peek() === '[' && stream.skipTo(']')) {
55
if (stream.peek() === ']') stream.next();
57
} else if (stream.peek() === "#") {
60
} else if (stream.eatSpace()) {
62
} else if (state.lhs && stream.eatWhile(function (c) { return c != '=' && c != ' '; })) {
64
} else if (state.lhs && stream.peek() === "=") {
68
} else if (!state.lhs && stream.match(/^\d\d\d\d[\d\-\:\.T]*Z/)) {
70
} else if (!state.lhs && (stream.match('true') || stream.match('false'))) {
72
} else if (!state.lhs && stream.peek() === '[') {
76
} else if (!state.lhs && stream.match(/^\-?\d+(?:\.\d+)?/)) {
78
} else if (!stream.eatSpace()) {
86
CodeMirror.defineMIME('text/x-toml', 'toml');