Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/ttcn
File: ttcn.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
(function(mod) {
[3] Fix | Delete
if (typeof exports == "object" && typeof module == "object") // CommonJS
[4] Fix | Delete
mod(require("../../lib/codemirror"));
[5] Fix | Delete
else if (typeof define == "function" && define.amd) // AMD
[6] Fix | Delete
define(["../../lib/codemirror"], mod);
[7] Fix | Delete
else // Plain browser env
[8] Fix | Delete
mod(CodeMirror);
[9] Fix | Delete
})(function(CodeMirror) {
[10] Fix | Delete
"use strict";
[11] Fix | Delete
[12] Fix | Delete
CodeMirror.defineMode("ttcn", function(config, parserConfig) {
[13] Fix | Delete
var indentUnit = config.indentUnit,
[14] Fix | Delete
keywords = parserConfig.keywords || {},
[15] Fix | Delete
builtin = parserConfig.builtin || {},
[16] Fix | Delete
timerOps = parserConfig.timerOps || {},
[17] Fix | Delete
portOps = parserConfig.portOps || {},
[18] Fix | Delete
configOps = parserConfig.configOps || {},
[19] Fix | Delete
verdictOps = parserConfig.verdictOps || {},
[20] Fix | Delete
sutOps = parserConfig.sutOps || {},
[21] Fix | Delete
functionOps = parserConfig.functionOps || {},
[22] Fix | Delete
[23] Fix | Delete
verdictConsts = parserConfig.verdictConsts || {},
[24] Fix | Delete
booleanConsts = parserConfig.booleanConsts || {},
[25] Fix | Delete
otherConsts = parserConfig.otherConsts || {},
[26] Fix | Delete
[27] Fix | Delete
types = parserConfig.types || {},
[28] Fix | Delete
visibilityModifiers = parserConfig.visibilityModifiers || {},
[29] Fix | Delete
templateMatch = parserConfig.templateMatch || {},
[30] Fix | Delete
multiLineStrings = parserConfig.multiLineStrings,
[31] Fix | Delete
indentStatements = parserConfig.indentStatements !== false;
[32] Fix | Delete
var isOperatorChar = /[+\-*&@=<>!\/]/;
[33] Fix | Delete
var curPunc;
[34] Fix | Delete
[35] Fix | Delete
function tokenBase(stream, state) {
[36] Fix | Delete
var ch = stream.next();
[37] Fix | Delete
[38] Fix | Delete
if (ch == '"' || ch == "'") {
[39] Fix | Delete
state.tokenize = tokenString(ch);
[40] Fix | Delete
return state.tokenize(stream, state);
[41] Fix | Delete
}
[42] Fix | Delete
if (/[\[\]{}\(\),;\\:\?\.]/.test(ch)) {
[43] Fix | Delete
curPunc = ch;
[44] Fix | Delete
return "punctuation";
[45] Fix | Delete
}
[46] Fix | Delete
if (ch == "#"){
[47] Fix | Delete
stream.skipToEnd();
[48] Fix | Delete
return "atom preprocessor";
[49] Fix | Delete
}
[50] Fix | Delete
if (ch == "%"){
[51] Fix | Delete
stream.eatWhile(/\b/);
[52] Fix | Delete
return "atom ttcn3Macros";
[53] Fix | Delete
}
[54] Fix | Delete
if (/\d/.test(ch)) {
[55] Fix | Delete
stream.eatWhile(/[\w\.]/);
[56] Fix | Delete
return "number";
[57] Fix | Delete
}
[58] Fix | Delete
if (ch == "/") {
[59] Fix | Delete
if (stream.eat("*")) {
[60] Fix | Delete
state.tokenize = tokenComment;
[61] Fix | Delete
return tokenComment(stream, state);
[62] Fix | Delete
}
[63] Fix | Delete
if (stream.eat("/")) {
[64] Fix | Delete
stream.skipToEnd();
[65] Fix | Delete
return "comment";
[66] Fix | Delete
}
[67] Fix | Delete
}
[68] Fix | Delete
if (isOperatorChar.test(ch)) {
[69] Fix | Delete
if(ch == "@"){
[70] Fix | Delete
if(stream.match("try") || stream.match("catch")
[71] Fix | Delete
|| stream.match("lazy")){
[72] Fix | Delete
return "keyword";
[73] Fix | Delete
}
[74] Fix | Delete
}
[75] Fix | Delete
stream.eatWhile(isOperatorChar);
[76] Fix | Delete
return "operator";
[77] Fix | Delete
}
[78] Fix | Delete
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
[79] Fix | Delete
var cur = stream.current();
[80] Fix | Delete
[81] Fix | Delete
if (keywords.propertyIsEnumerable(cur)) return "keyword";
[82] Fix | Delete
if (builtin.propertyIsEnumerable(cur)) return "builtin";
[83] Fix | Delete
[84] Fix | Delete
if (timerOps.propertyIsEnumerable(cur)) return "def timerOps";
[85] Fix | Delete
if (configOps.propertyIsEnumerable(cur)) return "def configOps";
[86] Fix | Delete
if (verdictOps.propertyIsEnumerable(cur)) return "def verdictOps";
[87] Fix | Delete
if (portOps.propertyIsEnumerable(cur)) return "def portOps";
[88] Fix | Delete
if (sutOps.propertyIsEnumerable(cur)) return "def sutOps";
[89] Fix | Delete
if (functionOps.propertyIsEnumerable(cur)) return "def functionOps";
[90] Fix | Delete
[91] Fix | Delete
if (verdictConsts.propertyIsEnumerable(cur)) return "string verdictConsts";
[92] Fix | Delete
if (booleanConsts.propertyIsEnumerable(cur)) return "string booleanConsts";
[93] Fix | Delete
if (otherConsts.propertyIsEnumerable(cur)) return "string otherConsts";
[94] Fix | Delete
[95] Fix | Delete
if (types.propertyIsEnumerable(cur)) return "builtin types";
[96] Fix | Delete
if (visibilityModifiers.propertyIsEnumerable(cur))
[97] Fix | Delete
return "builtin visibilityModifiers";
[98] Fix | Delete
if (templateMatch.propertyIsEnumerable(cur)) return "atom templateMatch";
[99] Fix | Delete
[100] Fix | Delete
return "variable";
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
function tokenString(quote) {
[104] Fix | Delete
return function(stream, state) {
[105] Fix | Delete
var escaped = false, next, end = false;
[106] Fix | Delete
while ((next = stream.next()) != null) {
[107] Fix | Delete
if (next == quote && !escaped){
[108] Fix | Delete
var afterQuote = stream.peek();
[109] Fix | Delete
//look if the character after the quote is like the B in '10100010'B
[110] Fix | Delete
if (afterQuote){
[111] Fix | Delete
afterQuote = afterQuote.toLowerCase();
[112] Fix | Delete
if(afterQuote == "b" || afterQuote == "h" || afterQuote == "o")
[113] Fix | Delete
stream.next();
[114] Fix | Delete
}
[115] Fix | Delete
end = true; break;
[116] Fix | Delete
}
[117] Fix | Delete
escaped = !escaped && next == "\\";
[118] Fix | Delete
}
[119] Fix | Delete
if (end || !(escaped || multiLineStrings))
[120] Fix | Delete
state.tokenize = null;
[121] Fix | Delete
return "string";
[122] Fix | Delete
};
[123] Fix | Delete
}
[124] Fix | Delete
[125] Fix | Delete
function tokenComment(stream, state) {
[126] Fix | Delete
var maybeEnd = false, ch;
[127] Fix | Delete
while (ch = stream.next()) {
[128] Fix | Delete
if (ch == "/" && maybeEnd) {
[129] Fix | Delete
state.tokenize = null;
[130] Fix | Delete
break;
[131] Fix | Delete
}
[132] Fix | Delete
maybeEnd = (ch == "*");
[133] Fix | Delete
}
[134] Fix | Delete
return "comment";
[135] Fix | Delete
}
[136] Fix | Delete
[137] Fix | Delete
function Context(indented, column, type, align, prev) {
[138] Fix | Delete
this.indented = indented;
[139] Fix | Delete
this.column = column;
[140] Fix | Delete
this.type = type;
[141] Fix | Delete
this.align = align;
[142] Fix | Delete
this.prev = prev;
[143] Fix | Delete
}
[144] Fix | Delete
[145] Fix | Delete
function pushContext(state, col, type) {
[146] Fix | Delete
var indent = state.indented;
[147] Fix | Delete
if (state.context && state.context.type == "statement")
[148] Fix | Delete
indent = state.context.indented;
[149] Fix | Delete
return state.context = new Context(indent, col, type, null, state.context);
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
function popContext(state) {
[153] Fix | Delete
var t = state.context.type;
[154] Fix | Delete
if (t == ")" || t == "]" || t == "}")
[155] Fix | Delete
state.indented = state.context.indented;
[156] Fix | Delete
return state.context = state.context.prev;
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
//Interface
[160] Fix | Delete
return {
[161] Fix | Delete
startState: function(basecolumn) {
[162] Fix | Delete
return {
[163] Fix | Delete
tokenize: null,
[164] Fix | Delete
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
[165] Fix | Delete
indented: 0,
[166] Fix | Delete
startOfLine: true
[167] Fix | Delete
};
[168] Fix | Delete
},
[169] Fix | Delete
[170] Fix | Delete
token: function(stream, state) {
[171] Fix | Delete
var ctx = state.context;
[172] Fix | Delete
if (stream.sol()) {
[173] Fix | Delete
if (ctx.align == null) ctx.align = false;
[174] Fix | Delete
state.indented = stream.indentation();
[175] Fix | Delete
state.startOfLine = true;
[176] Fix | Delete
}
[177] Fix | Delete
if (stream.eatSpace()) return null;
[178] Fix | Delete
curPunc = null;
[179] Fix | Delete
var style = (state.tokenize || tokenBase)(stream, state);
[180] Fix | Delete
if (style == "comment") return style;
[181] Fix | Delete
if (ctx.align == null) ctx.align = true;
[182] Fix | Delete
[183] Fix | Delete
if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
[184] Fix | Delete
&& ctx.type == "statement"){
[185] Fix | Delete
popContext(state);
[186] Fix | Delete
}
[187] Fix | Delete
else if (curPunc == "{") pushContext(state, stream.column(), "}");
[188] Fix | Delete
else if (curPunc == "[") pushContext(state, stream.column(), "]");
[189] Fix | Delete
else if (curPunc == "(") pushContext(state, stream.column(), ")");
[190] Fix | Delete
else if (curPunc == "}") {
[191] Fix | Delete
while (ctx.type == "statement") ctx = popContext(state);
[192] Fix | Delete
if (ctx.type == "}") ctx = popContext(state);
[193] Fix | Delete
while (ctx.type == "statement") ctx = popContext(state);
[194] Fix | Delete
}
[195] Fix | Delete
else if (curPunc == ctx.type) popContext(state);
[196] Fix | Delete
else if (indentStatements &&
[197] Fix | Delete
(((ctx.type == "}" || ctx.type == "top") && curPunc != ';') ||
[198] Fix | Delete
(ctx.type == "statement" && curPunc == "newstatement")))
[199] Fix | Delete
pushContext(state, stream.column(), "statement");
[200] Fix | Delete
[201] Fix | Delete
state.startOfLine = false;
[202] Fix | Delete
[203] Fix | Delete
return style;
[204] Fix | Delete
},
[205] Fix | Delete
[206] Fix | Delete
electricChars: "{}",
[207] Fix | Delete
blockCommentStart: "/*",
[208] Fix | Delete
blockCommentEnd: "*/",
[209] Fix | Delete
lineComment: "//",
[210] Fix | Delete
fold: "brace"
[211] Fix | Delete
};
[212] Fix | Delete
});
[213] Fix | Delete
[214] Fix | Delete
function words(str) {
[215] Fix | Delete
var obj = {}, words = str.split(" ");
[216] Fix | Delete
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
[217] Fix | Delete
return obj;
[218] Fix | Delete
}
[219] Fix | Delete
[220] Fix | Delete
function def(mimes, mode) {
[221] Fix | Delete
if (typeof mimes == "string") mimes = [mimes];
[222] Fix | Delete
var words = [];
[223] Fix | Delete
function add(obj) {
[224] Fix | Delete
if (obj) for (var prop in obj) if (obj.hasOwnProperty(prop))
[225] Fix | Delete
words.push(prop);
[226] Fix | Delete
}
[227] Fix | Delete
[228] Fix | Delete
add(mode.keywords);
[229] Fix | Delete
add(mode.builtin);
[230] Fix | Delete
add(mode.timerOps);
[231] Fix | Delete
add(mode.portOps);
[232] Fix | Delete
[233] Fix | Delete
if (words.length) {
[234] Fix | Delete
mode.helperType = mimes[0];
[235] Fix | Delete
CodeMirror.registerHelper("hintWords", mimes[0], words);
[236] Fix | Delete
}
[237] Fix | Delete
[238] Fix | Delete
for (var i = 0; i < mimes.length; ++i)
[239] Fix | Delete
CodeMirror.defineMIME(mimes[i], mode);
[240] Fix | Delete
}
[241] Fix | Delete
[242] Fix | Delete
def(["text/x-ttcn", "text/x-ttcn3", "text/x-ttcnpp"], {
[243] Fix | Delete
name: "ttcn",
[244] Fix | Delete
keywords: words("activate address alive all alt altstep and and4b any" +
[245] Fix | Delete
" break case component const continue control deactivate" +
[246] Fix | Delete
" display do else encode enumerated except exception" +
[247] Fix | Delete
" execute extends extension external for from function" +
[248] Fix | Delete
" goto group if import in infinity inout interleave" +
[249] Fix | Delete
" label language length log match message mixed mod" +
[250] Fix | Delete
" modifies module modulepar mtc noblock not not4b nowait" +
[251] Fix | Delete
" of on optional or or4b out override param pattern port" +
[252] Fix | Delete
" procedure record recursive rem repeat return runs select" +
[253] Fix | Delete
" self sender set signature system template testcase to" +
[254] Fix | Delete
" type union value valueof var variant while with xor xor4b"),
[255] Fix | Delete
builtin: words("bit2hex bit2int bit2oct bit2str char2int char2oct encvalue" +
[256] Fix | Delete
" decomp decvalue float2int float2str hex2bit hex2int" +
[257] Fix | Delete
" hex2oct hex2str int2bit int2char int2float int2hex" +
[258] Fix | Delete
" int2oct int2str int2unichar isbound ischosen ispresent" +
[259] Fix | Delete
" isvalue lengthof log2str oct2bit oct2char oct2hex oct2int" +
[260] Fix | Delete
" oct2str regexp replace rnd sizeof str2bit str2float" +
[261] Fix | Delete
" str2hex str2int str2oct substr unichar2int unichar2char" +
[262] Fix | Delete
" enum2int"),
[263] Fix | Delete
types: words("anytype bitstring boolean char charstring default float" +
[264] Fix | Delete
" hexstring integer objid octetstring universal verdicttype timer"),
[265] Fix | Delete
timerOps: words("read running start stop timeout"),
[266] Fix | Delete
portOps: words("call catch check clear getcall getreply halt raise receive" +
[267] Fix | Delete
" reply send trigger"),
[268] Fix | Delete
configOps: words("create connect disconnect done kill killed map unmap"),
[269] Fix | Delete
verdictOps: words("getverdict setverdict"),
[270] Fix | Delete
sutOps: words("action"),
[271] Fix | Delete
functionOps: words("apply derefers refers"),
[272] Fix | Delete
[273] Fix | Delete
verdictConsts: words("error fail inconc none pass"),
[274] Fix | Delete
booleanConsts: words("true false"),
[275] Fix | Delete
otherConsts: words("null NULL omit"),
[276] Fix | Delete
[277] Fix | Delete
visibilityModifiers: words("private public friend"),
[278] Fix | Delete
templateMatch: words("complement ifpresent subset superset permutation"),
[279] Fix | Delete
multiLineStrings: true
[280] Fix | Delete
});
[281] Fix | Delete
});
[282] Fix | Delete
[283] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function