笙默考试管理系统-MyExamTest----codemirror(64)

发布时间:2024年01月08日

笙默考试管理系统-MyExamTest----codemirror(64

??

目录

一、 笙默考试管理系统-MyExamTest----codemirror

二、 笙默考试管理系统-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;

????????????}

????????},

  • 笙默考试管理系统-MyExamTest----codemirror

????????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;

  • 笙默考试管理系统-MyExamTest----codemirror

????// 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 {

  • 笙默考试管理系统-MyExamTest----codemirror

????????????"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);

????}

  • 笙默考试管理系统-MyExamTest----codemirror

????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");

文章来源:https://blog.csdn.net/N201871643/article/details/135466982
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。