r.js 5.8 KB

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