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

Instance Attribute Summary

Attributes inherited from Rouge::Lexer

#options

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, #as_bool, #as_lexer, #as_list, #as_string, #as_token, assert_utf8!, #bool_option, continue_lex, #continue_lex, debug_enabled?, demo, demo_file, desc, detectable?, disable_debug!, enable_debug!, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #hash_option, #initialize, #lex, lex, #lexer_option, #list_option, lookup_fancy, mimetypes, option, option_docs, #reset!, #stream_tokens, #string_option, tag, #tag, title, #token_option, #with

Methods included from Token::Tokens

token

Constructor Details

This class inherits a constructor from Rouge::Lexer

Class Method Details

.detect?(text) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.detect?(text)
  return true if text.shebang? 'Rscript'
end