systemverilog.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. "use strict";
  2. /*!-----------------------------------------------------------------------------
  3. * Copyright (c) Microsoft Corporation. All rights reserved.
  4. * Version: 0.38.0(0e330ae453813de4e6cf272460fb79c7117073d0)
  5. * Released under the MIT license
  6. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  7. *-----------------------------------------------------------------------------*/
  8. define("vs/basic-languages/systemverilog/systemverilog", ["require"],(require)=>{
  9. var moduleExports = (() => {
  10. var __defProp = Object.defineProperty;
  11. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  12. var __getOwnPropNames = Object.getOwnPropertyNames;
  13. var __hasOwnProp = Object.prototype.hasOwnProperty;
  14. var __export = (target, all) => {
  15. for (var name in all)
  16. __defProp(target, name, { get: all[name], enumerable: true });
  17. };
  18. var __copyProps = (to, from, except, desc) => {
  19. if (from && typeof from === "object" || typeof from === "function") {
  20. for (let key of __getOwnPropNames(from))
  21. if (!__hasOwnProp.call(to, key) && key !== except)
  22. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  23. }
  24. return to;
  25. };
  26. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  27. // src/basic-languages/systemverilog/systemverilog.ts
  28. var systemverilog_exports = {};
  29. __export(systemverilog_exports, {
  30. conf: () => conf,
  31. language: () => language
  32. });
  33. var conf = {
  34. comments: {
  35. lineComment: "//",
  36. blockComment: ["/*", "*/"]
  37. },
  38. brackets: [
  39. ["{", "}"],
  40. ["[", "]"],
  41. ["(", ")"],
  42. ["begin", "end"],
  43. ["case", "endcase"],
  44. ["casex", "endcase"],
  45. ["casez", "endcase"],
  46. ["checker", "endchecker"],
  47. ["class", "endclass"],
  48. ["clocking", "endclocking"],
  49. ["config", "endconfig"],
  50. ["function", "endfunction"],
  51. ["generate", "endgenerate"],
  52. ["group", "endgroup"],
  53. ["interface", "endinterface"],
  54. ["module", "endmodule"],
  55. ["package", "endpackage"],
  56. ["primitive", "endprimitive"],
  57. ["program", "endprogram"],
  58. ["property", "endproperty"],
  59. ["specify", "endspecify"],
  60. ["sequence", "endsequence"],
  61. ["table", "endtable"],
  62. ["task", "endtask"]
  63. ],
  64. autoClosingPairs: [
  65. { open: "[", close: "]" },
  66. { open: "{", close: "}" },
  67. { open: "(", close: ")" },
  68. { open: "'", close: "'", notIn: ["string", "comment"] },
  69. { open: '"', close: '"', notIn: ["string"] }
  70. ],
  71. surroundingPairs: [
  72. { open: "{", close: "}" },
  73. { open: "[", close: "]" },
  74. { open: "(", close: ")" },
  75. { open: '"', close: '"' },
  76. { open: "'", close: "'" }
  77. ],
  78. folding: {
  79. offSide: false,
  80. markers: {
  81. start: new RegExp("^(?:\\s*|.*(?!\\/[\\/\\*])[^\\w])(?:begin|case(x|z)?|class|clocking|config|covergroup|function|generate|interface|module|package|primitive|property|program|sequence|specify|table|task)\\b"),
  82. end: new RegExp("^(?:\\s*|.*(?!\\/[\\/\\*])[^\\w])(?:end|endcase|endclass|endclocking|endconfig|endgroup|endfunction|endgenerate|endinterface|endmodule|endpackage|endprimitive|endproperty|endprogram|endsequence|endspecify|endtable|endtask)\\b")
  83. }
  84. }
  85. };
  86. var language = {
  87. defaultToken: "",
  88. tokenPostfix: ".sv",
  89. brackets: [
  90. { token: "delimiter.curly", open: "{", close: "}" },
  91. { token: "delimiter.parenthesis", open: "(", close: ")" },
  92. { token: "delimiter.square", open: "[", close: "]" },
  93. { token: "delimiter.angle", open: "<", close: ">" }
  94. ],
  95. keywords: [
  96. "accept_on",
  97. "alias",
  98. "always",
  99. "always_comb",
  100. "always_ff",
  101. "always_latch",
  102. "and",
  103. "assert",
  104. "assign",
  105. "assume",
  106. "automatic",
  107. "before",
  108. "begin",
  109. "bind",
  110. "bins",
  111. "binsof",
  112. "bit",
  113. "break",
  114. "buf",
  115. "bufif0",
  116. "bufif1",
  117. "byte",
  118. "case",
  119. "casex",
  120. "casez",
  121. "cell",
  122. "chandle",
  123. "checker",
  124. "class",
  125. "clocking",
  126. "cmos",
  127. "config",
  128. "const",
  129. "constraint",
  130. "context",
  131. "continue",
  132. "cover",
  133. "covergroup",
  134. "coverpoint",
  135. "cross",
  136. "deassign",
  137. "default",
  138. "defparam",
  139. "design",
  140. "disable",
  141. "dist",
  142. "do",
  143. "edge",
  144. "else",
  145. "end",
  146. "endcase",
  147. "endchecker",
  148. "endclass",
  149. "endclocking",
  150. "endconfig",
  151. "endfunction",
  152. "endgenerate",
  153. "endgroup",
  154. "endinterface",
  155. "endmodule",
  156. "endpackage",
  157. "endprimitive",
  158. "endprogram",
  159. "endproperty",
  160. "endspecify",
  161. "endsequence",
  162. "endtable",
  163. "endtask",
  164. "enum",
  165. "event",
  166. "eventually",
  167. "expect",
  168. "export",
  169. "extends",
  170. "extern",
  171. "final",
  172. "first_match",
  173. "for",
  174. "force",
  175. "foreach",
  176. "forever",
  177. "fork",
  178. "forkjoin",
  179. "function",
  180. "generate",
  181. "genvar",
  182. "global",
  183. "highz0",
  184. "highz1",
  185. "if",
  186. "iff",
  187. "ifnone",
  188. "ignore_bins",
  189. "illegal_bins",
  190. "implements",
  191. "implies",
  192. "import",
  193. "incdir",
  194. "include",
  195. "initial",
  196. "inout",
  197. "input",
  198. "inside",
  199. "instance",
  200. "int",
  201. "integer",
  202. "interconnect",
  203. "interface",
  204. "intersect",
  205. "join",
  206. "join_any",
  207. "join_none",
  208. "large",
  209. "let",
  210. "liblist",
  211. "library",
  212. "local",
  213. "localparam",
  214. "logic",
  215. "longint",
  216. "macromodule",
  217. "matches",
  218. "medium",
  219. "modport",
  220. "module",
  221. "nand",
  222. "negedge",
  223. "nettype",
  224. "new",
  225. "nexttime",
  226. "nmos",
  227. "nor",
  228. "noshowcancelled",
  229. "not",
  230. "notif0",
  231. "notif1",
  232. "null",
  233. "or",
  234. "output",
  235. "package",
  236. "packed",
  237. "parameter",
  238. "pmos",
  239. "posedge",
  240. "primitive",
  241. "priority",
  242. "program",
  243. "property",
  244. "protected",
  245. "pull0",
  246. "pull1",
  247. "pulldown",
  248. "pullup",
  249. "pulsestyle_ondetect",
  250. "pulsestyle_onevent",
  251. "pure",
  252. "rand",
  253. "randc",
  254. "randcase",
  255. "randsequence",
  256. "rcmos",
  257. "real",
  258. "realtime",
  259. "ref",
  260. "reg",
  261. "reject_on",
  262. "release",
  263. "repeat",
  264. "restrict",
  265. "return",
  266. "rnmos",
  267. "rpmos",
  268. "rtran",
  269. "rtranif0",
  270. "rtranif1",
  271. "s_always",
  272. "s_eventually",
  273. "s_nexttime",
  274. "s_until",
  275. "s_until_with",
  276. "scalared",
  277. "sequence",
  278. "shortint",
  279. "shortreal",
  280. "showcancelled",
  281. "signed",
  282. "small",
  283. "soft",
  284. "solve",
  285. "specify",
  286. "specparam",
  287. "static",
  288. "string",
  289. "strong",
  290. "strong0",
  291. "strong1",
  292. "struct",
  293. "super",
  294. "supply0",
  295. "supply1",
  296. "sync_accept_on",
  297. "sync_reject_on",
  298. "table",
  299. "tagged",
  300. "task",
  301. "this",
  302. "throughout",
  303. "time",
  304. "timeprecision",
  305. "timeunit",
  306. "tran",
  307. "tranif0",
  308. "tranif1",
  309. "tri",
  310. "tri0",
  311. "tri1",
  312. "triand",
  313. "trior",
  314. "trireg",
  315. "type",
  316. "typedef",
  317. "union",
  318. "unique",
  319. "unique0",
  320. "unsigned",
  321. "until",
  322. "until_with",
  323. "untyped",
  324. "use",
  325. "uwire",
  326. "var",
  327. "vectored",
  328. "virtual",
  329. "void",
  330. "wait",
  331. "wait_order",
  332. "wand",
  333. "weak",
  334. "weak0",
  335. "weak1",
  336. "while",
  337. "wildcard",
  338. "wire",
  339. "with",
  340. "within",
  341. "wor",
  342. "xnor",
  343. "xor"
  344. ],
  345. builtin_gates: [
  346. "and",
  347. "nand",
  348. "nor",
  349. "or",
  350. "xor",
  351. "xnor",
  352. "buf",
  353. "not",
  354. "bufif0",
  355. "bufif1",
  356. "notif1",
  357. "notif0",
  358. "cmos",
  359. "nmos",
  360. "pmos",
  361. "rcmos",
  362. "rnmos",
  363. "rpmos",
  364. "tran",
  365. "tranif1",
  366. "tranif0",
  367. "rtran",
  368. "rtranif1",
  369. "rtranif0"
  370. ],
  371. operators: [
  372. "=",
  373. "+=",
  374. "-=",
  375. "*=",
  376. "/=",
  377. "%=",
  378. "&=",
  379. "|=",
  380. "^=",
  381. "<<=",
  382. ">>+",
  383. "<<<=",
  384. ">>>=",
  385. "?",
  386. ":",
  387. "+",
  388. "-",
  389. "!",
  390. "~",
  391. "&",
  392. "~&",
  393. "|",
  394. "~|",
  395. "^",
  396. "~^",
  397. "^~",
  398. "+",
  399. "-",
  400. "*",
  401. "/",
  402. "%",
  403. "==",
  404. "!=",
  405. "===",
  406. "!==",
  407. "==?",
  408. "!=?",
  409. "&&",
  410. "||",
  411. "**",
  412. "<",
  413. "<=",
  414. ">",
  415. ">=",
  416. "&",
  417. "|",
  418. "^",
  419. ">>",
  420. "<<",
  421. ">>>",
  422. "<<<",
  423. "++",
  424. "--",
  425. "->",
  426. "<->",
  427. "inside",
  428. "dist",
  429. "::",
  430. "+:",
  431. "-:",
  432. "*>",
  433. "&&&",
  434. "|->",
  435. "|=>",
  436. "#=#"
  437. ],
  438. symbols: /[=><!~?:&|+\-*\/\^%#]+/,
  439. escapes: /%%|\\(?:[antvf\\"']|x[0-9A-Fa-f]{1,2}|[0-7]{1,3})/,
  440. identifier: /(?:[a-zA-Z_][a-zA-Z0-9_$\.]*|\\\S+ )/,
  441. systemcall: /[$][a-zA-Z0-9_]+/,
  442. timeunits: /s|ms|us|ns|ps|fs/,
  443. tokenizer: {
  444. root: [
  445. [
  446. /^(\s*)(@identifier)/,
  447. [
  448. "",
  449. {
  450. cases: {
  451. "@builtin_gates": {
  452. token: "keyword.$2",
  453. next: "@module_instance"
  454. },
  455. table: {
  456. token: "keyword.$2",
  457. next: "@table"
  458. },
  459. "@keywords": { token: "keyword.$2" },
  460. "@default": {
  461. token: "identifier",
  462. next: "@module_instance"
  463. }
  464. }
  465. }
  466. ]
  467. ],
  468. [/^\s*`include/, { token: "keyword.directive.include", next: "@include" }],
  469. [/^\s*`\s*\w+/, "keyword"],
  470. { include: "@identifier_or_keyword" },
  471. { include: "@whitespace" },
  472. [/\(\*.*\*\)/, "annotation"],
  473. [/@systemcall/, "variable.predefined"],
  474. [/[{}()\[\]]/, "@brackets"],
  475. [/[<>](?!@symbols)/, "@brackets"],
  476. [
  477. /@symbols/,
  478. {
  479. cases: {
  480. "@operators": "delimiter",
  481. "@default": ""
  482. }
  483. }
  484. ],
  485. { include: "@numbers" },
  486. [/[;,.]/, "delimiter"],
  487. { include: "@strings" }
  488. ],
  489. identifier_or_keyword: [
  490. [
  491. /@identifier/,
  492. {
  493. cases: {
  494. "@keywords": { token: "keyword.$0" },
  495. "@default": "identifier"
  496. }
  497. }
  498. ]
  499. ],
  500. numbers: [
  501. [/\d+?[\d_]*(?:\.[\d_]+)?[eE][\-+]?\d+/, "number.float"],
  502. [/\d+?[\d_]*\.[\d_]+(?:\s*@timeunits)?/, "number.float"],
  503. [/(?:\d+?[\d_]*\s*)?'[sS]?[dD]\s*[0-9xXzZ?]+?[0-9xXzZ?_]*/, "number"],
  504. [/(?:\d+?[\d_]*\s*)?'[sS]?[bB]\s*[0-1xXzZ?]+?[0-1xXzZ?_]*/, "number.binary"],
  505. [/(?:\d+?[\d_]*\s*)?'[sS]?[oO]\s*[0-7xXzZ?]+?[0-7xXzZ?_]*/, "number.octal"],
  506. [/(?:\d+?[\d_]*\s*)?'[sS]?[hH]\s*[0-9a-fA-FxXzZ?]+?[0-9a-fA-FxXzZ?_]*/, "number.hex"],
  507. [/1step/, "number"],
  508. [/[\dxXzZ]+?[\dxXzZ_]*(?:\s*@timeunits)?/, "number"],
  509. [/'[01xXzZ]+/, "number"]
  510. ],
  511. module_instance: [
  512. { include: "@whitespace" },
  513. [/(#?)(\()/, ["", { token: "@brackets", next: "@port_connection" }]],
  514. [/@identifier\s*[;={}\[\],]/, { token: "@rematch", next: "@pop" }],
  515. [/@symbols|[;={}\[\],]/, { token: "@rematch", next: "@pop" }],
  516. [/@identifier/, "type"],
  517. [/;/, "delimiter", "@pop"]
  518. ],
  519. port_connection: [
  520. { include: "@identifier_or_keyword" },
  521. { include: "@whitespace" },
  522. [/@systemcall/, "variable.predefined"],
  523. { include: "@numbers" },
  524. { include: "@strings" },
  525. [/[,]/, "delimiter"],
  526. [/\(/, "@brackets", "@port_connection"],
  527. [/\)/, "@brackets", "@pop"]
  528. ],
  529. whitespace: [
  530. [/[ \t\r\n]+/, ""],
  531. [/\/\*/, "comment", "@comment"],
  532. [/\/\/.*$/, "comment"]
  533. ],
  534. comment: [
  535. [/[^\/*]+/, "comment"],
  536. [/\*\//, "comment", "@pop"],
  537. [/[\/*]/, "comment"]
  538. ],
  539. strings: [
  540. [/"([^"\\]|\\.)*$/, "string.invalid"],
  541. [/"/, "string", "@string"]
  542. ],
  543. string: [
  544. [/[^\\"]+/, "string"],
  545. [/@escapes/, "string.escape"],
  546. [/\\./, "string.escape.invalid"],
  547. [/"/, "string", "@pop"]
  548. ],
  549. include: [
  550. [
  551. /(\s*)(")([\w*\/*]*)(.\w*)(")/,
  552. [
  553. "",
  554. "string.include.identifier",
  555. "string.include.identifier",
  556. "string.include.identifier",
  557. { token: "string.include.identifier", next: "@pop" }
  558. ]
  559. ],
  560. [
  561. /(\s*)(<)([\w*\/*]*)(.\w*)(>)/,
  562. [
  563. "",
  564. "string.include.identifier",
  565. "string.include.identifier",
  566. "string.include.identifier",
  567. { token: "string.include.identifier", next: "@pop" }
  568. ]
  569. ]
  570. ],
  571. table: [
  572. { include: "@whitespace" },
  573. [/[()]/, "@brackets"],
  574. [/[:;]/, "delimiter"],
  575. [/[01\-*?xXbBrRfFpPnN]/, "variable.predefined"],
  576. ["endtable", "keyword.endtable", "@pop"]
  577. ]
  578. }
  579. };
  580. return __toCommonJS(systemverilog_exports);
  581. })();
  582. return moduleExports;
  583. });