Class: Rouge::Lexers::R

Inherits:
RegexLexer show all
Defined in:
lib/rouge/lexers/r.rb

Constant Summary collapse

KEYWORDS =
%w(if else for while repeat in next break function)
KEYWORD_CONSTANTS =
%w(
  NULL Inf TRUE FALSE NaN NA
  NA_integer_ NA_real_ NA_complex_ NA_character_
)
BUILTIN_CONSTANTS =
%w(LETTERS letters month.abb month.name pi T F)
PRIMITIVE_FUNCTIONS =

These are all the functions in ‘base` that are implemented as a `.Primitive`, minus those functions that are also keywords.

%w(
  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
)

Constants inherited from RegexLexer

RegexLexer::MAX_NULL_SCANS

Constants included from Token::Tokens

Token::Tokens::Num, Token::Tokens::Str

Class Method Summary collapse

Methods inherited from RegexLexer

append, #delegate, get_state, #get_state, #goto, #group, #groups, #in_state?, #pop!, prepend, #push, #recurse, replace_state, #reset!, #reset_stack, #stack, start, start_procs, #state, state, #state?, state_definitions, states, #step, #stream_tokens, #token

Methods inherited from Rouge::Lexer

aliases, all, assert_utf8!, #debug, default_options, demo, demo_file, desc, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #initialize, lex, #lex, mimetypes, #option, #options, #reset!, #stream_tokens, tag, #tag, title

Methods included from Token::Tokens

token

Constructor Details

This class inherits a constructor from Rouge::Lexer

Class Method Details

.analyze_text(text) ⇒ Object



46
47
48
# File 'lib/rouge/lexers/r.rb', line 46

def self.analyze_text(text)
  return 1 if text.shebang? 'Rscript'
end