Edit File by line
/home/barbar84/www/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/mscgen
File: mscgen.js
// CodeMirror, copyright (c) by Marijn Haverbeke and others
[0] Fix | Delete
// Distributed under an MIT license: http://codemirror.net/LICENSE
[1] Fix | Delete
[2] Fix | Delete
// mode(s) for the sequence chart dsl's mscgen, xù and msgenny
[3] Fix | Delete
// For more information on mscgen, see the site of the original author:
[4] Fix | Delete
// http://www.mcternan.me.uk/mscgen
[5] Fix | Delete
//
[6] Fix | Delete
// This mode for mscgen and the two derivative languages were
[7] Fix | Delete
// originally made for use in the mscgen_js interpreter
[8] Fix | Delete
// (https://sverweij.github.io/mscgen_js)
[9] Fix | Delete
[10] Fix | Delete
(function(mod) {
[11] Fix | Delete
if ( typeof exports == "object" && typeof module == "object")// CommonJS
[12] Fix | Delete
mod(require("../../lib/codemirror"));
[13] Fix | Delete
else if ( typeof define == "function" && define.amd)// AMD
[14] Fix | Delete
define(["../../lib/codemirror"], mod);
[15] Fix | Delete
else// Plain browser env
[16] Fix | Delete
mod(CodeMirror);
[17] Fix | Delete
})(function(CodeMirror) {
[18] Fix | Delete
"use strict";
[19] Fix | Delete
[20] Fix | Delete
var languages = {
[21] Fix | Delete
mscgen: {
[22] Fix | Delete
"keywords" : ["msc"],
[23] Fix | Delete
"options" : ["hscale", "width", "arcgradient", "wordwraparcs"],
[24] Fix | Delete
"attributes" : ["label", "idurl", "id", "url", "linecolor", "linecolour", "textcolor", "textcolour", "textbgcolor", "textbgcolour", "arclinecolor", "arclinecolour", "arctextcolor", "arctextcolour", "arctextbgcolor", "arctextbgcolour", "arcskip"],
[25] Fix | Delete
"brackets" : ["\\{", "\\}"], // [ and ] are brackets too, but these get handled in with lists
[26] Fix | Delete
"arcsWords" : ["note", "abox", "rbox", "box"],
[27] Fix | Delete
"arcsOthers" : ["\\|\\|\\|", "\\.\\.\\.", "---", "--", "<->", "==", "<<=>>", "<=>", "\\.\\.", "<<>>", "::", "<:>", "->", "=>>", "=>", ">>", ":>", "<-", "<<=", "<=", "<<", "<:", "x-", "-x"],
[28] Fix | Delete
"singlecomment" : ["//", "#"],
[29] Fix | Delete
"operators" : ["="]
[30] Fix | Delete
},
[31] Fix | Delete
xu: {
[32] Fix | Delete
"keywords" : ["msc"],
[33] Fix | Delete
"options" : ["hscale", "width", "arcgradient", "wordwraparcs", "watermark"],
[34] Fix | Delete
"attributes" : ["label", "idurl", "id", "url", "linecolor", "linecolour", "textcolor", "textcolour", "textbgcolor", "textbgcolour", "arclinecolor", "arclinecolour", "arctextcolor", "arctextcolour", "arctextbgcolor", "arctextbgcolour", "arcskip"],
[35] Fix | Delete
"brackets" : ["\\{", "\\}"], // [ and ] are brackets too, but these get handled in with lists
[36] Fix | Delete
"arcsWords" : ["note", "abox", "rbox", "box", "alt", "else", "opt", "break", "par", "seq", "strict", "neg", "critical", "ignore", "consider", "assert", "loop", "ref", "exc"],
[37] Fix | Delete
"arcsOthers" : ["\\|\\|\\|", "\\.\\.\\.", "---", "--", "<->", "==", "<<=>>", "<=>", "\\.\\.", "<<>>", "::", "<:>", "->", "=>>", "=>", ">>", ":>", "<-", "<<=", "<=", "<<", "<:", "x-", "-x"],
[38] Fix | Delete
"singlecomment" : ["//", "#"],
[39] Fix | Delete
"operators" : ["="]
[40] Fix | Delete
},
[41] Fix | Delete
msgenny: {
[42] Fix | Delete
"keywords" : null,
[43] Fix | Delete
"options" : ["hscale", "width", "arcgradient", "wordwraparcs", "watermark"],
[44] Fix | Delete
"attributes" : null,
[45] Fix | Delete
"brackets" : ["\\{", "\\}"],
[46] Fix | Delete
"arcsWords" : ["note", "abox", "rbox", "box", "alt", "else", "opt", "break", "par", "seq", "strict", "neg", "critical", "ignore", "consider", "assert", "loop", "ref", "exc"],
[47] Fix | Delete
"arcsOthers" : ["\\|\\|\\|", "\\.\\.\\.", "---", "--", "<->", "==", "<<=>>", "<=>", "\\.\\.", "<<>>", "::", "<:>", "->", "=>>", "=>", ">>", ":>", "<-", "<<=", "<=", "<<", "<:", "x-", "-x"],
[48] Fix | Delete
"singlecomment" : ["//", "#"],
[49] Fix | Delete
"operators" : ["="]
[50] Fix | Delete
}
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
CodeMirror.defineMode("mscgen", function(_, modeConfig) {
[54] Fix | Delete
var language = languages[modeConfig && modeConfig.language || "mscgen"]
[55] Fix | Delete
return {
[56] Fix | Delete
startState: startStateFn,
[57] Fix | Delete
copyState: copyStateFn,
[58] Fix | Delete
token: produceTokenFunction(language),
[59] Fix | Delete
lineComment : "#",
[60] Fix | Delete
blockCommentStart : "/*",
[61] Fix | Delete
blockCommentEnd : "*/"
[62] Fix | Delete
};
[63] Fix | Delete
});
[64] Fix | Delete
[65] Fix | Delete
CodeMirror.defineMIME("text/x-mscgen", "mscgen");
[66] Fix | Delete
CodeMirror.defineMIME("text/x-xu", {name: "mscgen", language: "xu"});
[67] Fix | Delete
CodeMirror.defineMIME("text/x-msgenny", {name: "mscgen", language: "msgenny"});
[68] Fix | Delete
[69] Fix | Delete
function wordRegexpBoundary(pWords) {
[70] Fix | Delete
return new RegExp("\\b(" + pWords.join("|") + ")\\b", "i");
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
function wordRegexp(pWords) {
[74] Fix | Delete
return new RegExp("(" + pWords.join("|") + ")", "i");
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
function startStateFn() {
[78] Fix | Delete
return {
[79] Fix | Delete
inComment : false,
[80] Fix | Delete
inString : false,
[81] Fix | Delete
inAttributeList : false,
[82] Fix | Delete
inScript : false
[83] Fix | Delete
};
[84] Fix | Delete
}
[85] Fix | Delete
[86] Fix | Delete
function copyStateFn(pState) {
[87] Fix | Delete
return {
[88] Fix | Delete
inComment : pState.inComment,
[89] Fix | Delete
inString : pState.inString,
[90] Fix | Delete
inAttributeList : pState.inAttributeList,
[91] Fix | Delete
inScript : pState.inScript
[92] Fix | Delete
};
[93] Fix | Delete
}
[94] Fix | Delete
[95] Fix | Delete
function produceTokenFunction(pConfig) {
[96] Fix | Delete
[97] Fix | Delete
return function(pStream, pState) {
[98] Fix | Delete
if (pStream.match(wordRegexp(pConfig.brackets), true, true)) {
[99] Fix | Delete
return "bracket";
[100] Fix | Delete
}
[101] Fix | Delete
/* comments */
[102] Fix | Delete
if (!pState.inComment) {
[103] Fix | Delete
if (pStream.match(/\/\*[^\*\/]*/, true, true)) {
[104] Fix | Delete
pState.inComment = true;
[105] Fix | Delete
return "comment";
[106] Fix | Delete
}
[107] Fix | Delete
if (pStream.match(wordRegexp(pConfig.singlecomment), true, true)) {
[108] Fix | Delete
pStream.skipToEnd();
[109] Fix | Delete
return "comment";
[110] Fix | Delete
}
[111] Fix | Delete
}
[112] Fix | Delete
if (pState.inComment) {
[113] Fix | Delete
if (pStream.match(/[^\*\/]*\*\//, true, true))
[114] Fix | Delete
pState.inComment = false;
[115] Fix | Delete
else
[116] Fix | Delete
pStream.skipToEnd();
[117] Fix | Delete
return "comment";
[118] Fix | Delete
}
[119] Fix | Delete
/* strings */
[120] Fix | Delete
if (!pState.inString && pStream.match(/\"(\\\"|[^\"])*/, true, true)) {
[121] Fix | Delete
pState.inString = true;
[122] Fix | Delete
return "string";
[123] Fix | Delete
}
[124] Fix | Delete
if (pState.inString) {
[125] Fix | Delete
if (pStream.match(/[^\"]*\"/, true, true))
[126] Fix | Delete
pState.inString = false;
[127] Fix | Delete
else
[128] Fix | Delete
pStream.skipToEnd();
[129] Fix | Delete
return "string";
[130] Fix | Delete
}
[131] Fix | Delete
/* keywords & operators */
[132] Fix | Delete
if (!!pConfig.keywords && pStream.match(wordRegexpBoundary(pConfig.keywords), true, true))
[133] Fix | Delete
return "keyword";
[134] Fix | Delete
[135] Fix | Delete
if (pStream.match(wordRegexpBoundary(pConfig.options), true, true))
[136] Fix | Delete
return "keyword";
[137] Fix | Delete
[138] Fix | Delete
if (pStream.match(wordRegexpBoundary(pConfig.arcsWords), true, true))
[139] Fix | Delete
return "keyword";
[140] Fix | Delete
[141] Fix | Delete
if (pStream.match(wordRegexp(pConfig.arcsOthers), true, true))
[142] Fix | Delete
return "keyword";
[143] Fix | Delete
[144] Fix | Delete
if (!!pConfig.operators && pStream.match(wordRegexp(pConfig.operators), true, true))
[145] Fix | Delete
return "operator";
[146] Fix | Delete
[147] Fix | Delete
/* attribute lists */
[148] Fix | Delete
if (!pConfig.inAttributeList && !!pConfig.attributes && pStream.match(/\[/, true, true)) {
[149] Fix | Delete
pConfig.inAttributeList = true;
[150] Fix | Delete
return "bracket";
[151] Fix | Delete
}
[152] Fix | Delete
if (pConfig.inAttributeList) {
[153] Fix | Delete
if (pConfig.attributes !== null && pStream.match(wordRegexpBoundary(pConfig.attributes), true, true)) {
[154] Fix | Delete
return "attribute";
[155] Fix | Delete
}
[156] Fix | Delete
if (pStream.match(/]/, true, true)) {
[157] Fix | Delete
pConfig.inAttributeList = false;
[158] Fix | Delete
return "bracket";
[159] Fix | Delete
}
[160] Fix | Delete
}
[161] Fix | Delete
[162] Fix | Delete
pStream.next();
[163] Fix | Delete
return "base";
[164] Fix | Delete
};
[165] Fix | Delete
}
[166] Fix | Delete
[167] Fix | Delete
});
[168] Fix | Delete
[169] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function