restructuredtext.js 6.1 KB

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