1
|
{"version":3,"sources":["webpack:///./node_modules/highlight.js/lib/languages/r.js"],"names":["source","re","concat","args","joined","map","x","join","module","exports","hljs","IDENT_RE","name","illegal","keywords","$pattern","keyword","literal","built_in","contains","COMMENT","className","begin","starts","endsParent","end","excludeBegin","variants","HASH_COMMENT_MODE","BACKSLASH_ESCAPE","END_SAME_AS_BEGIN","relevance"],"mappings":"oGASA,SAASA,EAAOC,GACd,OAAKA,EACa,iBAAPA,EAAwBA,EAE5BA,EAAGD,OAHM,KAUlB,SAASE,IAAgB,2BAANC,EAAM,yBAANA,EAAM,gBACvB,IAAMC,EAASD,EAAKE,KAAI,SAACC,GAAD,OAAON,EAAOM,MAAIC,KAAK,IAC/C,OAAOH,EAgMTI,EAAOC,QApLP,SAAWC,GAOT,IAAMC,EAAW,uDAGjB,MAAO,CACLC,KAAM,IAGNC,QAAS,KACTC,SAAU,CACRC,SAAUJ,EACVK,QACE,kDACFC,QACE,wFAEFC,SAEE,khCAuBJC,SAAU,CAERT,EAAKU,QACH,KACA,IACA,CACED,SAAU,CACR,CAMEE,UAAW,SACXC,MAAO,YACPC,OAAQ,CACNJ,SAAU,CACR,CAAEG,MAAO,MACT,CACEA,MAAO,sBACPE,YAAY,GAEd,CACEF,MAAO,KACPG,IAAK,IACLC,cAAc,MAKtB,CAGEL,UAAW,SACXC,MAAO,SACPG,IAAK,IACLN,SAAU,CACR,CACEE,UAAW,WACXM,SAAU,CACR,CAAEL,MAAOX,GACT,CAAEW,MAAO,sBAEXE,YAAY,KAIlB,CACEH,UAAW,SACXC,MAAO,cAET,CACED,UAAW,eACXC,MAAO,kBAMfZ,EAAKkB,kBAEL,CACEP,UAAW,SACXF,SAAU,CAACT,EAAKmB,kBAChBF,SAAU,CACRjB,EAAKoB,kBAAkB,CAAER,MAAO,cAAeG,IAAK,YACpDf,EAAKoB,kBAAkB,CAAER,MAAO,cAAeG,IAAK,YACpDf,EAAKoB,kBAAkB,CAAER,MAAO,cAAeG,IAAK,YACpDf,EAAKoB,kBAAkB,CAAER,MAAO,cAAeG,IAAK,YACpDf,EAAKoB,kBAAkB,CAAER,MAAO,cAAeG,IAAK,YACpDf,EAAKoB,kBAAkB,CAAER,MAAO,cAAeG,IAAK,YACpD,CAACH,MAAO,IAAKG,IAAK,IAAKM,UAAW,GAClC,CAACT,MAAO,IAAKG,IAAK,IAAKM,UAAW,KAGtC,CACEV,UAAW,SACXM,SAAU,CASR,CAEEL,MAAO,oEACPG,IAAK,gDACLC,cAAc,GAEhB,CACEJ,MAAO,4DACPG,IAAK,wCACLC,cAAc,GAEhB,CACEJ,MAAO,8DACPG,IAAK,0CACLC,cAAc,IASlBK,UAAW,GAGb,CAEET,MAAO,IACPG,IAAK,KAGP,CACEH,MAAOpB,EA9JQ,wBA8Ja,eAE9B,CAEEoB,MAAO,IACPG,IAAK,IACLN,SAAU,CACR,CAAEG,MAAO","file":"highlight/r.js?v=25f9dac78f5a8475b13d","sourcesContent":["/**\n * @param {string} value\n * @returns {RegExp}\n * */\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction source(re) {\n if (!re) return null;\n if (typeof re === \"string\") return re;\n\n return re.source;\n}\n\n/**\n * @param {...(RegExp | string) } args\n * @returns {string}\n */\nfunction concat(...args) {\n const joined = args.map((x) => source(x)).join(\"\");\n return joined;\n}\n\n/*\nLanguage: R\nDescription: R is a free software environment for statistical computing and graphics.\nAuthor: Joe Cheng <joe@rstudio.org>\nContributors: Konrad Rudolph <konrad.rudolph@gmail.com>\nWebsite: https://www.r-project.org\nCategory: scientific\n*/\n\nfunction r(hljs) {\n // Identifiers in R cannot start with `_`, but they can start with `.` if it\n // is not immediately followed by a digit.\n // R also supports quoted identifiers, which are near-arbitrary sequences\n // delimited by backticks (`…`), which may contain escape sequences. These are\n // handled in a separate mode. See `test/markup/r/names.txt` for examples.\n // FIXME: Support Unicode identifiers.\n const IDENT_RE = /(?:(?:[a-zA-Z]|\\.[._a-zA-Z])[._a-zA-Z0-9]*)|\\.(?!\\d)/;\n const SIMPLE_IDENT = /[a-zA-Z][a-zA-Z_0-9]*/;\n\n return {\n name: 'R',\n\n // only in Haskell, not R\n illegal: /->/,\n keywords: {\n $pattern: IDENT_RE,\n keyword:\n 'function if in break next repeat else for while',\n literal:\n 'NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 ' +\n 'NA_character_|10 NA_complex_|10',\n built_in:\n // Builtin constants\n 'LETTERS letters month.abb month.name pi T F ' +\n // Primitive functions\n // These are all the functions in `base` that are implemented as a\n // `.Primitive`, minus those functions that are also keywords.\n 'abs acos acosh all any anyNA Arg as.call as.character ' +\n 'as.complex as.double as.environment as.integer as.logical ' +\n 'as.null.default as.numeric as.raw asin asinh atan atanh attr ' +\n 'attributes baseenv browser c call ceiling class Conj cos cosh ' +\n 'cospi cummax cummin cumprod cumsum digamma dim dimnames ' +\n 'emptyenv exp expression floor forceAndCall gamma gc.time ' +\n 'globalenv Im interactive invisible is.array is.atomic is.call ' +\n 'is.character is.complex is.double is.environment is.expression ' +\n 'is.finite is.function is.infinite is.integer is.language ' +\n 'is.list is.logical is.matrix is.na is.name is.nan is.null ' +\n 'is.numeric is.object is.pairlist is.raw is.recursive is.single ' +\n 'is.symbol lazyLoadDBfetch length lgamma list log max min ' +\n 'missing Mod names nargs nzchar oldClass on.exit pos.to.env ' +\n 'proc.time prod quote range Re rep retracemem return round ' +\n 'seq_along seq_len seq.int sign signif sin sinh sinpi sqrt ' +\n 'standardGeneric substitute sum switch tan tanh tanpi tracemem ' +\n 'trigamma trunc unclass untracemem UseMethod xtfrm',\n },\n\n contains: [\n // Roxygen comments\n hljs.COMMENT(\n /#'/,\n /$/,\n {\n contains: [\n {\n // Handle `@examples` separately to cause all subsequent code\n // until the next `@`-tag on its own line to be kept as-is,\n // preventing highlighting. This code is example R code, so nested\n // doctags shouldn’t be treated as such. See\n // `test/markup/r/roxygen.txt` for an example.\n className: 'doctag',\n begin: '@examples',\n starts: {\n contains: [\n { begin: /\\n/ },\n {\n begin: /#'\\s*(?=@[a-zA-Z]+)/,\n endsParent: true,\n },\n {\n begin: /#'/,\n end: /$/,\n excludeBegin: true,\n }\n ]\n }\n },\n {\n // Handle `@param` to highlight the parameter name following\n // after.\n className: 'doctag',\n begin: '@param',\n end: /$/,\n contains: [\n {\n className: 'variable',\n variants: [\n { begin: IDENT_RE },\n { begin: /`(?:\\\\.|[^`\\\\])+`/ }\n ],\n endsParent: true\n }\n ]\n },\n {\n className: 'doctag',\n begin: /@[a-zA-Z]+/\n },\n {\n className: 'meta-keyword',\n begin: /\\\\[a-zA-Z]+/,\n }\n ]\n }\n ),\n\n hljs.HASH_COMMENT_MODE,\n\n {\n className: 'string',\n contains: [hljs.BACKSLASH_ESCAPE],\n variants: [\n hljs.END_SAME_AS_BEGIN({ begin: /[rR]\"(-*)\\(/, end: /\\)(-*)\"/ }),\n hljs.END_SAME_AS_BEGIN({ begin: /[rR]\"(-*)\\{/, end: /\\}(-*)\"/ }),\n hljs.END_SAME_AS_BEGIN({ begin: /[rR]\"(-*)\\[/, end: /\\](-*)\"/ }),\n hljs.END_SAME_AS_BEGIN({ begin: /[rR]'(-*)\\(/, end: /\\)(-*)'/ }),\n hljs.END_SAME_AS_BEGIN({ begin: /[rR]'(-*)\\{/, end: /\\}(-*)'/ }),\n hljs.END_SAME_AS_BEGIN({ begin: /[rR]'(-*)\\[/, end: /\\](-*)'/ }),\n {begin: '\"', end: '\"', relevance: 0},\n {begin: \"'\", end: \"'\", relevance: 0}\n ],\n },\n {\n className: 'number',\n variants: [\n // TODO: replace with negative look-behind when available\n // { begin: /(?<![a-zA-Z0-9._])0[xX][0-9a-fA-F]+\\.[0-9a-fA-F]*[pP][+-]?\\d+i?/ },\n // { begin: /(?<![a-zA-Z0-9._])0[xX][0-9a-fA-F]+([pP][+-]?\\d+)?[Li]?/ },\n // { begin: /(?<![a-zA-Z0-9._])(\\d+(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?[Li]?/ }\n\n // The below rules all eat an extra character in front (for the\n // look-behind check) and then exclude it from the match, but I think\n // in many cases this will work out just fine.\n {\n // Special case: only hexadecimal binary powers can contain fractions.\n begin: /([^a-zA-Z0-9._])(?=0[xX][0-9a-fA-F]+\\.[0-9a-fA-F]*[pP][+-]?\\d+i?)/,\n end: /0[xX][0-9a-fA-F]+\\.[0-9a-fA-F]*[pP][+-]?\\d+i?/,\n excludeBegin: true\n },\n {\n begin: /([^a-zA-Z0-9._])(?=0[xX][0-9a-fA-F]+([pP][+-]?\\d+)?[Li]?)/,\n end: /0[xX][0-9a-fA-F]+([pP][+-]?\\d+)?[Li]?/ ,\n excludeBegin: true\n },\n {\n begin: /([^a-zA-Z0-9._])(?=(\\d+(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?[Li]?)/,\n end: /(\\d+(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?[Li]?/,\n excludeBegin: true\n }\n ],\n // \"on:begin\": (match, response) => {\n // if (match.index > 0) {\n // let priorChar = match.input[match.index - 1];\n // if (priorChar.match(/[a-zA-Z0-9._]/)) response.ignoreMatch();\n // }\n // },\n relevance: 0\n },\n\n {\n // infix operator\n begin: '%',\n end: '%'\n },\n // relevance boost for assignment\n {\n begin: concat(SIMPLE_IDENT, \"\\\\s+<-\\\\s+\")\n },\n {\n // escaped identifier\n begin: '`',\n end: '`',\n contains: [\n { begin: /\\\\./ }\n ]\n }\n ]\n };\n}\n\nmodule.exports = r;\n"],"sourceRoot":""}
|