Path: blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/properties/properties.js
1293 views
CodeMirror.defineMode("properties", function() {1return {2token: function(stream, state) {3var sol = stream.sol() || state.afterSection;4var eol = stream.eol();56state.afterSection = false;78if (sol) {9if (state.nextMultiline) {10state.inMultiline = true;11state.nextMultiline = false;12} else {13state.position = "def";14}15}1617if (eol && ! state.nextMultiline) {18state.inMultiline = false;19state.position = "def";20}2122if (sol) {23while(stream.eatSpace());24}2526var ch = stream.next();2728if (sol && (ch === "#" || ch === "!" || ch === ";")) {29state.position = "comment";30stream.skipToEnd();31return "comment";32} else if (sol && ch === "[") {33state.afterSection = true;34stream.skipTo("]"); stream.eat("]");35return "header";36} else if (ch === "=" || ch === ":") {37state.position = "quote";38return null;39} else if (ch === "\\" && state.position === "quote") {40if (stream.next() !== "u") { // u = Unicode sequence \u123441// Multiline value42state.nextMultiline = true;43}44}4546return state.position;47},4849startState: function() {50return {51position : "def", // Current position, "def", "quote" or "comment"52nextMultiline : false, // Is the next line multiline value53inMultiline : false, // Is the current line a multiline value54afterSection : false // Did we just open a section55};56}5758};59});6061CodeMirror.defineMIME("text/x-properties", "properties");62CodeMirror.defineMIME("text/x-ini", "properties");636465