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/verilog
File: verilog.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("verilog", function(config, parserConfig) {
[13] Fix | Delete
[14] Fix | Delete
var indentUnit = config.indentUnit,
[15] Fix | Delete
statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
[16] Fix | Delete
dontAlignCalls = parserConfig.dontAlignCalls,
[17] Fix | Delete
noIndentKeywords = parserConfig.noIndentKeywords || [],
[18] Fix | Delete
multiLineStrings = parserConfig.multiLineStrings,
[19] Fix | Delete
hooks = parserConfig.hooks || {};
[20] Fix | Delete
[21] Fix | Delete
function words(str) {
[22] Fix | Delete
var obj = {}, words = str.split(" ");
[23] Fix | Delete
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
[24] Fix | Delete
return obj;
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Keywords from IEEE 1800-2012
[29] Fix | Delete
*/
[30] Fix | Delete
var keywords = words(
[31] Fix | Delete
"accept_on alias always always_comb always_ff always_latch and assert assign assume automatic before begin bind " +
[32] Fix | Delete
"bins binsof bit break buf bufif0 bufif1 byte case casex casez cell chandle checker class clocking cmos config " +
[33] Fix | Delete
"const constraint context continue cover covergroup coverpoint cross deassign default defparam design disable " +
[34] Fix | Delete
"dist do edge else end endcase endchecker endclass endclocking endconfig endfunction endgenerate endgroup " +
[35] Fix | Delete
"endinterface endmodule endpackage endprimitive endprogram endproperty endspecify endsequence endtable endtask " +
[36] Fix | Delete
"enum event eventually expect export extends extern final first_match for force foreach forever fork forkjoin " +
[37] Fix | Delete
"function generate genvar global highz0 highz1 if iff ifnone ignore_bins illegal_bins implements implies import " +
[38] Fix | Delete
"incdir include initial inout input inside instance int integer interconnect interface intersect join join_any " +
[39] Fix | Delete
"join_none large let liblist library local localparam logic longint macromodule matches medium modport module " +
[40] Fix | Delete
"nand negedge nettype new nexttime nmos nor noshowcancelled not notif0 notif1 null or output package packed " +
[41] Fix | Delete
"parameter pmos posedge primitive priority program property protected pull0 pull1 pulldown pullup " +
[42] Fix | Delete
"pulsestyle_ondetect pulsestyle_onevent pure rand randc randcase randsequence rcmos real realtime ref reg " +
[43] Fix | Delete
"reject_on release repeat restrict return rnmos rpmos rtran rtranif0 rtranif1 s_always s_eventually s_nexttime " +
[44] Fix | Delete
"s_until s_until_with scalared sequence shortint shortreal showcancelled signed small soft solve specify " +
[45] Fix | Delete
"specparam static string strong strong0 strong1 struct super supply0 supply1 sync_accept_on sync_reject_on " +
[46] Fix | Delete
"table tagged task this throughout time timeprecision timeunit tran tranif0 tranif1 tri tri0 tri1 triand trior " +
[47] Fix | Delete
"trireg type typedef union unique unique0 unsigned until until_with untyped use uwire var vectored virtual void " +
[48] Fix | Delete
"wait wait_order wand weak weak0 weak1 while wildcard wire with within wor xnor xor");
[49] Fix | Delete
[50] Fix | Delete
/** Operators from IEEE 1800-2012
[51] Fix | Delete
unary_operator ::=
[52] Fix | Delete
+ | - | ! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~
[53] Fix | Delete
binary_operator ::=
[54] Fix | Delete
+ | - | * | / | % | == | != | === | !== | ==? | !=? | && | || | **
[55] Fix | Delete
| < | <= | > | >= | & | | | ^ | ^~ | ~^ | >> | << | >>> | <<<
[56] Fix | Delete
| -> | <->
[57] Fix | Delete
inc_or_dec_operator ::= ++ | --
[58] Fix | Delete
unary_module_path_operator ::=
[59] Fix | Delete
! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~
[60] Fix | Delete
binary_module_path_operator ::=
[61] Fix | Delete
== | != | && | || | & | | | ^ | ^~ | ~^
[62] Fix | Delete
*/
[63] Fix | Delete
var isOperatorChar = /[\+\-\*\/!~&|^%=?:]/;
[64] Fix | Delete
var isBracketChar = /[\[\]{}()]/;
[65] Fix | Delete
[66] Fix | Delete
var unsignedNumber = /\d[0-9_]*/;
[67] Fix | Delete
var decimalLiteral = /\d*\s*'s?d\s*\d[0-9_]*/i;
[68] Fix | Delete
var binaryLiteral = /\d*\s*'s?b\s*[xz01][xz01_]*/i;
[69] Fix | Delete
var octLiteral = /\d*\s*'s?o\s*[xz0-7][xz0-7_]*/i;
[70] Fix | Delete
var hexLiteral = /\d*\s*'s?h\s*[0-9a-fxz?][0-9a-fxz?_]*/i;
[71] Fix | Delete
var realLiteral = /(\d[\d_]*(\.\d[\d_]*)?E-?[\d_]+)|(\d[\d_]*\.\d[\d_]*)/i;
[72] Fix | Delete
[73] Fix | Delete
var closingBracketOrWord = /^((\w+)|[)}\]])/;
[74] Fix | Delete
var closingBracket = /[)}\]]/;
[75] Fix | Delete
[76] Fix | Delete
var curPunc;
[77] Fix | Delete
var curKeyword;
[78] Fix | Delete
[79] Fix | Delete
// Block openings which are closed by a matching keyword in the form of ("end" + keyword)
[80] Fix | Delete
// E.g. "task" => "endtask"
[81] Fix | Delete
var blockKeywords = words(
[82] Fix | Delete
"case checker class clocking config function generate interface module package" +
[83] Fix | Delete
"primitive program property specify sequence table task"
[84] Fix | Delete
);
[85] Fix | Delete
[86] Fix | Delete
// Opening/closing pairs
[87] Fix | Delete
var openClose = {};
[88] Fix | Delete
for (var keyword in blockKeywords) {
[89] Fix | Delete
openClose[keyword] = "end" + keyword;
[90] Fix | Delete
}
[91] Fix | Delete
openClose["begin"] = "end";
[92] Fix | Delete
openClose["casex"] = "endcase";
[93] Fix | Delete
openClose["casez"] = "endcase";
[94] Fix | Delete
openClose["do" ] = "while";
[95] Fix | Delete
openClose["fork" ] = "join;join_any;join_none";
[96] Fix | Delete
openClose["covergroup"] = "endgroup";
[97] Fix | Delete
[98] Fix | Delete
for (var i in noIndentKeywords) {
[99] Fix | Delete
var keyword = noIndentKeywords[i];
[100] Fix | Delete
if (openClose[keyword]) {
[101] Fix | Delete
openClose[keyword] = undefined;
[102] Fix | Delete
}
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
// Keywords which open statements that are ended with a semi-colon
[106] Fix | Delete
var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while");
[107] Fix | Delete
[108] Fix | Delete
function tokenBase(stream, state) {
[109] Fix | Delete
var ch = stream.peek(), style;
[110] Fix | Delete
if (hooks[ch] && (style = hooks[ch](stream, state)) != false) return style;
[111] Fix | Delete
if (hooks.tokenBase && (style = hooks.tokenBase(stream, state)) != false)
[112] Fix | Delete
return style;
[113] Fix | Delete
[114] Fix | Delete
if (/[,;:\.]/.test(ch)) {
[115] Fix | Delete
curPunc = stream.next();
[116] Fix | Delete
return null;
[117] Fix | Delete
}
[118] Fix | Delete
if (isBracketChar.test(ch)) {
[119] Fix | Delete
curPunc = stream.next();
[120] Fix | Delete
return "bracket";
[121] Fix | Delete
}
[122] Fix | Delete
// Macros (tick-defines)
[123] Fix | Delete
if (ch == '`') {
[124] Fix | Delete
stream.next();
[125] Fix | Delete
if (stream.eatWhile(/[\w\$_]/)) {
[126] Fix | Delete
return "def";
[127] Fix | Delete
} else {
[128] Fix | Delete
return null;
[129] Fix | Delete
}
[130] Fix | Delete
}
[131] Fix | Delete
// System calls
[132] Fix | Delete
if (ch == '$') {
[133] Fix | Delete
stream.next();
[134] Fix | Delete
if (stream.eatWhile(/[\w\$_]/)) {
[135] Fix | Delete
return "meta";
[136] Fix | Delete
} else {
[137] Fix | Delete
return null;
[138] Fix | Delete
}
[139] Fix | Delete
}
[140] Fix | Delete
// Time literals
[141] Fix | Delete
if (ch == '#') {
[142] Fix | Delete
stream.next();
[143] Fix | Delete
stream.eatWhile(/[\d_.]/);
[144] Fix | Delete
return "def";
[145] Fix | Delete
}
[146] Fix | Delete
// Strings
[147] Fix | Delete
if (ch == '"') {
[148] Fix | Delete
stream.next();
[149] Fix | Delete
state.tokenize = tokenString(ch);
[150] Fix | Delete
return state.tokenize(stream, state);
[151] Fix | Delete
}
[152] Fix | Delete
// Comments
[153] Fix | Delete
if (ch == "/") {
[154] Fix | Delete
stream.next();
[155] Fix | Delete
if (stream.eat("*")) {
[156] Fix | Delete
state.tokenize = tokenComment;
[157] Fix | Delete
return tokenComment(stream, state);
[158] Fix | Delete
}
[159] Fix | Delete
if (stream.eat("/")) {
[160] Fix | Delete
stream.skipToEnd();
[161] Fix | Delete
return "comment";
[162] Fix | Delete
}
[163] Fix | Delete
stream.backUp(1);
[164] Fix | Delete
}
[165] Fix | Delete
[166] Fix | Delete
// Numeric literals
[167] Fix | Delete
if (stream.match(realLiteral) ||
[168] Fix | Delete
stream.match(decimalLiteral) ||
[169] Fix | Delete
stream.match(binaryLiteral) ||
[170] Fix | Delete
stream.match(octLiteral) ||
[171] Fix | Delete
stream.match(hexLiteral) ||
[172] Fix | Delete
stream.match(unsignedNumber) ||
[173] Fix | Delete
stream.match(realLiteral)) {
[174] Fix | Delete
return "number";
[175] Fix | Delete
}
[176] Fix | Delete
[177] Fix | Delete
// Operators
[178] Fix | Delete
if (stream.eatWhile(isOperatorChar)) {
[179] Fix | Delete
return "meta";
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
// Keywords / plain variables
[183] Fix | Delete
if (stream.eatWhile(/[\w\$_]/)) {
[184] Fix | Delete
var cur = stream.current();
[185] Fix | Delete
if (keywords[cur]) {
[186] Fix | Delete
if (openClose[cur]) {
[187] Fix | Delete
curPunc = "newblock";
[188] Fix | Delete
}
[189] Fix | Delete
if (statementKeywords[cur]) {
[190] Fix | Delete
curPunc = "newstatement";
[191] Fix | Delete
}
[192] Fix | Delete
curKeyword = cur;
[193] Fix | Delete
return "keyword";
[194] Fix | Delete
}
[195] Fix | Delete
return "variable";
[196] Fix | Delete
}
[197] Fix | Delete
[198] Fix | Delete
stream.next();
[199] Fix | Delete
return null;
[200] Fix | Delete
}
[201] Fix | Delete
[202] Fix | Delete
function tokenString(quote) {
[203] Fix | Delete
return function(stream, state) {
[204] Fix | Delete
var escaped = false, next, end = false;
[205] Fix | Delete
while ((next = stream.next()) != null) {
[206] Fix | Delete
if (next == quote && !escaped) {end = true; break;}
[207] Fix | Delete
escaped = !escaped && next == "\\";
[208] Fix | Delete
}
[209] Fix | Delete
if (end || !(escaped || multiLineStrings))
[210] Fix | Delete
state.tokenize = tokenBase;
[211] Fix | Delete
return "string";
[212] Fix | Delete
};
[213] Fix | Delete
}
[214] Fix | Delete
[215] Fix | Delete
function tokenComment(stream, state) {
[216] Fix | Delete
var maybeEnd = false, ch;
[217] Fix | Delete
while (ch = stream.next()) {
[218] Fix | Delete
if (ch == "/" && maybeEnd) {
[219] Fix | Delete
state.tokenize = tokenBase;
[220] Fix | Delete
break;
[221] Fix | Delete
}
[222] Fix | Delete
maybeEnd = (ch == "*");
[223] Fix | Delete
}
[224] Fix | Delete
return "comment";
[225] Fix | Delete
}
[226] Fix | Delete
[227] Fix | Delete
function Context(indented, column, type, align, prev) {
[228] Fix | Delete
this.indented = indented;
[229] Fix | Delete
this.column = column;
[230] Fix | Delete
this.type = type;
[231] Fix | Delete
this.align = align;
[232] Fix | Delete
this.prev = prev;
[233] Fix | Delete
}
[234] Fix | Delete
function pushContext(state, col, type) {
[235] Fix | Delete
var indent = state.indented;
[236] Fix | Delete
var c = new Context(indent, col, type, null, state.context);
[237] Fix | Delete
return state.context = c;
[238] Fix | Delete
}
[239] Fix | Delete
function popContext(state) {
[240] Fix | Delete
var t = state.context.type;
[241] Fix | Delete
if (t == ")" || t == "]" || t == "}") {
[242] Fix | Delete
state.indented = state.context.indented;
[243] Fix | Delete
}
[244] Fix | Delete
return state.context = state.context.prev;
[245] Fix | Delete
}
[246] Fix | Delete
[247] Fix | Delete
function isClosing(text, contextClosing) {
[248] Fix | Delete
if (text == contextClosing) {
[249] Fix | Delete
return true;
[250] Fix | Delete
} else {
[251] Fix | Delete
// contextClosing may be multiple keywords separated by ;
[252] Fix | Delete
var closingKeywords = contextClosing.split(";");
[253] Fix | Delete
for (var i in closingKeywords) {
[254] Fix | Delete
if (text == closingKeywords[i]) {
[255] Fix | Delete
return true;
[256] Fix | Delete
}
[257] Fix | Delete
}
[258] Fix | Delete
return false;
[259] Fix | Delete
}
[260] Fix | Delete
}
[261] Fix | Delete
[262] Fix | Delete
function buildElectricInputRegEx() {
[263] Fix | Delete
// Reindentation should occur on any bracket char: {}()[]
[264] Fix | Delete
// or on a match of any of the block closing keywords, at
[265] Fix | Delete
// the end of a line
[266] Fix | Delete
var allClosings = [];
[267] Fix | Delete
for (var i in openClose) {
[268] Fix | Delete
if (openClose[i]) {
[269] Fix | Delete
var closings = openClose[i].split(";");
[270] Fix | Delete
for (var j in closings) {
[271] Fix | Delete
allClosings.push(closings[j]);
[272] Fix | Delete
}
[273] Fix | Delete
}
[274] Fix | Delete
}
[275] Fix | Delete
var re = new RegExp("[{}()\\[\\]]|(" + allClosings.join("|") + ")$");
[276] Fix | Delete
return re;
[277] Fix | Delete
}
[278] Fix | Delete
[279] Fix | Delete
// Interface
[280] Fix | Delete
return {
[281] Fix | Delete
[282] Fix | Delete
// Regex to force current line to reindent
[283] Fix | Delete
electricInput: buildElectricInputRegEx(),
[284] Fix | Delete
[285] Fix | Delete
startState: function(basecolumn) {
[286] Fix | Delete
var state = {
[287] Fix | Delete
tokenize: null,
[288] Fix | Delete
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
[289] Fix | Delete
indented: 0,
[290] Fix | Delete
startOfLine: true
[291] Fix | Delete
};
[292] Fix | Delete
if (hooks.startState) hooks.startState(state);
[293] Fix | Delete
return state;
[294] Fix | Delete
},
[295] Fix | Delete
[296] Fix | Delete
token: function(stream, state) {
[297] Fix | Delete
var ctx = state.context;
[298] Fix | Delete
if (stream.sol()) {
[299] Fix | Delete
if (ctx.align == null) ctx.align = false;
[300] Fix | Delete
state.indented = stream.indentation();
[301] Fix | Delete
state.startOfLine = true;
[302] Fix | Delete
}
[303] Fix | Delete
if (hooks.token) hooks.token(stream, state);
[304] Fix | Delete
if (stream.eatSpace()) return null;
[305] Fix | Delete
curPunc = null;
[306] Fix | Delete
curKeyword = null;
[307] Fix | Delete
var style = (state.tokenize || tokenBase)(stream, state);
[308] Fix | Delete
if (style == "comment" || style == "meta" || style == "variable") return style;
[309] Fix | Delete
if (ctx.align == null) ctx.align = true;
[310] Fix | Delete
[311] Fix | Delete
if (curPunc == ctx.type) {
[312] Fix | Delete
popContext(state);
[313] Fix | Delete
} else if ((curPunc == ";" && ctx.type == "statement") ||
[314] Fix | Delete
(ctx.type && isClosing(curKeyword, ctx.type))) {
[315] Fix | Delete
ctx = popContext(state);
[316] Fix | Delete
while (ctx && ctx.type == "statement") ctx = popContext(state);
[317] Fix | Delete
} else if (curPunc == "{") {
[318] Fix | Delete
pushContext(state, stream.column(), "}");
[319] Fix | Delete
} else if (curPunc == "[") {
[320] Fix | Delete
pushContext(state, stream.column(), "]");
[321] Fix | Delete
} else if (curPunc == "(") {
[322] Fix | Delete
pushContext(state, stream.column(), ")");
[323] Fix | Delete
} else if (ctx && ctx.type == "endcase" && curPunc == ":") {
[324] Fix | Delete
pushContext(state, stream.column(), "statement");
[325] Fix | Delete
} else if (curPunc == "newstatement") {
[326] Fix | Delete
pushContext(state, stream.column(), "statement");
[327] Fix | Delete
} else if (curPunc == "newblock") {
[328] Fix | Delete
if (curKeyword == "function" && ctx && (ctx.type == "statement" || ctx.type == "endgroup")) {
[329] Fix | Delete
// The 'function' keyword can appear in some other contexts where it actually does not
[330] Fix | Delete
// indicate a function (import/export DPI and covergroup definitions).
[331] Fix | Delete
// Do nothing in this case
[332] Fix | Delete
} else if (curKeyword == "task" && ctx && ctx.type == "statement") {
[333] Fix | Delete
// Same thing for task
[334] Fix | Delete
} else {
[335] Fix | Delete
var close = openClose[curKeyword];
[336] Fix | Delete
pushContext(state, stream.column(), close);
[337] Fix | Delete
}
[338] Fix | Delete
}
[339] Fix | Delete
[340] Fix | Delete
state.startOfLine = false;
[341] Fix | Delete
return style;
[342] Fix | Delete
},
[343] Fix | Delete
[344] Fix | Delete
indent: function(state, textAfter) {
[345] Fix | Delete
if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
[346] Fix | Delete
if (hooks.indent) {
[347] Fix | Delete
var fromHook = hooks.indent(state);
[348] Fix | Delete
if (fromHook >= 0) return fromHook;
[349] Fix | Delete
}
[350] Fix | Delete
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
[351] Fix | Delete
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
[352] Fix | Delete
var closing = false;
[353] Fix | Delete
var possibleClosing = textAfter.match(closingBracketOrWord);
[354] Fix | Delete
if (possibleClosing)
[355] Fix | Delete
closing = isClosing(possibleClosing[0], ctx.type);
[356] Fix | Delete
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
[357] Fix | Delete
else if (closingBracket.test(ctx.type) && ctx.align && !dontAlignCalls) return ctx.column + (closing ? 0 : 1);
[358] Fix | Delete
else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit;
[359] Fix | Delete
else return ctx.indented + (closing ? 0 : indentUnit);
[360] Fix | Delete
},
[361] Fix | Delete
[362] Fix | Delete
blockCommentStart: "/*",
[363] Fix | Delete
blockCommentEnd: "*/",
[364] Fix | Delete
lineComment: "//"
[365] Fix | Delete
};
[366] Fix | Delete
});
[367] Fix | Delete
[368] Fix | Delete
CodeMirror.defineMIME("text/x-verilog", {
[369] Fix | Delete
name: "verilog"
[370] Fix | Delete
});
[371] Fix | Delete
[372] Fix | Delete
CodeMirror.defineMIME("text/x-systemverilog", {
[373] Fix | Delete
name: "verilog"
[374] Fix | Delete
});
[375] Fix | Delete
[376] Fix | Delete
// TLVVerilog mode
[377] Fix | Delete
[378] Fix | Delete
var tlvchScopePrefixes = {
[379] Fix | Delete
">": "property", "->": "property", "-": "hr", "|": "link", "?$": "qualifier", "?*": "qualifier",
[380] Fix | Delete
"@-": "variable-3", "@": "variable-3", "?": "qualifier"
[381] Fix | Delete
};
[382] Fix | Delete
[383] Fix | Delete
function tlvGenIndent(stream, state) {
[384] Fix | Delete
var tlvindentUnit = 2;
[385] Fix | Delete
var rtnIndent = -1, indentUnitRq = 0, curIndent = stream.indentation();
[386] Fix | Delete
switch (state.tlvCurCtlFlowChar) {
[387] Fix | Delete
case "\\":
[388] Fix | Delete
curIndent = 0;
[389] Fix | Delete
break;
[390] Fix | Delete
case "|":
[391] Fix | Delete
if (state.tlvPrevPrevCtlFlowChar == "@") {
[392] Fix | Delete
indentUnitRq = -2; //-2 new pipe rq after cur pipe
[393] Fix | Delete
break;
[394] Fix | Delete
}
[395] Fix | Delete
if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar])
[396] Fix | Delete
indentUnitRq = 1; // +1 new scope
[397] Fix | Delete
break;
[398] Fix | Delete
case "M": // m4
[399] Fix | Delete
if (state.tlvPrevPrevCtlFlowChar == "@") {
[400] Fix | Delete
indentUnitRq = -2; //-2 new inst rq after pipe
[401] Fix | Delete
break;
[402] Fix | Delete
}
[403] Fix | Delete
if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar])
[404] Fix | Delete
indentUnitRq = 1; // +1 new scope
[405] Fix | Delete
break;
[406] Fix | Delete
case "@":
[407] Fix | Delete
if (state.tlvPrevCtlFlowChar == "S")
[408] Fix | Delete
indentUnitRq = -1; // new pipe stage after stmts
[409] Fix | Delete
if (state.tlvPrevCtlFlowChar == "|")
[410] Fix | Delete
indentUnitRq = 1; // 1st pipe stage
[411] Fix | Delete
break;
[412] Fix | Delete
case "S":
[413] Fix | Delete
if (state.tlvPrevCtlFlowChar == "@")
[414] Fix | Delete
indentUnitRq = 1; // flow in pipe stage
[415] Fix | Delete
if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar])
[416] Fix | Delete
indentUnitRq = 1; // +1 new scope
[417] Fix | Delete
break;
[418] Fix | Delete
}
[419] Fix | Delete
var statementIndentUnit = tlvindentUnit;
[420] Fix | Delete
rtnIndent = curIndent + (indentUnitRq*statementIndentUnit);
[421] Fix | Delete
return rtnIndent >= 0 ? rtnIndent : curIndent;
[422] Fix | Delete
}
[423] Fix | Delete
[424] Fix | Delete
CodeMirror.defineMIME("text/x-tlv", {
[425] Fix | Delete
name: "verilog",
[426] Fix | Delete
hooks: {
[427] Fix | Delete
"\\": function(stream, state) {
[428] Fix | Delete
var vxIndent = 0, style = false;
[429] Fix | Delete
var curPunc = stream.string;
[430] Fix | Delete
if ((stream.sol()) && ((/\\SV/.test(stream.string)) || (/\\TLV/.test(stream.string)))) {
[431] Fix | Delete
curPunc = (/\\TLV_version/.test(stream.string))
[432] Fix | Delete
? "\\TLV_version" : stream.string;
[433] Fix | Delete
stream.skipToEnd();
[434] Fix | Delete
if (curPunc == "\\SV" && state.vxCodeActive) {state.vxCodeActive = false;};
[435] Fix | Delete
if ((/\\TLV/.test(curPunc) && !state.vxCodeActive)
[436] Fix | Delete
|| (curPunc=="\\TLV_version" && state.vxCodeActive)) {state.vxCodeActive = true;};
[437] Fix | Delete
style = "keyword";
[438] Fix | Delete
state.tlvCurCtlFlowChar = state.tlvPrevPrevCtlFlowChar
[439] Fix | Delete
= state.tlvPrevCtlFlowChar = "";
[440] Fix | Delete
if (state.vxCodeActive == true) {
[441] Fix | Delete
state.tlvCurCtlFlowChar = "\\";
[442] Fix | Delete
vxIndent = tlvGenIndent(stream, state);
[443] Fix | Delete
}
[444] Fix | Delete
state.vxIndentRq = vxIndent;
[445] Fix | Delete
}
[446] Fix | Delete
return style;
[447] Fix | Delete
},
[448] Fix | Delete
tokenBase: function(stream, state) {
[449] Fix | Delete
var vxIndent = 0, style = false;
[450] Fix | Delete
var tlvisOperatorChar = /[\[\]=:]/;
[451] Fix | Delete
var tlvkpScopePrefixs = {
[452] Fix | Delete
"**":"variable-2", "*":"variable-2", "$$":"variable", "$":"variable",
[453] Fix | Delete
"^^":"attribute", "^":"attribute"};
[454] Fix | Delete
var ch = stream.peek();
[455] Fix | Delete
var vxCurCtlFlowCharValueAtStart = state.tlvCurCtlFlowChar;
[456] Fix | Delete
if (state.vxCodeActive == true) {
[457] Fix | Delete
if (/[\[\]{}\(\);\:]/.test(ch)) {
[458] Fix | Delete
// bypass nesting and 1 char punc
[459] Fix | Delete
style = "meta";
[460] Fix | Delete
stream.next();
[461] Fix | Delete
} else if (ch == "/") {
[462] Fix | Delete
stream.next();
[463] Fix | Delete
if (stream.eat("/")) {
[464] Fix | Delete
stream.skipToEnd();
[465] Fix | Delete
style = "comment";
[466] Fix | Delete
state.tlvCurCtlFlowChar = "S";
[467] Fix | Delete
} else {
[468] Fix | Delete
stream.backUp(1);
[469] Fix | Delete
}
[470] Fix | Delete
} else if (ch == "@") {
[471] Fix | Delete
// pipeline stage
[472] Fix | Delete
style = tlvchScopePrefixes[ch];
[473] Fix | Delete
state.tlvCurCtlFlowChar = "@";
[474] Fix | Delete
stream.next();
[475] Fix | Delete
stream.eatWhile(/[\w\$_]/);
[476] Fix | Delete
} else if (stream.match(/\b[mM]4+/, true)) { // match: function(pattern, consume, caseInsensitive)
[477] Fix | Delete
// m4 pre proc
[478] Fix | Delete
stream.skipTo("(");
[479] Fix | Delete
style = "def";
[480] Fix | Delete
state.tlvCurCtlFlowChar = "M";
[481] Fix | Delete
} else if (ch == "!" && stream.sol()) {
[482] Fix | Delete
// v stmt in tlv region
[483] Fix | Delete
// state.tlvCurCtlFlowChar = "S";
[484] Fix | Delete
style = "comment";
[485] Fix | Delete
stream.next();
[486] Fix | Delete
} else if (tlvisOperatorChar.test(ch)) {
[487] Fix | Delete
// operators
[488] Fix | Delete
stream.eatWhile(tlvisOperatorChar);
[489] Fix | Delete
style = "operator";
[490] Fix | Delete
} else if (ch == "#") {
[491] Fix | Delete
// phy hier
[492] Fix | Delete
state.tlvCurCtlFlowChar = (state.tlvCurCtlFlowChar == "")
[493] Fix | Delete
? ch : state.tlvCurCtlFlowChar;
[494] Fix | Delete
stream.next();
[495] Fix | Delete
stream.eatWhile(/[+-]\d/);
[496] Fix | Delete
style = "tag";
[497] Fix | Delete
} else if (tlvkpScopePrefixs.propertyIsEnumerable(ch)) {
[498] Fix | Delete
// special TLV operators
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function