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


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

    目录

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

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

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

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

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

    • 笙默考试管理系统-MyExamTest

    CodeMirror.copyState = copyState;

        function startState(mode, a1, a2) {

            return mode.startState ? mode.startState(a1, a2) : true;

        }

        CodeMirror.startState = startState;

        // The character stream used by a mode's parser.

        function StringStream(string, tabSize) {

            this.pos = this.start = 0;

            this.string = string;

            this.tabSize = tabSize || 8;

        }

        StringStream.prototype = {

            eol: function() {return this.pos >= this.string.length;},

            sol: function() {return this.pos == 0;},

            peek: function() {return this.string.charAt(this.pos);},

            next: function() {

                if (this.pos < this.string.length)

                    return this.string.charAt(this.pos++);

            },

    • 笙默考试管理系统-MyExamTest

            eat: function(match) {

                var ch = this.string.charAt(this.pos);

                if (typeof match == "string") var ok = ch == match;

                else var ok = ch && (match.test ? match.test(ch) : match(ch));

                if (ok) {++this.pos; return ch;}

            },

            eatWhile: function(match) {

                var start = this.pos;

                while (this.eat(match)){}

                return this.pos > start;

            },

            eatSpace: function() {

                var start = this.pos;

                while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;

                return this.pos > start;

            },

    • 笙默考试管理系统-MyExamTest

            skipToEnd: function() {this.pos = this.string.length;},

            skipTo: function(ch) {

                var found = this.string.indexOf(ch, this.pos);

                if (found > -1) {this.pos = found; return true;}

            },

            backUp: function(n) {this.pos -= n;},

            column: function() {return countColumn(this.string, this.start, this.tabSize);},

            indentation: function() {return countColumn(this.string, null, this.tabSize);},

            match: function(pattern, consume, caseInsensitive) {

                if (typeof pattern == "string") {

                    function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}

                    if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {

                        if (consume !== false) this.pos += pattern.length;

                        return true;

                    }

                }

    • 笙默考试管理系统-MyExamTest

                else {

                    var match = this.string.slice(this.pos).match(pattern);

                    if (match && consume !== false) this.pos += match[0].length;

                    return match;

                }

            },

            current: function(){return this.string.slice(this.start, this.pos);}

        };

        CodeMirror.StringStream = StringStream;

        function MarkedText(from, to, className, set) {

            this.from = from; this.to = to; this.style = className; this.set = set;

    }

    • 笙默考试管理系统-MyExamTest

        MarkedText.prototype = {

            attach: function(line) { this.set.push(line); },

            detach: function(line) {

                var ix = indexOf(this.set, line);

                if (ix > -1) this.set.splice(ix, 1);

            },

            split: function(pos, lenBefore) {

                if (this.to <= pos && this.to != null) return null;

                var from = this.from < pos || this.from == null ? null : this.from - pos + lenBefore;

                var to = this.to == null ? null : this.to - pos + lenBefore;

                return new MarkedText(from, to, this.style, this.set);

            },

            dup: function() { return new MarkedText(null, null, this.style, this.set); },

            clipTo: function(fromOpen, from, toOpen, to, diff) {

                if (this.from != null && this.from >= from)

                    this.from = Math.max(to, this.from) + diff;

                if (this.to != null && this.to > from)

                    this.to = to < this.to ? this.to + diff : from;

                if (fromOpen && to > this.from && (to < this.to || this.to == null))

                    this.from = null;

                if (toOpen && (from < this.to || this.to == null) && (from > this.from || this.from == null))

                    this.to = null;

            },

            isDead: function() { return this.from != null && this.to != null && this.from >= this.to; },

            sameSet: function(x) { return this.set == x.set; }

        };

  • 相关阅读:
    荧光标记转铁蛋白-(FITC, cy3, cy5, cy7, 香豆素, 罗丹明)
    猿创征文 |【Ant Design Pro】使用ant design pro做为你的开发模板(三) 接入mock数据做持续开发
    SpringBoot-05-YAML介绍及使用
    如何正确的中断线程?你的姿势是否正确
    爬虫一般采用什么代理IP,Python爬虫代理IP使用方法详解
    微信开发者工具开发小程序代码自动热加载/重载/部署
    麦克纳姆轮x运动学分析
    Dreamweaver网页设计与制作100例——HTML5期末考核大作业——票务网站整套网页
    DHCP和PXE是怎么工作的
    web前端期末大作业 HTML+CSS+JavaScript仿安踏
  • 原文地址:https://blog.csdn.net/N201871643/article/details/133977252