: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
})(function(CodeMirror) {
CodeMirror.defineMode("yaml", function() {
var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];
var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i');
token: function(stream, state) {
if (ch == "#" && (stream.pos == 0 || /\s/.test(stream.string.charAt(stream.pos - 1)))) {
if (stream.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))
if (state.literal && stream.indentation() > state.keyCol) {
stream.skipToEnd(); return "string";
} else if (state.literal) { state.literal = false; }
if(stream.match(/---/)) { return "def"; }
if (stream.match(/\.\.\./)) { return "def"; }
if (stream.match(/\s*-\s+/)) { return 'meta'; }
if (stream.match(/^(\{|\}|\[|\])/)) {
if (state.inlineList > 0 && !esc && ch == ',') {
if (state.inlinePairs > 0 && !esc && ch == ',') {
/* start of value of a pair */
if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; };
if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; }
if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; }
if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; }
if (stream.match(keywordRegex)) { return 'keyword'; }
/* pairs (associative arrays) -> key */
if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)) {
state.keyCol = stream.indentation();
if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; }
/* nothing found, continue */
state.escaped = (ch == '\\');
CodeMirror.defineMIME("text/x-yaml", "yaml");