postiats.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. "use strict";
  2. /*!-----------------------------------------------------------------------------
  3. * Copyright (c) Microsoft Corporation. All rights reserved.
  4. * Version: 0.34.1(547870b6881302c5b4ff32173c16d06009e3588f)
  5. * Released under the MIT license
  6. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  7. *-----------------------------------------------------------------------------*/
  8. define("vs/basic-languages/postiats/postiats", ["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/postiats/postiats.ts
  28. var postiats_exports = {};
  29. __export(postiats_exports, {
  30. conf: () => conf,
  31. language: () => language
  32. });
  33. var conf = {
  34. comments: {
  35. lineComment: "//",
  36. blockComment: ["(*", "*)"]
  37. },
  38. brackets: [
  39. ["{", "}"],
  40. ["[", "]"],
  41. ["(", ")"],
  42. ["<", ">"]
  43. ],
  44. autoClosingPairs: [
  45. { open: '"', close: '"', notIn: ["string", "comment"] },
  46. { open: "{", close: "}", notIn: ["string", "comment"] },
  47. { open: "[", close: "]", notIn: ["string", "comment"] },
  48. { open: "(", close: ")", notIn: ["string", "comment"] }
  49. ]
  50. };
  51. var language = {
  52. tokenPostfix: ".pats",
  53. defaultToken: "invalid",
  54. keywords: [
  55. "abstype",
  56. "abst0ype",
  57. "absprop",
  58. "absview",
  59. "absvtype",
  60. "absviewtype",
  61. "absvt0ype",
  62. "absviewt0ype",
  63. "as",
  64. "and",
  65. "assume",
  66. "begin",
  67. "classdec",
  68. "datasort",
  69. "datatype",
  70. "dataprop",
  71. "dataview",
  72. "datavtype",
  73. "dataviewtype",
  74. "do",
  75. "end",
  76. "extern",
  77. "extype",
  78. "extvar",
  79. "exception",
  80. "fn",
  81. "fnx",
  82. "fun",
  83. "prfn",
  84. "prfun",
  85. "praxi",
  86. "castfn",
  87. "if",
  88. "then",
  89. "else",
  90. "ifcase",
  91. "in",
  92. "infix",
  93. "infixl",
  94. "infixr",
  95. "prefix",
  96. "postfix",
  97. "implmnt",
  98. "implement",
  99. "primplmnt",
  100. "primplement",
  101. "import",
  102. "let",
  103. "local",
  104. "macdef",
  105. "macrodef",
  106. "nonfix",
  107. "symelim",
  108. "symintr",
  109. "overload",
  110. "of",
  111. "op",
  112. "rec",
  113. "sif",
  114. "scase",
  115. "sortdef",
  116. "sta",
  117. "stacst",
  118. "stadef",
  119. "static",
  120. "staload",
  121. "dynload",
  122. "try",
  123. "tkindef",
  124. "typedef",
  125. "propdef",
  126. "viewdef",
  127. "vtypedef",
  128. "viewtypedef",
  129. "prval",
  130. "var",
  131. "prvar",
  132. "when",
  133. "where",
  134. "with",
  135. "withtype",
  136. "withprop",
  137. "withview",
  138. "withvtype",
  139. "withviewtype"
  140. ],
  141. keywords_dlr: [
  142. "$delay",
  143. "$ldelay",
  144. "$arrpsz",
  145. "$arrptrsize",
  146. "$d2ctype",
  147. "$effmask",
  148. "$effmask_ntm",
  149. "$effmask_exn",
  150. "$effmask_ref",
  151. "$effmask_wrt",
  152. "$effmask_all",
  153. "$extern",
  154. "$extkind",
  155. "$extype",
  156. "$extype_struct",
  157. "$extval",
  158. "$extfcall",
  159. "$extmcall",
  160. "$literal",
  161. "$myfilename",
  162. "$mylocation",
  163. "$myfunction",
  164. "$lst",
  165. "$lst_t",
  166. "$lst_vt",
  167. "$list",
  168. "$list_t",
  169. "$list_vt",
  170. "$rec",
  171. "$rec_t",
  172. "$rec_vt",
  173. "$record",
  174. "$record_t",
  175. "$record_vt",
  176. "$tup",
  177. "$tup_t",
  178. "$tup_vt",
  179. "$tuple",
  180. "$tuple_t",
  181. "$tuple_vt",
  182. "$break",
  183. "$continue",
  184. "$raise",
  185. "$showtype",
  186. "$vcopyenv_v",
  187. "$vcopyenv_vt",
  188. "$tempenver",
  189. "$solver_assert",
  190. "$solver_verify"
  191. ],
  192. keywords_srp: [
  193. "#if",
  194. "#ifdef",
  195. "#ifndef",
  196. "#then",
  197. "#elif",
  198. "#elifdef",
  199. "#elifndef",
  200. "#else",
  201. "#endif",
  202. "#error",
  203. "#prerr",
  204. "#print",
  205. "#assert",
  206. "#undef",
  207. "#define",
  208. "#include",
  209. "#require",
  210. "#pragma",
  211. "#codegen2",
  212. "#codegen3"
  213. ],
  214. irregular_keyword_list: [
  215. "val+",
  216. "val-",
  217. "val",
  218. "case+",
  219. "case-",
  220. "case",
  221. "addr@",
  222. "addr",
  223. "fold@",
  224. "free@",
  225. "fix@",
  226. "fix",
  227. "lam@",
  228. "lam",
  229. "llam@",
  230. "llam",
  231. "viewt@ype+",
  232. "viewt@ype-",
  233. "viewt@ype",
  234. "viewtype+",
  235. "viewtype-",
  236. "viewtype",
  237. "view+",
  238. "view-",
  239. "view@",
  240. "view",
  241. "type+",
  242. "type-",
  243. "type",
  244. "vtype+",
  245. "vtype-",
  246. "vtype",
  247. "vt@ype+",
  248. "vt@ype-",
  249. "vt@ype",
  250. "viewt@ype+",
  251. "viewt@ype-",
  252. "viewt@ype",
  253. "viewtype+",
  254. "viewtype-",
  255. "viewtype",
  256. "prop+",
  257. "prop-",
  258. "prop",
  259. "type+",
  260. "type-",
  261. "type",
  262. "t@ype",
  263. "t@ype+",
  264. "t@ype-",
  265. "abst@ype",
  266. "abstype",
  267. "absviewt@ype",
  268. "absvt@ype",
  269. "for*",
  270. "for",
  271. "while*",
  272. "while"
  273. ],
  274. keywords_types: [
  275. "bool",
  276. "double",
  277. "byte",
  278. "int",
  279. "short",
  280. "char",
  281. "void",
  282. "unit",
  283. "long",
  284. "float",
  285. "string",
  286. "strptr"
  287. ],
  288. keywords_effects: [
  289. "0",
  290. "fun",
  291. "clo",
  292. "prf",
  293. "funclo",
  294. "cloptr",
  295. "cloref",
  296. "ref",
  297. "ntm",
  298. "1"
  299. ],
  300. operators: [
  301. "@",
  302. "!",
  303. "|",
  304. "`",
  305. ":",
  306. "$",
  307. ".",
  308. "=",
  309. "#",
  310. "~",
  311. "..",
  312. "...",
  313. "=>",
  314. "=<>",
  315. "=/=>",
  316. "=>>",
  317. "=/=>>",
  318. "<",
  319. ">",
  320. "><",
  321. ".<",
  322. ">.",
  323. ".<>.",
  324. "->",
  325. "-<>"
  326. ],
  327. brackets: [
  328. { open: ",(", close: ")", token: "delimiter.parenthesis" },
  329. { open: "`(", close: ")", token: "delimiter.parenthesis" },
  330. { open: "%(", close: ")", token: "delimiter.parenthesis" },
  331. { open: "'(", close: ")", token: "delimiter.parenthesis" },
  332. { open: "'{", close: "}", token: "delimiter.parenthesis" },
  333. { open: "@(", close: ")", token: "delimiter.parenthesis" },
  334. { open: "@{", close: "}", token: "delimiter.brace" },
  335. { open: "@[", close: "]", token: "delimiter.square" },
  336. { open: "#[", close: "]", token: "delimiter.square" },
  337. { open: "{", close: "}", token: "delimiter.curly" },
  338. { open: "[", close: "]", token: "delimiter.square" },
  339. { open: "(", close: ")", token: "delimiter.parenthesis" },
  340. { open: "<", close: ">", token: "delimiter.angle" }
  341. ],
  342. symbols: /[=><!~?:&|+\-*\/\^%]+/,
  343. IDENTFST: /[a-zA-Z_]/,
  344. IDENTRST: /[a-zA-Z0-9_'$]/,
  345. symbolic: /[%&+-./:=@~`^|*!$#?<>]/,
  346. digit: /[0-9]/,
  347. digitseq0: /@digit*/,
  348. xdigit: /[0-9A-Za-z]/,
  349. xdigitseq0: /@xdigit*/,
  350. INTSP: /[lLuU]/,
  351. FLOATSP: /[fFlL]/,
  352. fexponent: /[eE][+-]?[0-9]+/,
  353. fexponent_bin: /[pP][+-]?[0-9]+/,
  354. deciexp: /\.[0-9]*@fexponent?/,
  355. hexiexp: /\.[0-9a-zA-Z]*@fexponent_bin?/,
  356. irregular_keywords: /val[+-]?|case[+-]?|addr\@?|fold\@|free\@|fix\@?|lam\@?|llam\@?|prop[+-]?|type[+-]?|view[+-@]?|viewt@?ype[+-]?|t@?ype[+-]?|v(iew)?t@?ype[+-]?|abst@?ype|absv(iew)?t@?ype|for\*?|while\*?/,
  357. ESCHAR: /[ntvbrfa\\\?'"\(\[\{]/,
  358. start: "root",
  359. tokenizer: {
  360. root: [
  361. { regex: /[ \t\r\n]+/, action: { token: "" } },
  362. { regex: /\(\*\)/, action: { token: "invalid" } },
  363. {
  364. regex: /\(\*/,
  365. action: { token: "comment", next: "lexing_COMMENT_block_ml" }
  366. },
  367. {
  368. regex: /\(/,
  369. action: "@brackets"
  370. },
  371. {
  372. regex: /\)/,
  373. action: "@brackets"
  374. },
  375. {
  376. regex: /\[/,
  377. action: "@brackets"
  378. },
  379. {
  380. regex: /\]/,
  381. action: "@brackets"
  382. },
  383. {
  384. regex: /\{/,
  385. action: "@brackets"
  386. },
  387. {
  388. regex: /\}/,
  389. action: "@brackets"
  390. },
  391. {
  392. regex: /,\(/,
  393. action: "@brackets"
  394. },
  395. { regex: /,/, action: { token: "delimiter.comma" } },
  396. { regex: /;/, action: { token: "delimiter.semicolon" } },
  397. {
  398. regex: /@\(/,
  399. action: "@brackets"
  400. },
  401. {
  402. regex: /@\[/,
  403. action: "@brackets"
  404. },
  405. {
  406. regex: /@\{/,
  407. action: "@brackets"
  408. },
  409. {
  410. regex: /:</,
  411. action: { token: "keyword", next: "@lexing_EFFECT_commaseq0" }
  412. },
  413. { regex: /\.@symbolic+/, action: { token: "identifier.sym" } },
  414. {
  415. regex: /\.@digit*@fexponent@FLOATSP*/,
  416. action: { token: "number.float" }
  417. },
  418. { regex: /\.@digit+/, action: { token: "number.float" } },
  419. {
  420. regex: /\$@IDENTFST@IDENTRST*/,
  421. action: {
  422. cases: {
  423. "@keywords_dlr": { token: "keyword.dlr" },
  424. "@default": { token: "namespace" }
  425. }
  426. }
  427. },
  428. {
  429. regex: /\#@IDENTFST@IDENTRST*/,
  430. action: {
  431. cases: {
  432. "@keywords_srp": { token: "keyword.srp" },
  433. "@default": { token: "identifier" }
  434. }
  435. }
  436. },
  437. { regex: /%\(/, action: { token: "delimiter.parenthesis" } },
  438. {
  439. regex: /^%{(#|\^|\$)?/,
  440. action: {
  441. token: "keyword",
  442. next: "@lexing_EXTCODE",
  443. nextEmbedded: "text/javascript"
  444. }
  445. },
  446. { regex: /^%}/, action: { token: "keyword" } },
  447. { regex: /'\(/, action: { token: "delimiter.parenthesis" } },
  448. { regex: /'\[/, action: { token: "delimiter.bracket" } },
  449. { regex: /'\{/, action: { token: "delimiter.brace" } },
  450. [/(')(\\@ESCHAR|\\[xX]@xdigit+|\\@digit+)(')/, ["string", "string.escape", "string"]],
  451. [/'[^\\']'/, "string"],
  452. [/"/, "string.quote", "@lexing_DQUOTE"],
  453. {
  454. regex: /`\(/,
  455. action: "@brackets"
  456. },
  457. { regex: /\\/, action: { token: "punctuation" } },
  458. {
  459. regex: /@irregular_keywords(?!@IDENTRST)/,
  460. action: { token: "keyword" }
  461. },
  462. {
  463. regex: /@IDENTFST@IDENTRST*[<!\[]?/,
  464. action: {
  465. cases: {
  466. "@keywords": { token: "keyword" },
  467. "@keywords_types": { token: "type" },
  468. "@default": { token: "identifier" }
  469. }
  470. }
  471. },
  472. {
  473. regex: /\/\/\/\//,
  474. action: { token: "comment", next: "@lexing_COMMENT_rest" }
  475. },
  476. { regex: /\/\/.*$/, action: { token: "comment" } },
  477. {
  478. regex: /\/\*/,
  479. action: { token: "comment", next: "@lexing_COMMENT_block_c" }
  480. },
  481. {
  482. regex: /-<|=</,
  483. action: { token: "keyword", next: "@lexing_EFFECT_commaseq0" }
  484. },
  485. {
  486. regex: /@symbolic+/,
  487. action: {
  488. cases: {
  489. "@operators": "keyword",
  490. "@default": "operator"
  491. }
  492. }
  493. },
  494. {
  495. regex: /0[xX]@xdigit+(@hexiexp|@fexponent_bin)@FLOATSP*/,
  496. action: { token: "number.float" }
  497. },
  498. { regex: /0[xX]@xdigit+@INTSP*/, action: { token: "number.hex" } },
  499. {
  500. regex: /0[0-7]+(?![0-9])@INTSP*/,
  501. action: { token: "number.octal" }
  502. },
  503. {
  504. regex: /@digit+(@fexponent|@deciexp)@FLOATSP*/,
  505. action: { token: "number.float" }
  506. },
  507. {
  508. regex: /@digit@digitseq0@INTSP*/,
  509. action: { token: "number.decimal" }
  510. },
  511. { regex: /@digit+@INTSP*/, action: { token: "number" } }
  512. ],
  513. lexing_COMMENT_block_ml: [
  514. [/[^\(\*]+/, "comment"],
  515. [/\(\*/, "comment", "@push"],
  516. [/\(\*/, "comment.invalid"],
  517. [/\*\)/, "comment", "@pop"],
  518. [/\*/, "comment"]
  519. ],
  520. lexing_COMMENT_block_c: [
  521. [/[^\/*]+/, "comment"],
  522. [/\*\//, "comment", "@pop"],
  523. [/[\/*]/, "comment"]
  524. ],
  525. lexing_COMMENT_rest: [
  526. [/$/, "comment", "@pop"],
  527. [/.*/, "comment"]
  528. ],
  529. lexing_EFFECT_commaseq0: [
  530. {
  531. regex: /@IDENTFST@IDENTRST+|@digit+/,
  532. action: {
  533. cases: {
  534. "@keywords_effects": { token: "type.effect" },
  535. "@default": { token: "identifier" }
  536. }
  537. }
  538. },
  539. { regex: /,/, action: { token: "punctuation" } },
  540. { regex: />/, action: { token: "@rematch", next: "@pop" } }
  541. ],
  542. lexing_EXTCODE: [
  543. {
  544. regex: /^%}/,
  545. action: {
  546. token: "@rematch",
  547. next: "@pop",
  548. nextEmbedded: "@pop"
  549. }
  550. },
  551. { regex: /[^%]+/, action: "" }
  552. ],
  553. lexing_DQUOTE: [
  554. { regex: /"/, action: { token: "string.quote", next: "@pop" } },
  555. {
  556. regex: /(\{\$)(@IDENTFST@IDENTRST*)(\})/,
  557. action: [{ token: "string.escape" }, { token: "identifier" }, { token: "string.escape" }]
  558. },
  559. { regex: /\\$/, action: { token: "string.escape" } },
  560. {
  561. regex: /\\(@ESCHAR|[xX]@xdigit+|@digit+)/,
  562. action: { token: "string.escape" }
  563. },
  564. { regex: /[^\\"]+/, action: { token: "string" } }
  565. ]
  566. }
  567. };
  568. return __toCommonJS(postiats_exports);
  569. })();
  570. return moduleExports;
  571. });