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

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

  

目录

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

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

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

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

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

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

    electricChars: ":{}"

    };

});

CodeMirror.defineMIME("text/javascript", "javascript");

CodeMirror.defineMIME("application/json", {name: "javascript", json: true});

CodeMirror.defineMode("css", function(config) {

    var indentUnit = config.indentUnit, type;

    function ret(style, tp) {type = tp; return style;}

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

    function tokenBase(stream, state) {

        var ch = stream.next();

        if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());}

        else if (ch == "/" && stream.eat("*")) {

            state.tokenize = tokenCComment;

            return tokenCComment(stream, state);

        }

        else if (ch == "<" && stream.eat("!")) {

            state.tokenize = tokenSGMLComment;

            return tokenSGMLComment(stream, state);

        }

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

        else if (ch == "=") ret(null, "compare");

        else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");

        else if (ch == "\"" || ch == "'") {

            state.tokenize = tokenString(ch);

            return state.tokenize(stream, state);

        }

        else if (ch == "#") {

            stream.eatWhile(/[\w\\\-]/);

            return ret("atom", "hash");

        }

        else if (ch == "!") {

            stream.match(/^\s*\w*/);

            return ret("keyword", "important");

        }

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

        else if (/\d/.test(ch)) {

            stream.eatWhile(/[\w.%]/);

            return ret("number", "unit");

        }

        else if (/[,.+>*\/]/.test(ch)) {

            return ret(null, "select-op");

        }

        else if (/[;{}:\[\]]/.test(ch)) {

            return ret(null, ch);

        }

        else {

            stream.eatWhile(/[\w\\\-]/);

            return ret("variable", "variable");

        }

    }

    function tokenCComment(stream, state) {

        var maybeEnd = false, ch;

        while ((ch = stream.next()) != null) {

            if (maybeEnd && ch == "/") {

                state.tokenize = tokenBase;

                break;

            }

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

            maybeEnd = (ch == "*");

        }

        return ret("comment", "comment");

    }

    function tokenSGMLComment(stream, state) {

        var dashes = 0, ch;

        while ((ch = stream.next()) != null) {

            if (dashes >= 2 && ch == ">") {

                state.tokenize = tokenBase;

                break;

            }

            dashes = (ch == "-") ? dashes + 1 : 0;

        }

        return ret("comment", "comment");

    }

    function tokenString(quote) {

        return function(stream, state) {

            var escaped = false, ch;

            while ((ch = stream.next()) != null) {

                if (ch == quote && !escaped)

                    break;

                escaped = !escaped && ch == "\\";

            }

            if (!escaped) state.tokenize = tokenBase;

            return ret("string", "string");

        };

    }

你可能感兴趣的:(笙默考试管理系统,哈希算法,算法)