笙默考试管理系统-MyExamTest----codemirror(66)
??
目录
一、 笙默考试管理系统-MyExamTest----codemirror
二、 笙默考试管理系统-MyExamTest----codemirror
三、 笙默考试管理系统-MyExamTest----codemirror
四、 笙默考试管理系统-MyExamTest----codemirror
五、 笙默考试管理系统-MyExamTest----codemirror
??compareStates: function(a, b) {
????????????if (a.indented != b.indented || a.tokenize != b.tokenize) return false;
????????????for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) {
????????????????if (!ca || !cb) return ca == cb;
????????????????if (ca.tagName != cb.tagName) return false;
????????????}
????????},
????????electricChars: "/"
????};
});
CodeMirror.defineMIME("application/xml", "xml");
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
CodeMirror.defineMode("javascript", function(config, parserConfig) {
????var indentUnit = config.indentUnit;
????var jsonMode = parserConfig.json;
????// Tokenizer
????var keywords = function(){
????????function kw(type) {return {type: type, style: "keyword"};}
????????var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
????????var operator = kw("operator"), atom = {type: "atom", style: "atom"};
????????return {
????????????"if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
????????????"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
????????????"var": kw("var"), "const": kw("var"), "let": kw("var"),
????????????"function": kw("function"), "catch": kw("catch"),
????????????"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
????????????"in": operator, "typeof": operator, "instanceof": operator,
????????????"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
????????};
????}();
????var isOperatorChar = /[+\-*&%=<>!?|]/;
????function chain(stream, state, f) {
????????state.tokenize = f;
????????return f(stream, state);
????}
????function nextUntilUnescaped(stream, end) {
????????var escaped = false, next;
????????while ((next = stream.next()) != null) {
????????????if (next == end && !escaped)
????????????????return false;
????????????escaped = !escaped && next == "\\";
????????}
????????return escaped;
????}
????// Used as scratch variables to communicate multiple values without
????// consing up tons of objects.
????var type, content;
????function ret(tp, style, cont) {
????????type = tp; content = cont;
????????return style;
????}
????function jsTokenBase(stream, state) {
????????var ch = stream.next();
????????if (ch == '"' || ch == "'")
????????????return chain(stream, state, jsTokenString(ch));
????????else if (/[\[\]{}\(\),;\:\.]/.test(ch))
????????????return ret(ch);
????????else if (ch == "0" && stream.eat(/x/i)) {
????????????stream.eatWhile(/[\da-f]/i);
????????????return ret("number", "number");
????????}
????????else if (/\d/.test(ch)) {
????????????stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
????????????return ret("number", "number");
????????}
????????else if (ch == "/") {
????????????if (stream.eat("*")) {
????????????????return chain(stream, state, jsTokenComment);
????????????}
????????????else if (stream.eat("/")) {
????????????????stream.skipToEnd();
????????????????return ret("comment", "comment");
????????????}
????????????else if (state.reAllowed) {
????????????????nextUntilUnescaped(stream, "/");
????????????????stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
????????????????return ret("regexp", "string");
????????????}
????????????else {
????????????????stream.eatWhile(isOperatorChar);
????????????????return ret("operator", null, stream.current());
????????????}