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

        };

    }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

N201871643

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值