sophia.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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/sophia/sophia", ["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/sophia/sophia.ts
  28. var sophia_exports = {};
  29. __export(sophia_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. defaultToken: "",
  53. tokenPostfix: ".aes",
  54. brackets: [
  55. { token: "delimiter.curly", open: "{", close: "}" },
  56. { token: "delimiter.parenthesis", open: "(", close: ")" },
  57. { token: "delimiter.square", open: "[", close: "]" },
  58. { token: "delimiter.angle", open: "<", close: ">" }
  59. ],
  60. keywords: [
  61. "contract",
  62. "library",
  63. "entrypoint",
  64. "function",
  65. "stateful",
  66. "state",
  67. "hash",
  68. "signature",
  69. "tuple",
  70. "list",
  71. "address",
  72. "string",
  73. "bool",
  74. "int",
  75. "record",
  76. "datatype",
  77. "type",
  78. "option",
  79. "oracle",
  80. "oracle_query",
  81. "Call",
  82. "Bits",
  83. "Bytes",
  84. "Oracle",
  85. "String",
  86. "Crypto",
  87. "Address",
  88. "Auth",
  89. "Chain",
  90. "None",
  91. "Some",
  92. "bits",
  93. "bytes",
  94. "event",
  95. "let",
  96. "map",
  97. "private",
  98. "public",
  99. "true",
  100. "false",
  101. "var",
  102. "if",
  103. "else",
  104. "throw"
  105. ],
  106. operators: [
  107. "=",
  108. ">",
  109. "<",
  110. "!",
  111. "~",
  112. "?",
  113. "::",
  114. ":",
  115. "==",
  116. "<=",
  117. ">=",
  118. "!=",
  119. "&&",
  120. "||",
  121. "++",
  122. "--",
  123. "+",
  124. "-",
  125. "*",
  126. "/",
  127. "&",
  128. "|",
  129. "^",
  130. "%",
  131. "<<",
  132. ">>",
  133. ">>>",
  134. "+=",
  135. "-=",
  136. "*=",
  137. "/=",
  138. "&=",
  139. "|=",
  140. "^=",
  141. "%=",
  142. "<<=",
  143. ">>=",
  144. ">>>="
  145. ],
  146. symbols: /[=><!~?:&|+\-*\/\^%]+/,
  147. escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  148. integersuffix: /(ll|LL|u|U|l|L)?(ll|LL|u|U|l|L)?/,
  149. floatsuffix: /[fFlL]?/,
  150. tokenizer: {
  151. root: [
  152. [
  153. /[a-zA-Z_]\w*/,
  154. {
  155. cases: {
  156. "@keywords": { token: "keyword.$0" },
  157. "@default": "identifier"
  158. }
  159. }
  160. ],
  161. { include: "@whitespace" },
  162. [/\[\[.*\]\]/, "annotation"],
  163. [/^\s*#\w+/, "keyword"],
  164. [/int\d*/, "keyword"],
  165. [/[{}()\[\]]/, "@brackets"],
  166. [/[<>](?!@symbols)/, "@brackets"],
  167. [
  168. /@symbols/,
  169. {
  170. cases: {
  171. "@operators": "delimiter",
  172. "@default": ""
  173. }
  174. }
  175. ],
  176. [/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/, "number.float"],
  177. [/\d*\.\d+([eE][\-+]?\d+)?(@floatsuffix)/, "number.float"],
  178. [/0[xX][0-9a-fA-F']*[0-9a-fA-F](@integersuffix)/, "number.hex"],
  179. [/0[0-7']*[0-7](@integersuffix)/, "number.octal"],
  180. [/0[bB][0-1']*[0-1](@integersuffix)/, "number.binary"],
  181. [/\d[\d']*\d(@integersuffix)/, "number"],
  182. [/\d(@integersuffix)/, "number"],
  183. [/[;,.]/, "delimiter"],
  184. [/"([^"\\]|\\.)*$/, "string.invalid"],
  185. [/"/, "string", "@string"],
  186. [/'[^\\']'/, "string"],
  187. [/(')(@escapes)(')/, ["string", "string.escape", "string"]],
  188. [/'/, "string.invalid"]
  189. ],
  190. whitespace: [
  191. [/[ \t\r\n]+/, ""],
  192. [/\/\*\*(?!\/)/, "comment.doc", "@doccomment"],
  193. [/\/\*/, "comment", "@comment"],
  194. [/\/\/.*$/, "comment"]
  195. ],
  196. comment: [
  197. [/[^\/*]+/, "comment"],
  198. [/\*\//, "comment", "@pop"],
  199. [/[\/*]/, "comment"]
  200. ],
  201. doccomment: [
  202. [/[^\/*]+/, "comment.doc"],
  203. [/\*\//, "comment.doc", "@pop"],
  204. [/[\/*]/, "comment.doc"]
  205. ],
  206. string: [
  207. [/[^\\"]+/, "string"],
  208. [/@escapes/, "string.escape"],
  209. [/\\./, "string.escape.invalid"],
  210. [/"/, "string", "@pop"]
  211. ]
  212. }
  213. };
  214. return __toCommonJS(sophia_exports);
  215. })();
  216. return moduleExports;
  217. });