l0bsterssg

node.js static responsive blog post generator
Log | Files | Refs | README

r.js (1906B)


      1 /*
      2 Language: R
      3 Description: R is a free software environment for statistical computing and graphics.
      4 Author: Joe Cheng <joe@rstudio.org>
      5 Website: https://www.r-project.org
      6 Category: scientific
      7 */
      8 
      9 function r(hljs) {
     10   var IDENT_RE = '([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*';
     11 
     12   return {
     13     name: 'R',
     14     contains: [
     15       hljs.HASH_COMMENT_MODE,
     16       {
     17         begin: IDENT_RE,
     18         keywords: {
     19           $pattern: IDENT_RE,
     20           keyword:
     21             'function if in break next repeat else for return switch while try tryCatch ' +
     22             'stop warning require library attach detach source setMethod setGeneric ' +
     23             'setGroupGeneric setClass ...',
     24           literal:
     25             'NULL NA TRUE FALSE T F Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 ' +
     26             'NA_complex_|10'
     27         },
     28         relevance: 0
     29       },
     30       {
     31         // hex value
     32         className: 'number',
     33         begin: "0[xX][0-9a-fA-F]+[Li]?\\b",
     34         relevance: 0
     35       },
     36       {
     37         // explicit integer
     38         className: 'number',
     39         begin: "\\d+(?:[eE][+\\-]?\\d*)?L\\b",
     40         relevance: 0
     41       },
     42       {
     43         // number with trailing decimal
     44         className: 'number',
     45         begin: "\\d+\\.(?!\\d)(?:i\\b)?",
     46         relevance: 0
     47       },
     48       {
     49         // number
     50         className: 'number',
     51         begin: "\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",
     52         relevance: 0
     53       },
     54       {
     55         // number with leading decimal
     56         className: 'number',
     57         begin: "\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",
     58         relevance: 0
     59       },
     60 
     61       {
     62         // escaped identifier
     63         begin: '`',
     64         end: '`',
     65         relevance: 0
     66       },
     67 
     68       {
     69         className: 'string',
     70         contains: [hljs.BACKSLASH_ESCAPE],
     71         variants: [
     72           {begin: '"', end: '"'},
     73           {begin: "'", end: "'"}
     74         ]
     75       }
     76     ]
     77   };
     78 }
     79 
     80 module.exports = r;