r.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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/r/r", ["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/r/r.ts
  28. var r_exports = {};
  29. __export(r_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: '"' }
  47. ],
  48. surroundingPairs: [
  49. { open: "{", close: "}" },
  50. { open: "[", close: "]" },
  51. { open: "(", close: ")" },
  52. { open: '"', close: '"' }
  53. ]
  54. };
  55. var language = {
  56. defaultToken: "",
  57. tokenPostfix: ".r",
  58. roxygen: [
  59. "@alias",
  60. "@aliases",
  61. "@assignee",
  62. "@author",
  63. "@backref",
  64. "@callGraph",
  65. "@callGraphDepth",
  66. "@callGraphPrimitives",
  67. "@concept",
  68. "@describeIn",
  69. "@description",
  70. "@details",
  71. "@docType",
  72. "@encoding",
  73. "@evalNamespace",
  74. "@evalRd",
  75. "@example",
  76. "@examples",
  77. "@export",
  78. "@exportClass",
  79. "@exportMethod",
  80. "@exportPattern",
  81. "@family",
  82. "@field",
  83. "@formals",
  84. "@format",
  85. "@import",
  86. "@importClassesFrom",
  87. "@importFrom",
  88. "@importMethodsFrom",
  89. "@include",
  90. "@inherit",
  91. "@inheritDotParams",
  92. "@inheritParams",
  93. "@inheritSection",
  94. "@keywords",
  95. "@md",
  96. "@method",
  97. "@name",
  98. "@noMd",
  99. "@noRd",
  100. "@note",
  101. "@param",
  102. "@rawNamespace",
  103. "@rawRd",
  104. "@rdname",
  105. "@references",
  106. "@return",
  107. "@S3method",
  108. "@section",
  109. "@seealso",
  110. "@setClass",
  111. "@slot",
  112. "@source",
  113. "@template",
  114. "@templateVar",
  115. "@title",
  116. "@TODO",
  117. "@usage",
  118. "@useDynLib"
  119. ],
  120. constants: [
  121. "NULL",
  122. "FALSE",
  123. "TRUE",
  124. "NA",
  125. "Inf",
  126. "NaN",
  127. "NA_integer_",
  128. "NA_real_",
  129. "NA_complex_",
  130. "NA_character_",
  131. "T",
  132. "F",
  133. "LETTERS",
  134. "letters",
  135. "month.abb",
  136. "month.name",
  137. "pi",
  138. "R.version.string"
  139. ],
  140. keywords: [
  141. "break",
  142. "next",
  143. "return",
  144. "if",
  145. "else",
  146. "for",
  147. "in",
  148. "repeat",
  149. "while",
  150. "array",
  151. "category",
  152. "character",
  153. "complex",
  154. "double",
  155. "function",
  156. "integer",
  157. "list",
  158. "logical",
  159. "matrix",
  160. "numeric",
  161. "vector",
  162. "data.frame",
  163. "factor",
  164. "library",
  165. "require",
  166. "attach",
  167. "detach",
  168. "source"
  169. ],
  170. special: ["\\n", "\\r", "\\t", "\\b", "\\a", "\\f", "\\v", "\\'", '\\"', "\\\\"],
  171. brackets: [
  172. { open: "{", close: "}", token: "delimiter.curly" },
  173. { open: "[", close: "]", token: "delimiter.bracket" },
  174. { open: "(", close: ")", token: "delimiter.parenthesis" }
  175. ],
  176. tokenizer: {
  177. root: [
  178. { include: "@numbers" },
  179. { include: "@strings" },
  180. [/[{}\[\]()]/, "@brackets"],
  181. { include: "@operators" },
  182. [/#'$/, "comment.doc"],
  183. [/#'/, "comment.doc", "@roxygen"],
  184. [/(^#.*$)/, "comment"],
  185. [/\s+/, "white"],
  186. [/[,:;]/, "delimiter"],
  187. [/@[a-zA-Z]\w*/, "tag"],
  188. [
  189. /[a-zA-Z]\w*/,
  190. {
  191. cases: {
  192. "@keywords": "keyword",
  193. "@constants": "constant",
  194. "@default": "identifier"
  195. }
  196. }
  197. ]
  198. ],
  199. roxygen: [
  200. [
  201. /@\w+/,
  202. {
  203. cases: {
  204. "@roxygen": "tag",
  205. "@eos": { token: "comment.doc", next: "@pop" },
  206. "@default": "comment.doc"
  207. }
  208. }
  209. ],
  210. [
  211. /\s+/,
  212. {
  213. cases: {
  214. "@eos": { token: "comment.doc", next: "@pop" },
  215. "@default": "comment.doc"
  216. }
  217. }
  218. ],
  219. [/.*/, { token: "comment.doc", next: "@pop" }]
  220. ],
  221. numbers: [
  222. [/0[xX][0-9a-fA-F]+/, "number.hex"],
  223. [/-?(\d*\.)?\d+([eE][+\-]?\d+)?/, "number"]
  224. ],
  225. operators: [
  226. [/<{1,2}-/, "operator"],
  227. [/->{1,2}/, "operator"],
  228. [/%[^%\s]+%/, "operator"],
  229. [/\*\*/, "operator"],
  230. [/%%/, "operator"],
  231. [/&&/, "operator"],
  232. [/\|\|/, "operator"],
  233. [/<</, "operator"],
  234. [/>>/, "operator"],
  235. [/[-+=&|!<>^~*/:$]/, "operator"]
  236. ],
  237. strings: [
  238. [/'/, "string.escape", "@stringBody"],
  239. [/"/, "string.escape", "@dblStringBody"]
  240. ],
  241. stringBody: [
  242. [
  243. /\\./,
  244. {
  245. cases: {
  246. "@special": "string",
  247. "@default": "error-token"
  248. }
  249. }
  250. ],
  251. [/'/, "string.escape", "@popall"],
  252. [/./, "string"]
  253. ],
  254. dblStringBody: [
  255. [
  256. /\\./,
  257. {
  258. cases: {
  259. "@special": "string",
  260. "@default": "error-token"
  261. }
  262. }
  263. ],
  264. [/"/, "string.escape", "@popall"],
  265. [/./, "string"]
  266. ]
  267. }
  268. };
  269. return __toCommonJS(r_exports);
  270. })();
  271. return moduleExports;
  272. });