(function(mod) {
if (typeof exports == "object" && typeof module == "object")
mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../clike/clike"));
else if (typeof define == "function" && define.amd)
define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../clike/clike"], mod);
else
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
function keywords(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
function matchSequence(list, end, escapes) {
if (list.length == 0) return phpString(end);
return function (stream, state) {
var patterns = list[0];
for (var i = 0; i < patterns.length; i++) if (stream.match(patterns[i][0])) {
state.tokenize = matchSequence(list.slice(1), end);
return patterns[i][1];
}
state.tokenize = phpString(end, escapes);
return "string";
};
}
function phpString(closing, escapes) {
return function(stream, state) { return phpString_(stream, state, closing, escapes); };
}
function phpString_(stream, state, closing, escapes) {
if (escapes !== false && stream.match("${", false) || stream.match("{$", false)) {
state.tokenize = null;
return "string";
}
if (escapes !== false && stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) {