st.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  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/st/st", ["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/st/st.ts
  28. var st_exports = {};
  29. __export(st_exports, {
  30. conf: () => conf,
  31. language: () => language
  32. });
  33. var conf = {
  34. comments: {
  35. lineComment: "//",
  36. blockComment: ["(*", "*)"]
  37. },
  38. brackets: [
  39. ["{", "}"],
  40. ["[", "]"],
  41. ["(", ")"],
  42. ["var", "end_var"],
  43. ["var_input", "end_var"],
  44. ["var_output", "end_var"],
  45. ["var_in_out", "end_var"],
  46. ["var_temp", "end_var"],
  47. ["var_global", "end_var"],
  48. ["var_access", "end_var"],
  49. ["var_external", "end_var"],
  50. ["type", "end_type"],
  51. ["struct", "end_struct"],
  52. ["program", "end_program"],
  53. ["function", "end_function"],
  54. ["function_block", "end_function_block"],
  55. ["action", "end_action"],
  56. ["step", "end_step"],
  57. ["initial_step", "end_step"],
  58. ["transaction", "end_transaction"],
  59. ["configuration", "end_configuration"],
  60. ["tcp", "end_tcp"],
  61. ["recource", "end_recource"],
  62. ["channel", "end_channel"],
  63. ["library", "end_library"],
  64. ["folder", "end_folder"],
  65. ["binaries", "end_binaries"],
  66. ["includes", "end_includes"],
  67. ["sources", "end_sources"]
  68. ],
  69. autoClosingPairs: [
  70. { open: "[", close: "]" },
  71. { open: "{", close: "}" },
  72. { open: "(", close: ")" },
  73. { open: "/*", close: "*/" },
  74. { open: "'", close: "'", notIn: ["string_sq"] },
  75. { open: '"', close: '"', notIn: ["string_dq"] },
  76. { open: "var_input", close: "end_var" },
  77. { open: "var_output", close: "end_var" },
  78. { open: "var_in_out", close: "end_var" },
  79. { open: "var_temp", close: "end_var" },
  80. { open: "var_global", close: "end_var" },
  81. { open: "var_access", close: "end_var" },
  82. { open: "var_external", close: "end_var" },
  83. { open: "type", close: "end_type" },
  84. { open: "struct", close: "end_struct" },
  85. { open: "program", close: "end_program" },
  86. { open: "function", close: "end_function" },
  87. { open: "function_block", close: "end_function_block" },
  88. { open: "action", close: "end_action" },
  89. { open: "step", close: "end_step" },
  90. { open: "initial_step", close: "end_step" },
  91. { open: "transaction", close: "end_transaction" },
  92. { open: "configuration", close: "end_configuration" },
  93. { open: "tcp", close: "end_tcp" },
  94. { open: "recource", close: "end_recource" },
  95. { open: "channel", close: "end_channel" },
  96. { open: "library", close: "end_library" },
  97. { open: "folder", close: "end_folder" },
  98. { open: "binaries", close: "end_binaries" },
  99. { open: "includes", close: "end_includes" },
  100. { open: "sources", close: "end_sources" }
  101. ],
  102. surroundingPairs: [
  103. { open: "{", close: "}" },
  104. { open: "[", close: "]" },
  105. { open: "(", close: ")" },
  106. { open: '"', close: '"' },
  107. { open: "'", close: "'" },
  108. { open: "var", close: "end_var" },
  109. { open: "var_input", close: "end_var" },
  110. { open: "var_output", close: "end_var" },
  111. { open: "var_in_out", close: "end_var" },
  112. { open: "var_temp", close: "end_var" },
  113. { open: "var_global", close: "end_var" },
  114. { open: "var_access", close: "end_var" },
  115. { open: "var_external", close: "end_var" },
  116. { open: "type", close: "end_type" },
  117. { open: "struct", close: "end_struct" },
  118. { open: "program", close: "end_program" },
  119. { open: "function", close: "end_function" },
  120. { open: "function_block", close: "end_function_block" },
  121. { open: "action", close: "end_action" },
  122. { open: "step", close: "end_step" },
  123. { open: "initial_step", close: "end_step" },
  124. { open: "transaction", close: "end_transaction" },
  125. { open: "configuration", close: "end_configuration" },
  126. { open: "tcp", close: "end_tcp" },
  127. { open: "recource", close: "end_recource" },
  128. { open: "channel", close: "end_channel" },
  129. { open: "library", close: "end_library" },
  130. { open: "folder", close: "end_folder" },
  131. { open: "binaries", close: "end_binaries" },
  132. { open: "includes", close: "end_includes" },
  133. { open: "sources", close: "end_sources" }
  134. ],
  135. folding: {
  136. markers: {
  137. start: new RegExp("^\\s*#pragma\\s+region\\b"),
  138. end: new RegExp("^\\s*#pragma\\s+endregion\\b")
  139. }
  140. }
  141. };
  142. var language = {
  143. defaultToken: "",
  144. tokenPostfix: ".st",
  145. ignoreCase: true,
  146. brackets: [
  147. { token: "delimiter.curly", open: "{", close: "}" },
  148. { token: "delimiter.parenthesis", open: "(", close: ")" },
  149. { token: "delimiter.square", open: "[", close: "]" }
  150. ],
  151. keywords: [
  152. "if",
  153. "end_if",
  154. "elsif",
  155. "else",
  156. "case",
  157. "of",
  158. "to",
  159. "__try",
  160. "__catch",
  161. "__finally",
  162. "do",
  163. "with",
  164. "by",
  165. "while",
  166. "repeat",
  167. "end_while",
  168. "end_repeat",
  169. "end_case",
  170. "for",
  171. "end_for",
  172. "task",
  173. "retain",
  174. "non_retain",
  175. "constant",
  176. "with",
  177. "at",
  178. "exit",
  179. "return",
  180. "interval",
  181. "priority",
  182. "address",
  183. "port",
  184. "on_channel",
  185. "then",
  186. "iec",
  187. "file",
  188. "uses",
  189. "version",
  190. "packagetype",
  191. "displayname",
  192. "copyright",
  193. "summary",
  194. "vendor",
  195. "common_source",
  196. "from",
  197. "extends"
  198. ],
  199. constant: ["false", "true", "null"],
  200. defineKeywords: [
  201. "var",
  202. "var_input",
  203. "var_output",
  204. "var_in_out",
  205. "var_temp",
  206. "var_global",
  207. "var_access",
  208. "var_external",
  209. "end_var",
  210. "type",
  211. "end_type",
  212. "struct",
  213. "end_struct",
  214. "program",
  215. "end_program",
  216. "function",
  217. "end_function",
  218. "function_block",
  219. "end_function_block",
  220. "interface",
  221. "end_interface",
  222. "method",
  223. "end_method",
  224. "property",
  225. "end_property",
  226. "namespace",
  227. "end_namespace",
  228. "configuration",
  229. "end_configuration",
  230. "tcp",
  231. "end_tcp",
  232. "resource",
  233. "end_resource",
  234. "channel",
  235. "end_channel",
  236. "library",
  237. "end_library",
  238. "folder",
  239. "end_folder",
  240. "binaries",
  241. "end_binaries",
  242. "includes",
  243. "end_includes",
  244. "sources",
  245. "end_sources",
  246. "action",
  247. "end_action",
  248. "step",
  249. "initial_step",
  250. "end_step",
  251. "transaction",
  252. "end_transaction"
  253. ],
  254. typeKeywords: [
  255. "int",
  256. "sint",
  257. "dint",
  258. "lint",
  259. "usint",
  260. "uint",
  261. "udint",
  262. "ulint",
  263. "real",
  264. "lreal",
  265. "time",
  266. "date",
  267. "time_of_day",
  268. "date_and_time",
  269. "string",
  270. "bool",
  271. "byte",
  272. "word",
  273. "dword",
  274. "array",
  275. "pointer",
  276. "lword"
  277. ],
  278. operators: [
  279. "=",
  280. ">",
  281. "<",
  282. ":",
  283. ":=",
  284. "<=",
  285. ">=",
  286. "<>",
  287. "&",
  288. "+",
  289. "-",
  290. "*",
  291. "**",
  292. "MOD",
  293. "^",
  294. "or",
  295. "and",
  296. "not",
  297. "xor",
  298. "abs",
  299. "acos",
  300. "asin",
  301. "atan",
  302. "cos",
  303. "exp",
  304. "expt",
  305. "ln",
  306. "log",
  307. "sin",
  308. "sqrt",
  309. "tan",
  310. "sel",
  311. "max",
  312. "min",
  313. "limit",
  314. "mux",
  315. "shl",
  316. "shr",
  317. "rol",
  318. "ror",
  319. "indexof",
  320. "sizeof",
  321. "adr",
  322. "adrinst",
  323. "bitadr",
  324. "is_valid",
  325. "ref",
  326. "ref_to"
  327. ],
  328. builtinVariables: [],
  329. builtinFunctions: [
  330. "sr",
  331. "rs",
  332. "tp",
  333. "ton",
  334. "tof",
  335. "eq",
  336. "ge",
  337. "le",
  338. "lt",
  339. "ne",
  340. "round",
  341. "trunc",
  342. "ctd",
  343. "\u0441tu",
  344. "ctud",
  345. "r_trig",
  346. "f_trig",
  347. "move",
  348. "concat",
  349. "delete",
  350. "find",
  351. "insert",
  352. "left",
  353. "len",
  354. "replace",
  355. "right",
  356. "rtc"
  357. ],
  358. symbols: /[=><!~?:&|+\-*\/\^%]+/,
  359. escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  360. tokenizer: {
  361. root: [
  362. [/(\.\.)/, "delimiter"],
  363. [/\b(16#[0-9A-Fa-f\_]*)+\b/, "number.hex"],
  364. [/\b(2#[01\_]+)+\b/, "number.binary"],
  365. [/\b(8#[0-9\_]*)+\b/, "number.octal"],
  366. [/\b\d*\.\d+([eE][\-+]?\d+)?\b/, "number.float"],
  367. [/\b(L?REAL)#[0-9\_\.e]+\b/, "number.float"],
  368. [/\b(BYTE|(?:D|L)?WORD|U?(?:S|D|L)?INT)#[0-9\_]+\b/, "number"],
  369. [/\d+/, "number"],
  370. [/\b(T|DT|TOD)#[0-9:-_shmyd]+\b/, "tag"],
  371. [/\%(I|Q|M)(X|B|W|D|L)[0-9\.]+/, "tag"],
  372. [/\%(I|Q|M)[0-9\.]*/, "tag"],
  373. [/\b[A-Za-z]{1,6}#[0-9]+\b/, "tag"],
  374. [/\b(TO_|CTU_|CTD_|CTUD_|MUX_|SEL_)[A_Za-z]+\b/, "predefined"],
  375. [/\b[A_Za-z]+(_TO_)[A_Za-z]+\b/, "predefined"],
  376. [/[;]/, "delimiter"],
  377. [/[.]/, { token: "delimiter", next: "@params" }],
  378. [
  379. /[a-zA-Z_]\w*/,
  380. {
  381. cases: {
  382. "@operators": "operators",
  383. "@keywords": "keyword",
  384. "@typeKeywords": "type",
  385. "@defineKeywords": "variable",
  386. "@constant": "constant",
  387. "@builtinVariables": "predefined",
  388. "@builtinFunctions": "predefined",
  389. "@default": "identifier"
  390. }
  391. }
  392. ],
  393. { include: "@whitespace" },
  394. [/[{}()\[\]]/, "@brackets"],
  395. [/"([^"\\]|\\.)*$/, "string.invalid"],
  396. [/"/, { token: "string.quote", bracket: "@open", next: "@string_dq" }],
  397. [/'/, { token: "string.quote", bracket: "@open", next: "@string_sq" }],
  398. [/'[^\\']'/, "string"],
  399. [/(')(@escapes)(')/, ["string", "string.escape", "string"]],
  400. [/'/, "string.invalid"]
  401. ],
  402. params: [
  403. [/\b[A-Za-z0-9_]+\b(?=\()/, { token: "identifier", next: "@pop" }],
  404. [/\b[A-Za-z0-9_]+\b/, "variable.name", "@pop"]
  405. ],
  406. comment: [
  407. [/[^\/*]+/, "comment"],
  408. [/\/\*/, "comment", "@push"],
  409. ["\\*/", "comment", "@pop"],
  410. [/[\/*]/, "comment"]
  411. ],
  412. comment2: [
  413. [/[^\(*]+/, "comment"],
  414. [/\(\*/, "comment", "@push"],
  415. ["\\*\\)", "comment", "@pop"],
  416. [/[\(*]/, "comment"]
  417. ],
  418. whitespace: [
  419. [/[ \t\r\n]+/, "white"],
  420. [/\/\/.*$/, "comment"],
  421. [/\/\*/, "comment", "@comment"],
  422. [/\(\*/, "comment", "@comment2"]
  423. ],
  424. string_dq: [
  425. [/[^\\"]+/, "string"],
  426. [/@escapes/, "string.escape"],
  427. [/\\./, "string.escape.invalid"],
  428. [/"/, { token: "string.quote", bracket: "@close", next: "@pop" }]
  429. ],
  430. string_sq: [
  431. [/[^\\']+/, "string"],
  432. [/@escapes/, "string.escape"],
  433. [/\\./, "string.escape.invalid"],
  434. [/'/, { token: "string.quote", bracket: "@close", next: "@pop" }]
  435. ]
  436. }
  437. };
  438. return __toCommonJS(st_exports);
  439. })();
  440. return moduleExports;
  441. });