bicep.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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/bicep/bicep",[],()=>{
  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/bicep/bicep.ts
  17. var bicep_exports = {};
  18. __export(bicep_exports, {
  19. conf: () => conf,
  20. language: () => language
  21. });
  22. var bounded = (text) => `\\b${text}\\b`;
  23. var identifierStart = "[_a-zA-Z]";
  24. var identifierContinue = "[_a-zA-Z0-9]";
  25. var identifier = bounded(`${identifierStart}${identifierContinue}*`);
  26. var keywords = [
  27. "targetScope",
  28. "resource",
  29. "module",
  30. "param",
  31. "var",
  32. "output",
  33. "for",
  34. "in",
  35. "if",
  36. "existing"
  37. ];
  38. var namedLiterals = ["true", "false", "null"];
  39. var nonCommentWs = `[ \\t\\r\\n]`;
  40. var numericLiteral = `[0-9]+`;
  41. var conf = {
  42. comments: {
  43. lineComment: "//",
  44. blockComment: ["/*", "*/"]
  45. },
  46. brackets: [
  47. ["{", "}"],
  48. ["[", "]"],
  49. ["(", ")"]
  50. ],
  51. surroundingPairs: [
  52. { open: "{", close: "}" },
  53. { open: "[", close: "]" },
  54. { open: "(", close: ")" },
  55. { open: "'", close: "'" },
  56. { open: "'''", close: "'''" }
  57. ],
  58. autoClosingPairs: [
  59. { open: "{", close: "}" },
  60. { open: "[", close: "]" },
  61. { open: "(", close: ")" },
  62. { open: "'", close: "'", notIn: ["string", "comment"] },
  63. { open: "'''", close: "'''", notIn: ["string", "comment"] }
  64. ],
  65. autoCloseBefore: ":.,=}])' \n ",
  66. indentationRules: {
  67. increaseIndentPattern: new RegExp("^((?!\\/\\/).)*(\\{[^}\"'`]*|\\([^)\"'`]*|\\[[^\\]\"'`]*)$"),
  68. decreaseIndentPattern: new RegExp("^((?!.*?\\/\\*).*\\*/)?\\s*[\\}\\]].*$")
  69. }
  70. };
  71. var language = {
  72. defaultToken: "",
  73. tokenPostfix: ".bicep",
  74. brackets: [
  75. { open: "{", close: "}", token: "delimiter.curly" },
  76. { open: "[", close: "]", token: "delimiter.square" },
  77. { open: "(", close: ")", token: "delimiter.parenthesis" }
  78. ],
  79. symbols: /[=><!~?:&|+\-*/^%]+/,
  80. keywords,
  81. namedLiterals,
  82. escapes: `\\\\(u{[0-9A-Fa-f]+}|n|r|t|\\\\|'|\\\${)`,
  83. tokenizer: {
  84. root: [{ include: "@expression" }, { include: "@whitespace" }],
  85. stringVerbatim: [
  86. { regex: `(|'|'')[^']`, action: { token: "string" } },
  87. { regex: `'''`, action: { token: "string.quote", next: "@pop" } }
  88. ],
  89. stringLiteral: [
  90. { regex: `\\\${`, action: { token: "delimiter.bracket", next: "@bracketCounting" } },
  91. { regex: `[^\\\\'$]+`, action: { token: "string" } },
  92. { regex: "@escapes", action: { token: "string.escape" } },
  93. { regex: `\\\\.`, action: { token: "string.escape.invalid" } },
  94. { regex: `'`, action: { token: "string", next: "@pop" } }
  95. ],
  96. bracketCounting: [
  97. { regex: `{`, action: { token: "delimiter.bracket", next: "@bracketCounting" } },
  98. { regex: `}`, action: { token: "delimiter.bracket", next: "@pop" } },
  99. { include: "expression" }
  100. ],
  101. comment: [
  102. { regex: `[^\\*]+`, action: { token: "comment" } },
  103. { regex: `\\*\\/`, action: { token: "comment", next: "@pop" } },
  104. { regex: `[\\/*]`, action: { token: "comment" } }
  105. ],
  106. whitespace: [
  107. { regex: nonCommentWs },
  108. { regex: `\\/\\*`, action: { token: "comment", next: "@comment" } },
  109. { regex: `\\/\\/.*$`, action: { token: "comment" } }
  110. ],
  111. expression: [
  112. { regex: `'''`, action: { token: "string.quote", next: "@stringVerbatim" } },
  113. { regex: `'`, action: { token: "string.quote", next: "@stringLiteral" } },
  114. { regex: numericLiteral, action: { token: "number" } },
  115. {
  116. regex: identifier,
  117. action: {
  118. cases: {
  119. "@keywords": { token: "keyword" },
  120. "@namedLiterals": { token: "keyword" },
  121. "@default": { token: "identifier" }
  122. }
  123. }
  124. }
  125. ]
  126. }
  127. };
  128. return bicep_exports;
  129. })();
  130. return moduleExports;
  131. });