qsharp.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  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/qsharp/qsharp", ["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/qsharp/qsharp.ts
  28. var qsharp_exports = {};
  29. __export(qsharp_exports, {
  30. conf: () => conf,
  31. language: () => language
  32. });
  33. var conf = {
  34. comments: {
  35. lineComment: "//"
  36. },
  37. brackets: [
  38. ["{", "}"],
  39. ["[", "]"],
  40. ["(", ")"]
  41. ],
  42. autoClosingPairs: [
  43. { open: "{", close: "}" },
  44. { open: "[", close: "]" },
  45. { open: "(", close: ")" },
  46. { open: '"', close: '"', notIn: ["string", "comment"] }
  47. ],
  48. surroundingPairs: [
  49. { open: "{", close: "}" },
  50. { open: "[", close: "]" },
  51. { open: "(", close: ")" },
  52. { open: '"', close: '"' }
  53. ]
  54. };
  55. var language = {
  56. keywords: [
  57. "namespace",
  58. "open",
  59. "as",
  60. "operation",
  61. "function",
  62. "body",
  63. "adjoint",
  64. "newtype",
  65. "controlled",
  66. "if",
  67. "elif",
  68. "else",
  69. "repeat",
  70. "until",
  71. "fixup",
  72. "for",
  73. "in",
  74. "while",
  75. "return",
  76. "fail",
  77. "within",
  78. "apply",
  79. "Adjoint",
  80. "Controlled",
  81. "Adj",
  82. "Ctl",
  83. "is",
  84. "self",
  85. "auto",
  86. "distribute",
  87. "invert",
  88. "intrinsic",
  89. "let",
  90. "set",
  91. "w/",
  92. "new",
  93. "not",
  94. "and",
  95. "or",
  96. "use",
  97. "borrow",
  98. "using",
  99. "borrowing",
  100. "mutable",
  101. "internal"
  102. ],
  103. typeKeywords: [
  104. "Unit",
  105. "Int",
  106. "BigInt",
  107. "Double",
  108. "Bool",
  109. "String",
  110. "Qubit",
  111. "Result",
  112. "Pauli",
  113. "Range"
  114. ],
  115. invalidKeywords: [
  116. "abstract",
  117. "base",
  118. "bool",
  119. "break",
  120. "byte",
  121. "case",
  122. "catch",
  123. "char",
  124. "checked",
  125. "class",
  126. "const",
  127. "continue",
  128. "decimal",
  129. "default",
  130. "delegate",
  131. "do",
  132. "double",
  133. "enum",
  134. "event",
  135. "explicit",
  136. "extern",
  137. "finally",
  138. "fixed",
  139. "float",
  140. "foreach",
  141. "goto",
  142. "implicit",
  143. "int",
  144. "interface",
  145. "lock",
  146. "long",
  147. "null",
  148. "object",
  149. "operator",
  150. "out",
  151. "override",
  152. "params",
  153. "private",
  154. "protected",
  155. "public",
  156. "readonly",
  157. "ref",
  158. "sbyte",
  159. "sealed",
  160. "short",
  161. "sizeof",
  162. "stackalloc",
  163. "static",
  164. "string",
  165. "struct",
  166. "switch",
  167. "this",
  168. "throw",
  169. "try",
  170. "typeof",
  171. "unit",
  172. "ulong",
  173. "unchecked",
  174. "unsafe",
  175. "ushort",
  176. "virtual",
  177. "void",
  178. "volatile"
  179. ],
  180. constants: ["true", "false", "PauliI", "PauliX", "PauliY", "PauliZ", "One", "Zero"],
  181. builtin: [
  182. "X",
  183. "Y",
  184. "Z",
  185. "H",
  186. "HY",
  187. "S",
  188. "T",
  189. "SWAP",
  190. "CNOT",
  191. "CCNOT",
  192. "MultiX",
  193. "R",
  194. "RFrac",
  195. "Rx",
  196. "Ry",
  197. "Rz",
  198. "R1",
  199. "R1Frac",
  200. "Exp",
  201. "ExpFrac",
  202. "Measure",
  203. "M",
  204. "MultiM",
  205. "Message",
  206. "Length",
  207. "Assert",
  208. "AssertProb",
  209. "AssertEqual"
  210. ],
  211. operators: [
  212. "and=",
  213. "<-",
  214. "->",
  215. "*",
  216. "*=",
  217. "@",
  218. "!",
  219. "^",
  220. "^=",
  221. ":",
  222. "::",
  223. "..",
  224. "==",
  225. "...",
  226. "=",
  227. "=>",
  228. ">",
  229. ">=",
  230. "<",
  231. "<=",
  232. "-",
  233. "-=",
  234. "!=",
  235. "or=",
  236. "%",
  237. "%=",
  238. "|",
  239. "+",
  240. "+=",
  241. "?",
  242. "/",
  243. "/=",
  244. "&&&",
  245. "&&&=",
  246. "^^^",
  247. "^^^=",
  248. ">>>",
  249. ">>>=",
  250. "<<<",
  251. "<<<=",
  252. "|||",
  253. "|||=",
  254. "~~~",
  255. "_",
  256. "w/",
  257. "w/="
  258. ],
  259. namespaceFollows: ["namespace", "open"],
  260. symbols: /[=><!~?:&|+\-*\/\^%@._]+/,
  261. escapes: /\\[\s\S]/,
  262. tokenizer: {
  263. root: [
  264. [
  265. /[a-zA-Z_$][\w$]*/,
  266. {
  267. cases: {
  268. "@namespaceFollows": {
  269. token: "keyword.$0",
  270. next: "@namespace"
  271. },
  272. "@typeKeywords": "type",
  273. "@keywords": "keyword",
  274. "@constants": "constant",
  275. "@builtin": "keyword",
  276. "@invalidKeywords": "invalid",
  277. "@default": "identifier"
  278. }
  279. }
  280. ],
  281. { include: "@whitespace" },
  282. [/[{}()\[\]]/, "@brackets"],
  283. [/@symbols/, { cases: { "@operators": "operator", "@default": "" } }],
  284. [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"],
  285. [/\d+/, "number"],
  286. [/[;,.]/, "delimiter"],
  287. [/"/, { token: "string.quote", bracket: "@open", next: "@string" }]
  288. ],
  289. string: [
  290. [/[^\\"]+/, "string"],
  291. [/@escapes/, "string.escape"],
  292. [/"/, { token: "string.quote", bracket: "@close", next: "@pop" }]
  293. ],
  294. namespace: [
  295. { include: "@whitespace" },
  296. [/[A-Za-z]\w*/, "namespace"],
  297. [/[\.=]/, "delimiter"],
  298. ["", "", "@pop"]
  299. ],
  300. whitespace: [
  301. [/[ \t\r\n]+/, "white"],
  302. [/(\/\/).*/, "comment"]
  303. ]
  304. }
  305. };
  306. return __toCommonJS(qsharp_exports);
  307. })();
  308. return moduleExports;
  309. });