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

2024-01-08 20:33:37

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

??

目录

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

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

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

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

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

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

function inText(stream, state) {

????????function chain(parser) {

????????????state.tokenize = parser;

????????????return parser(stream, state);

????????}

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

????????var ch = stream.next();

????????if (ch == "<") {

????????????if (stream.eat("!")) {

????????????????if (stream.eat("[")) {

????????????????????if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));

????????????????????else return null;

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

????????????????else if (stream.match("--")) return chain(inBlock("comment", "-->"));

????????????????else if (stream.match("DOCTYPE", true, true)) {

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

????????????????????return chain(doctype(1));

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

????????????????else return null;

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

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

????????????else if (stream.eat("?")) {

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

????????????????state.tokenize = inBlock("meta", "?>");

????????????????return "meta";

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

????????????else {

????????????????type = stream.eat("/") ? "closeTag" : "openTag";

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

????????????????stream.eatSpace();

????????????????tagName = "";

????????????????var c;

????????????????while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;

????????????????state.tokenize = inTag;

????????????????return "tag";

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

????????}

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

????????else if (ch == "&") {

????????????stream.eatWhile(/[^;]/);

????????????stream.eat(";");

????????????return "atom";

????????}

????????else {

????????????stream.eatWhile(/[^&<]/);

????????????return null;

????????}

????}

????function inTag(stream, state) {

????????var ch = stream.next();

????????if (ch == ">" || (ch == "/" && stream.eat(">"))) {

????????????state.tokenize = inText;

????????????type = ch == ">" ? "endTag" : "selfcloseTag";

????????????return "tag";

????????}

????????else if (ch == "=") {

????????????type = "equals";

????????????return null;

????????}

????????else if (/[\'\"]/.test(ch)) {

????????????state.tokenize = inAttribute(ch);

????????????return state.tokenize(stream, state);

????????}

????????else {

????????????stream.eatWhile(/[^\s\u00a0=<>\"\'\/?]/);

????????????return "word";

????????}

????}

????function inAttribute(quote) {

????????return function(stream, state) {

????????????while (!stream.eol()) {

????????????????if (stream.next() == quote) {

????????????????????state.tokenize = inTag;

????????????????????break;

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

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

????????????return "string";

????????};

????}

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