restructuredtext.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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/restructuredtext/restructuredtext", ["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/restructuredtext/restructuredtext.ts
  28. var restructuredtext_exports = {};
  29. __export(restructuredtext_exports, {
  30. conf: () => conf,
  31. language: () => language
  32. });
  33. var conf = {
  34. brackets: [
  35. ["{", "}"],
  36. ["[", "]"],
  37. ["(", ")"]
  38. ],
  39. autoClosingPairs: [
  40. { open: "{", close: "}" },
  41. { open: "[", close: "]" },
  42. { open: "(", close: ")" },
  43. { open: "<", close: ">", notIn: ["string"] }
  44. ],
  45. surroundingPairs: [
  46. { open: "(", close: ")" },
  47. { open: "[", close: "]" },
  48. { open: "`", close: "`" }
  49. ],
  50. folding: {
  51. markers: {
  52. start: new RegExp("^\\s*<!--\\s*#?region\\b.*-->"),
  53. end: new RegExp("^\\s*<!--\\s*#?endregion\\b.*-->")
  54. }
  55. }
  56. };
  57. var language = {
  58. defaultToken: "",
  59. tokenPostfix: ".rst",
  60. control: /[\\`*_\[\]{}()#+\-\.!]/,
  61. escapes: /\\(?:@control)/,
  62. empty: [
  63. "area",
  64. "base",
  65. "basefont",
  66. "br",
  67. "col",
  68. "frame",
  69. "hr",
  70. "img",
  71. "input",
  72. "isindex",
  73. "link",
  74. "meta",
  75. "param"
  76. ],
  77. alphanumerics: /[A-Za-z0-9]/,
  78. simpleRefNameWithoutBq: /(?:@alphanumerics[-_+:.]*@alphanumerics)+|(?:@alphanumerics+)/,
  79. simpleRefName: /(?:`@phrase`|@simpleRefNameWithoutBq)/,
  80. phrase: /@simpleRefNameWithoutBq(?:\s@simpleRefNameWithoutBq)*/,
  81. citationName: /[A-Za-z][A-Za-z0-9-_.]*/,
  82. blockLiteralStart: /(?:[!"#$%&'()*+,-./:;<=>?@\[\]^_`{|}~]|[\s])/,
  83. precedingChars: /(?:[ -:/'"<([{])/,
  84. followingChars: /(?:[ -.,:;!?/'")\]}>]|$)/,
  85. punctuation: /(=|-|~|`|#|"|\^|\+|\*|:|\.|'|_|\+)/,
  86. tokenizer: {
  87. root: [
  88. [/^(@punctuation{3,}$){1,1}?/, "keyword"],
  89. [/^\s*([\*\-+‣•]|[a-zA-Z0-9]+\.|\([a-zA-Z0-9]+\)|[a-zA-Z0-9]+\))\s/, "keyword"],
  90. [/([ ]::)\s*$/, "keyword", "@blankLineOfLiteralBlocks"],
  91. [/(::)\s*$/, "keyword", "@blankLineOfLiteralBlocks"],
  92. { include: "@tables" },
  93. { include: "@explicitMarkupBlocks" },
  94. { include: "@inlineMarkup" }
  95. ],
  96. explicitMarkupBlocks: [
  97. { include: "@citations" },
  98. { include: "@footnotes" },
  99. [
  100. /^(\.\.\s)(@simpleRefName)(::\s)(.*)$/,
  101. [{ token: "", next: "subsequentLines" }, "keyword", "", ""]
  102. ],
  103. [
  104. /^(\.\.)(\s+)(_)(@simpleRefName)(:)(\s+)(.*)/,
  105. [{ token: "", next: "hyperlinks" }, "", "", "string.link", "", "", "string.link"]
  106. ],
  107. [
  108. /^((?:(?:\.\.)(?:\s+))?)(__)(:)(\s+)(.*)/,
  109. [{ token: "", next: "subsequentLines" }, "", "", "", "string.link"]
  110. ],
  111. [/^(__\s+)(.+)/, ["", "string.link"]],
  112. [
  113. /^(\.\.)( \|)([^| ]+[^|]*[^| ]*)(\| )(@simpleRefName)(:: .*)/,
  114. [{ token: "", next: "subsequentLines" }, "", "string.link", "", "keyword", ""],
  115. "@rawBlocks"
  116. ],
  117. [/(\|)([^| ]+[^|]*[^| ]*)(\|_{0,2})/, ["", "string.link", ""]],
  118. [/^(\.\.)([ ].*)$/, [{ token: "", next: "@comments" }, "comment"]]
  119. ],
  120. inlineMarkup: [
  121. { include: "@citationsReference" },
  122. { include: "@footnotesReference" },
  123. [/(@simpleRefName)(_{1,2})/, ["string.link", ""]],
  124. [/(`)([^<`]+\s+)(<)(.*)(>)(`)(_)/, ["", "string.link", "", "string.link", "", "", ""]],
  125. [/\*\*([^\\*]|\*(?!\*))+\*\*/, "strong"],
  126. [/\*[^*]+\*/, "emphasis"],
  127. [/(``)((?:[^`]|\`(?!`))+)(``)/, ["", "keyword", ""]],
  128. [/(__\s+)(.+)/, ["", "keyword"]],
  129. [/(:)((?:@simpleRefNameWithoutBq)?)(:`)([^`]+)(`)/, ["", "keyword", "", "", ""]],
  130. [/(`)([^`]+)(`:)((?:@simpleRefNameWithoutBq)?)(:)/, ["", "", "", "keyword", ""]],
  131. [/(`)([^`]+)(`)/, ""],
  132. [/(_`)(@phrase)(`)/, ["", "string.link", ""]]
  133. ],
  134. citations: [
  135. [
  136. /^(\.\.\s+\[)((?:@citationName))(\]\s+)(.*)/,
  137. [{ token: "", next: "@subsequentLines" }, "string.link", "", ""]
  138. ]
  139. ],
  140. citationsReference: [[/(\[)(@citationName)(\]_)/, ["", "string.link", ""]]],
  141. footnotes: [
  142. [
  143. /^(\.\.\s+\[)((?:[0-9]+))(\]\s+.*)/,
  144. [{ token: "", next: "@subsequentLines" }, "string.link", ""]
  145. ],
  146. [
  147. /^(\.\.\s+\[)((?:#@simpleRefName?))(\]\s+)(.*)/,
  148. [{ token: "", next: "@subsequentLines" }, "string.link", "", ""]
  149. ],
  150. [
  151. /^(\.\.\s+\[)((?:\*))(\]\s+)(.*)/,
  152. [{ token: "", next: "@subsequentLines" }, "string.link", "", ""]
  153. ]
  154. ],
  155. footnotesReference: [
  156. [/(\[)([0-9]+)(\])(_)/, ["", "string.link", "", ""]],
  157. [/(\[)(#@simpleRefName?)(\])(_)/, ["", "string.link", "", ""]],
  158. [/(\[)(\*)(\])(_)/, ["", "string.link", "", ""]]
  159. ],
  160. blankLineOfLiteralBlocks: [
  161. [/^$/, "", "@subsequentLinesOfLiteralBlocks"],
  162. [/^.*$/, "", "@pop"]
  163. ],
  164. subsequentLinesOfLiteralBlocks: [
  165. [/(@blockLiteralStart+)(.*)/, ["keyword", ""]],
  166. [/^(?!blockLiteralStart)/, "", "@popall"]
  167. ],
  168. subsequentLines: [
  169. [/^[\s]+.*/, ""],
  170. [/^(?!\s)/, "", "@pop"]
  171. ],
  172. hyperlinks: [
  173. [/^[\s]+.*/, "string.link"],
  174. [/^(?!\s)/, "", "@pop"]
  175. ],
  176. comments: [
  177. [/^[\s]+.*/, "comment"],
  178. [/^(?!\s)/, "", "@pop"]
  179. ],
  180. tables: [
  181. [/\+-[+-]+/, "keyword"],
  182. [/\+=[+=]+/, "keyword"]
  183. ]
  184. }
  185. };
  186. return __toCommonJS(restructuredtext_exports);
  187. })();
  188. return moduleExports;
  189. });