1 |
- {"ast":null,"code":"/*\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: common,scientific\n*/\n\n/** @type LanguageFn */\nfunction r(hljs) {\n const regex = hljs.regex;\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 NUMBER_TYPES_RE = regex.either(\n // Special case: only hexadecimal binary powers can contain fractions\n /0[xX][0-9a-fA-F]+\\.[0-9a-fA-F]*[pP][+-]?\\d+i?/,\n // Hexadecimal numbers without fraction and optional binary power\n /0[xX][0-9a-fA-F]+(?:[pP][+-]?\\d+)?[Li]?/,\n // Decimal numbers\n /(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?[Li]?/);\n const OPERATORS_RE = /[=!<>:]=|\\|\\||&&|:::?|<-|<<-|->>|->|\\|>|[-+*\\/?!$&|:<=>@^~]|\\*\\*/;\n const PUNCTUATION_RE = regex.either(/[()]/, /[{}]/, /\\[\\[/, /[[\\]]/, /\\\\/, /,/);\n return {\n name: 'R',\n keywords: {\n $pattern: IDENT_RE,\n keyword: 'function if in break next repeat else for while',\n literal: 'NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 ' + '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 ' + 'as.complex as.double as.environment as.integer as.logical ' + 'as.null.default as.numeric as.raw asin asinh atan atanh attr ' + 'attributes baseenv browser c call ceiling class Conj cos cosh ' + 'cospi cummax cummin cumprod cumsum digamma dim dimnames ' + 'emptyenv exp expression floor forceAndCall gamma gc.time ' + 'globalenv Im interactive invisible is.array is.atomic is.call ' + 'is.character is.complex is.double is.environment is.expression ' + 'is.finite is.function is.infinite is.integer is.language ' + 'is.list is.logical is.matrix is.na is.name is.nan is.null ' + 'is.numeric is.object is.pairlist is.raw is.recursive is.single ' + 'is.symbol lazyLoadDBfetch length lgamma list log max min ' + 'missing Mod names nargs nzchar oldClass on.exit pos.to.env ' + 'proc.time prod quote range Re rep retracemem return round ' + 'seq_along seq_len seq.int sign signif sin sinh sinpi sqrt ' + 'standardGeneric substitute sum switch tan tanh tanpi tracemem ' + 'trigamma trunc unclass untracemem UseMethod xtfrm'\n },\n contains: [\n // Roxygen comments\n hljs.COMMENT(/#'/, /$/, {\n contains: [{\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 scope: 'doctag',\n match: /@examples/,\n starts: {\n end: regex.lookahead(regex.either(\n // end if another doc comment\n /\\n^#'\\s*(?=@[a-zA-Z]+)/,\n // or a line with no comment\n /\\n^(?!#')/)),\n endsParent: true\n }\n }, {\n // Handle `@param` to highlight the parameter name following\n // after.\n scope: 'doctag',\n begin: '@param',\n end: /$/,\n contains: [{\n scope: 'variable',\n variants: [{\n match: IDENT_RE\n }, {\n match: /`(?:\\\\.|[^`\\\\])+`/\n }],\n endsParent: true\n }]\n }, {\n scope: 'doctag',\n match: /@[a-zA-Z]+/\n }, {\n scope: 'keyword',\n match: /\\\\[a-zA-Z]+/\n }]\n }), hljs.HASH_COMMENT_MODE, {\n scope: 'string',\n contains: [hljs.BACKSLASH_ESCAPE],\n variants: [hljs.END_SAME_AS_BEGIN({\n begin: /[rR]\"(-*)\\(/,\n end: /\\)(-*)\"/\n }), hljs.END_SAME_AS_BEGIN({\n begin: /[rR]\"(-*)\\{/,\n end: /\\}(-*)\"/\n }), hljs.END_SAME_AS_BEGIN({\n begin: /[rR]\"(-*)\\[/,\n end: /\\](-*)\"/\n }), hljs.END_SAME_AS_BEGIN({\n begin: /[rR]'(-*)\\(/,\n end: /\\)(-*)'/\n }), hljs.END_SAME_AS_BEGIN({\n begin: /[rR]'(-*)\\{/,\n end: /\\}(-*)'/\n }), hljs.END_SAME_AS_BEGIN({\n begin: /[rR]'(-*)\\[/,\n end: /\\](-*)'/\n }), {\n begin: '\"',\n end: '\"',\n relevance: 0\n }, {\n begin: \"'\",\n end: \"'\",\n relevance: 0\n }]\n },\n // Matching numbers immediately following punctuation and operators is\n // tricky since we need to look at the character ahead of a number to\n // ensure the number is not part of an identifier, and we cannot use\n // negative look-behind assertions. So instead we explicitly handle all\n // possible combinations of (operator|punctuation), number.\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 relevance: 0,\n variants: [{\n scope: {\n 1: 'operator',\n 2: 'number'\n },\n match: [OPERATORS_RE, NUMBER_TYPES_RE]\n }, {\n scope: {\n 1: 'operator',\n 2: 'number'\n },\n match: [/%[^%]*%/, NUMBER_TYPES_RE]\n }, {\n scope: {\n 1: 'punctuation',\n 2: 'number'\n },\n match: [PUNCTUATION_RE, NUMBER_TYPES_RE]\n }, {\n scope: {\n 2: 'number'\n },\n match: [/[^a-zA-Z0-9._]|^/,\n // not part of an identifier, or start of document\n NUMBER_TYPES_RE]\n }]\n },\n // Operators/punctuation when they're not directly followed by numbers\n {\n // Relevance boost for the most common assignment form.\n scope: {\n 3: 'operator'\n },\n match: [IDENT_RE, /\\s+/, /<-/, /\\s+/]\n }, {\n scope: 'operator',\n relevance: 0,\n variants: [{\n match: OPERATORS_RE\n }, {\n match: /%[^%]*%/\n }]\n }, {\n scope: 'punctuation',\n relevance: 0,\n match: PUNCTUATION_RE\n }, {\n // Escaped identifier\n begin: '`',\n end: '`',\n contains: [{\n begin: /\\\\./\n }]\n }]\n };\n}\nmodule.exports = r;","map":{"version":3,"names":["r","hljs","regex","IDENT_RE","NUMBER_TYPES_RE","either","OPERATORS_RE","PUNCTUATION_RE","name","keywords","$pattern","keyword","literal","built_in","contains","COMMENT","scope","match","starts","end","lookahead","endsParent","begin","variants","HASH_COMMENT_MODE","BACKSLASH_ESCAPE","END_SAME_AS_BEGIN","relevance","module","exports"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/highlight.js/lib/languages/r.js"],"sourcesContent":["/*\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: common,scientific\n*/\n\n/** @type LanguageFn */\nfunction r(hljs) {\n const regex = hljs.regex;\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 NUMBER_TYPES_RE = regex.either(\n // Special case: only hexadecimal binary powers can contain fractions\n /0[xX][0-9a-fA-F]+\\.[0-9a-fA-F]*[pP][+-]?\\d+i?/,\n // Hexadecimal numbers without fraction and optional binary power\n /0[xX][0-9a-fA-F]+(?:[pP][+-]?\\d+)?[Li]?/,\n // Decimal numbers\n /(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?[Li]?/\n );\n const OPERATORS_RE = /[=!<>:]=|\\|\\||&&|:::?|<-|<<-|->>|->|\\|>|[-+*\\/?!$&|:<=>@^~]|\\*\\*/;\n const PUNCTUATION_RE = regex.either(\n /[()]/,\n /[{}]/,\n /\\[\\[/,\n /[[\\]]/,\n /\\\\/,\n /,/\n );\n\n return {\n name: 'R',\n\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 { 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 scope: 'doctag',\n match: /@examples/,\n starts: {\n end: regex.lookahead(regex.either(\n // end if another doc comment\n /\\n^#'\\s*(?=@[a-zA-Z]+)/,\n // or a line with no comment\n /\\n^(?!#')/\n )),\n endsParent: true\n }\n },\n {\n // Handle `@param` to highlight the parameter name following\n // after.\n scope: 'doctag',\n begin: '@param',\n end: /$/,\n contains: [\n {\n scope: 'variable',\n variants: [\n { match: IDENT_RE },\n { match: /`(?:\\\\.|[^`\\\\])+`/ }\n ],\n endsParent: true\n }\n ]\n },\n {\n scope: 'doctag',\n match: /@[a-zA-Z]+/\n },\n {\n scope: 'keyword',\n match: /\\\\[a-zA-Z]+/\n }\n ] }\n ),\n\n hljs.HASH_COMMENT_MODE,\n\n {\n scope: 'string',\n contains: [ hljs.BACKSLASH_ESCAPE ],\n variants: [\n hljs.END_SAME_AS_BEGIN({\n begin: /[rR]\"(-*)\\(/,\n end: /\\)(-*)\"/\n }),\n hljs.END_SAME_AS_BEGIN({\n begin: /[rR]\"(-*)\\{/,\n end: /\\}(-*)\"/\n }),\n hljs.END_SAME_AS_BEGIN({\n begin: /[rR]\"(-*)\\[/,\n end: /\\](-*)\"/\n }),\n hljs.END_SAME_AS_BEGIN({\n begin: /[rR]'(-*)\\(/,\n end: /\\)(-*)'/\n }),\n hljs.END_SAME_AS_BEGIN({\n begin: /[rR]'(-*)\\{/,\n end: /\\}(-*)'/\n }),\n hljs.END_SAME_AS_BEGIN({\n begin: /[rR]'(-*)\\[/,\n end: /\\](-*)'/\n }),\n {\n begin: '\"',\n end: '\"',\n relevance: 0\n },\n {\n begin: \"'\",\n end: \"'\",\n relevance: 0\n }\n ],\n },\n\n // Matching numbers immediately following punctuation and operators is\n // tricky since we need to look at the character ahead of a number to\n // ensure the number is not part of an identifier, and we cannot use\n // negative look-behind assertions. So instead we explicitly handle all\n // possible combinations of (operator|punctuation), number.\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 relevance: 0,\n variants: [\n {\n scope: {\n 1: 'operator',\n 2: 'number'\n },\n match: [\n OPERATORS_RE,\n NUMBER_TYPES_RE\n ]\n },\n {\n scope: {\n 1: 'operator',\n 2: 'number'\n },\n match: [\n /%[^%]*%/,\n NUMBER_TYPES_RE\n ]\n },\n {\n scope: {\n 1: 'punctuation',\n 2: 'number'\n },\n match: [\n PUNCTUATION_RE,\n NUMBER_TYPES_RE\n ]\n },\n {\n scope: { 2: 'number' },\n match: [\n /[^a-zA-Z0-9._]|^/, // not part of an identifier, or start of document\n NUMBER_TYPES_RE\n ]\n }\n ]\n },\n\n // Operators/punctuation when they're not directly followed by numbers\n {\n // Relevance boost for the most common assignment form.\n scope: { 3: 'operator' },\n match: [\n IDENT_RE,\n /\\s+/,\n /<-/,\n /\\s+/\n ]\n },\n\n {\n scope: 'operator',\n relevance: 0,\n variants: [\n { match: OPERATORS_RE },\n { match: /%[^%]*%/ }\n ]\n },\n\n {\n scope: 'punctuation',\n relevance: 0,\n match: PUNCTUATION_RE\n },\n\n {\n // Escaped identifier\n begin: '`',\n end: '`',\n contains: [ { begin: /\\\\./ } ]\n }\n ]\n };\n}\n\nmodule.exports = r;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAASA,CAACA,CAACC,IAAI,EAAE;EACf,MAAMC,KAAK,GAAGD,IAAI,CAACC,KAAK;EACxB;EACA;EACA;EACA;EACA;EACA;EACA,MAAMC,QAAQ,GAAG,sDAAsD;E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EP,KAAK,EAAE;UACL,CAAC,EAAE,UAAU;UACb,CAAC,EAAE;QACL,CAAC;QACDC,KAAK,EAAE,CACLX,YAAY,EACZF,eAAe;MAEnB,CAAC,EACD;QACEY,KAAK,EAAE;UACL,CAAC,EAAE,UAAU;UACb,CAAC,EAAE;QACL,CAAC;QACDC,KAAK,EAAE,CACL,SAAS,EACTb,eAAe;MAEnB,CAAC,EACD;QACEY,KAAK,EAAE;UACL,CAAC,EAAE,aAAa;UAChB,CAAC,EAAE;QACL,CAAC;QACDC,KAAK,EAAE,CACLV,cAAc,EACdH,eAAe;MAEnB,CAAC,EACD;QACEY,KAAK,EAAE;UAAE,CAAC,EAAE;QAAS,CAAC;QACtBC,KAAK,EAAE,CACL,kBAAkB;QAAE;QACpBb,eAAe;MAEnB,CAAC;IAEL,CAAC;IAED;IACA;MACE;MACAY,KAAK,EAAE;QAAE,CAAC,EAAE;MAAW,CAAC;MACxBC,KAAK,EAAE,CACLd,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,KAAK;IAET,CAAC,EAED;MACEa,KAAK,EAAE,UAAU;MACjBW,SAAS,EAAE,CAAC;MACZJ,QAAQ,EAAE,CACR;QAAEN,KAAK,EAAEX;MAAa,CAAC,EACvB;QAAEW,KAAK,EAAE;MAAU,CAAC;IAExB,CAAC,EAED;MACED,KAAK,EAAE,aAAa;MACpBW,SAAS,EAAE,CAAC;MACZV,KAAK,EAAEV;IACT,CAAC,EAED;MACE;MACAe,KAAK,EAAE,GAAG;MACVH,GAAG,EAAE,GAAG;MACRL,QAAQ,EAAE,CAAE;QAAEQ,KAAK,EAAE;MAAM,CAAC;IAC9B,CAAC;EAEL,CAAC;AACH;AAEAM,MAAM,CAACC,OAAO,GAAG7B,CAAC","ignoreList":[]},"metadata":{},"sourceType":"script","externalDependencies":[]}
|