pascaligo.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /*!-----------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Version: 0.31.1(337587859b1c171314b40503171188b6cea6a32a)
  4. * Released under the MIT license
  5. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  6. *-----------------------------------------------------------------------------*/
  7. // src/basic-languages/pascaligo/pascaligo.ts
  8. var conf = {
  9. comments: {
  10. lineComment: "//",
  11. blockComment: ["(*", "*)"]
  12. },
  13. brackets: [
  14. ["{", "}"],
  15. ["[", "]"],
  16. ["(", ")"],
  17. ["<", ">"]
  18. ],
  19. autoClosingPairs: [
  20. { open: "{", close: "}" },
  21. { open: "[", close: "]" },
  22. { open: "(", close: ")" },
  23. { open: "<", close: ">" },
  24. { open: "'", close: "'" }
  25. ],
  26. surroundingPairs: [
  27. { open: "{", close: "}" },
  28. { open: "[", close: "]" },
  29. { open: "(", close: ")" },
  30. { open: "<", close: ">" },
  31. { open: "'", close: "'" }
  32. ]
  33. };
  34. var language = {
  35. defaultToken: "",
  36. tokenPostfix: ".pascaligo",
  37. ignoreCase: true,
  38. brackets: [
  39. { open: "{", close: "}", token: "delimiter.curly" },
  40. { open: "[", close: "]", token: "delimiter.square" },
  41. { open: "(", close: ")", token: "delimiter.parenthesis" },
  42. { open: "<", close: ">", token: "delimiter.angle" }
  43. ],
  44. keywords: [
  45. "begin",
  46. "block",
  47. "case",
  48. "const",
  49. "else",
  50. "end",
  51. "fail",
  52. "for",
  53. "from",
  54. "function",
  55. "if",
  56. "is",
  57. "nil",
  58. "of",
  59. "remove",
  60. "return",
  61. "skip",
  62. "then",
  63. "type",
  64. "var",
  65. "while",
  66. "with",
  67. "option",
  68. "None",
  69. "transaction"
  70. ],
  71. typeKeywords: [
  72. "bool",
  73. "int",
  74. "list",
  75. "map",
  76. "nat",
  77. "record",
  78. "string",
  79. "unit",
  80. "address",
  81. "map",
  82. "mtz",
  83. "xtz"
  84. ],
  85. operators: [
  86. "=",
  87. ">",
  88. "<",
  89. "<=",
  90. ">=",
  91. "<>",
  92. ":",
  93. ":=",
  94. "and",
  95. "mod",
  96. "or",
  97. "+",
  98. "-",
  99. "*",
  100. "/",
  101. "@",
  102. "&",
  103. "^",
  104. "%"
  105. ],
  106. symbols: /[=><:@\^&|+\-*\/\^%]+/,
  107. tokenizer: {
  108. root: [
  109. [
  110. /[a-zA-Z_][\w]*/,
  111. {
  112. cases: {
  113. "@keywords": { token: "keyword.$0" },
  114. "@default": "identifier"
  115. }
  116. }
  117. ],
  118. { include: "@whitespace" },
  119. [/[{}()\[\]]/, "@brackets"],
  120. [/[<>](?!@symbols)/, "@brackets"],
  121. [
  122. /@symbols/,
  123. {
  124. cases: {
  125. "@operators": "delimiter",
  126. "@default": ""
  127. }
  128. }
  129. ],
  130. [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"],
  131. [/\$[0-9a-fA-F]{1,16}/, "number.hex"],
  132. [/\d+/, "number"],
  133. [/[;,.]/, "delimiter"],
  134. [/'([^'\\]|\\.)*$/, "string.invalid"],
  135. [/'/, "string", "@string"],
  136. [/'[^\\']'/, "string"],
  137. [/'/, "string.invalid"],
  138. [/\#\d+/, "string"]
  139. ],
  140. comment: [
  141. [/[^\(\*]+/, "comment"],
  142. [/\*\)/, "comment", "@pop"],
  143. [/\(\*/, "comment"]
  144. ],
  145. string: [
  146. [/[^\\']+/, "string"],
  147. [/\\./, "string.escape.invalid"],
  148. [/'/, { token: "string.quote", bracket: "@close", next: "@pop" }]
  149. ],
  150. whitespace: [
  151. [/[ \t\r\n]+/, "white"],
  152. [/\(\*/, "comment", "@comment"],
  153. [/\/\/.*$/, "comment"]
  154. ]
  155. }
  156. };
  157. export {
  158. conf,
  159. language
  160. };