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

发布时间:2024年01月14日

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

??

目录

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

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

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

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

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

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

?}

????function block(type) {

????????if (type == "}") return cont();

????????return pass(statement, block);

????}

????function vardef1(type, value) {

????????if (type == "variable"){register(value); return cont(vardef2);}

????????return cont();

????}

????function vardef2(type, value) {

????????if (value == "=") return cont(expression, vardef2);

????????if (type == ",") return cont(vardef1);

}

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

????function forspec1(type) {

????????if (type == "var") return cont(vardef1, forspec2);

????????if (type == ";") return pass(forspec2);

????????if (type == "variable") return cont(formaybein);

????????return pass(forspec2);

????}

????function formaybein(type, value) {

????????if (value == "in") return cont(expression);

????????return cont(maybeoperator, forspec2);

????}

????function forspec2(type, value) {

????????if (type == ";") return cont(forspec3);

????????if (value == "in") return cont(expression);

????????return cont(expression, expect(";"), forspec3);

}

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

????function forspec3(type) {

????????if (type != ")") cont(expression);

????}

????function functiondef(type, value) {

????????if (type == "variable") {register(value); return cont(functiondef);}

????????if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);

????}

????function funarg(type, value) {

????????if (type == "variable") {register(value); return cont();}

????}

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

????// Interface

????return {

????????startState: function(basecolumn) {

????????????return {

????????????????tokenize: jsTokenBase,

????????????????reAllowed: true,

????????????????kwAllowed: true,

????????????????cc: [],

????????????????lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),

????????????????localVars: null,

????????????????context: null,

????????????????indented: 0

????????????};

????????},

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

????????token: function(stream, state) {

????????????if (stream.sol()) {

????????????????if (!state.lexical.hasOwnProperty("align"))

????????????????????state.lexical.align = false;

????????????????state.indented = stream.indentation();

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

????????????if (stream.eatSpace()) return null;

????????????var style = state.tokenize(stream, state);

????????????if (type == "comment") return style;

????????????state.reAllowed = type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/);

????????????state.kwAllowed = type != '.';

????????????return parseJS(state, style, type, content, stream);

????????},

????????indent: function(state, textAfter) {

????????????if (state.tokenize != jsTokenBase) return 0;

????????????var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical,

????????????????type = lexical.type, closing = firstChar == type;

????????????if (type == "vardef") return lexical.indented + 4;

????????????else if (type == "form" && firstChar == "{") return lexical.indented;

????????????else if (type == "stat" || type == "form") return lexical.indented + indentUnit;

????????????else if (lexical.info == "switch" && !closing)

????????????????return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);

????????????else if (lexical.align) return lexical.column + (closing ? 0 : 1);

????????????else return lexical.indented + (closing ? 0 : indentUnit);

????????},

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