bicep.js 5.0 KB

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