sophia.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. define("vs/basic-languages/sophia/sophia",[],()=>{
  8. var moduleExports = (() => {
  9. var __defProp = Object.defineProperty;
  10. var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
  11. var __export = (target, all) => {
  12. __markAsModule(target);
  13. for (var name in all)
  14. __defProp(target, name, { get: all[name], enumerable: true });
  15. };
  16. // src/basic-languages/sophia/sophia.ts
  17. var sophia_exports = {};
  18. __export(sophia_exports, {
  19. conf: () => conf,
  20. language: () => language
  21. });
  22. var conf = {
  23. comments: {
  24. lineComment: "//",
  25. blockComment: ["/*", "*/"]
  26. },
  27. brackets: [
  28. ["{", "}"],
  29. ["[", "]"],
  30. ["(", ")"],
  31. ["<", ">"]
  32. ],
  33. autoClosingPairs: [
  34. { open: '"', close: '"', notIn: ["string", "comment"] },
  35. { open: "{", close: "}", notIn: ["string", "comment"] },
  36. { open: "[", close: "]", notIn: ["string", "comment"] },
  37. { open: "(", close: ")", notIn: ["string", "comment"] }
  38. ]
  39. };
  40. var language = {
  41. defaultToken: "",
  42. tokenPostfix: ".aes",
  43. brackets: [
  44. { token: "delimiter.curly", open: "{", close: "}" },
  45. { token: "delimiter.parenthesis", open: "(", close: ")" },
  46. { token: "delimiter.square", open: "[", close: "]" },
  47. { token: "delimiter.angle", open: "<", close: ">" }
  48. ],
  49. keywords: [
  50. "contract",
  51. "library",
  52. "entrypoint",
  53. "function",
  54. "stateful",
  55. "state",
  56. "hash",
  57. "signature",
  58. "tuple",
  59. "list",
  60. "address",
  61. "string",
  62. "bool",
  63. "int",
  64. "record",
  65. "datatype",
  66. "type",
  67. "option",
  68. "oracle",
  69. "oracle_query",
  70. "Call",
  71. "Bits",
  72. "Bytes",
  73. "Oracle",
  74. "String",
  75. "Crypto",
  76. "Address",
  77. "Auth",
  78. "Chain",
  79. "None",
  80. "Some",
  81. "bits",
  82. "bytes",
  83. "event",
  84. "let",
  85. "map",
  86. "private",
  87. "public",
  88. "true",
  89. "false",
  90. "var",
  91. "if",
  92. "else",
  93. "throw"
  94. ],
  95. operators: [
  96. "=",
  97. ">",
  98. "<",
  99. "!",
  100. "~",
  101. "?",
  102. "::",
  103. ":",
  104. "==",
  105. "<=",
  106. ">=",
  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. symbols: /[=><!~?:&|+\-*\/\^%]+/,
  136. escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  137. integersuffix: /(ll|LL|u|U|l|L)?(ll|LL|u|U|l|L)?/,
  138. floatsuffix: /[fFlL]?/,
  139. tokenizer: {
  140. root: [
  141. [
  142. /[a-zA-Z_]\w*/,
  143. {
  144. cases: {
  145. "@keywords": { token: "keyword.$0" },
  146. "@default": "identifier"
  147. }
  148. }
  149. ],
  150. { include: "@whitespace" },
  151. [/\[\[.*\]\]/, "annotation"],
  152. [/^\s*#\w+/, "keyword"],
  153. [/int\d*/, "keyword"],
  154. [/[{}()\[\]]/, "@brackets"],
  155. [/[<>](?!@symbols)/, "@brackets"],
  156. [
  157. /@symbols/,
  158. {
  159. cases: {
  160. "@operators": "delimiter",
  161. "@default": ""
  162. }
  163. }
  164. ],
  165. [/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/, "number.float"],
  166. [/\d*\.\d+([eE][\-+]?\d+)?(@floatsuffix)/, "number.float"],
  167. [/0[xX][0-9a-fA-F']*[0-9a-fA-F](@integersuffix)/, "number.hex"],
  168. [/0[0-7']*[0-7](@integersuffix)/, "number.octal"],
  169. [/0[bB][0-1']*[0-1](@integersuffix)/, "number.binary"],
  170. [/\d[\d']*\d(@integersuffix)/, "number"],
  171. [/\d(@integersuffix)/, "number"],
  172. [/[;,.]/, "delimiter"],
  173. [/"([^"\\]|\\.)*$/, "string.invalid"],
  174. [/"/, "string", "@string"],
  175. [/'[^\\']'/, "string"],
  176. [/(')(@escapes)(')/, ["string", "string.escape", "string"]],
  177. [/'/, "string.invalid"]
  178. ],
  179. whitespace: [
  180. [/[ \t\r\n]+/, ""],
  181. [/\/\*\*(?!\/)/, "comment.doc", "@doccomment"],
  182. [/\/\*/, "comment", "@comment"],
  183. [/\/\/.*$/, "comment"]
  184. ],
  185. comment: [
  186. [/[^\/*]+/, "comment"],
  187. [/\*\//, "comment", "@pop"],
  188. [/[\/*]/, "comment"]
  189. ],
  190. doccomment: [
  191. [/[^\/*]+/, "comment.doc"],
  192. [/\*\//, "comment.doc", "@pop"],
  193. [/[\/*]/, "comment.doc"]
  194. ],
  195. string: [
  196. [/[^\\"]+/, "string"],
  197. [/@escapes/, "string.escape"],
  198. [/\\./, "string.escape.invalid"],
  199. [/"/, "string", "@pop"]
  200. ]
  201. }
  202. };
  203. return sophia_exports;
  204. })();
  205. return moduleExports;
  206. });