Class: Rouge::Lexers::IRBLexer

Inherits:
ConsoleLexer show all
Defined in:
lib/rouge/lexers/irb.rb

Constant Summary

Constants included from Token::Tokens

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

Instance Attribute Summary

Attributes inherited from Rouge::Lexer

#options

Instance Method Summary collapse

Methods inherited from ConsoleLexer

#comment_regex, #end_chars, #error_regex, #initialize, #line_regex, #process_line, #prompt_prefix_regex, #stream_tokens

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, detect?, 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::Lexers::ConsoleLexer

Instance Method Details

#allow_comments?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/rouge/lexers/irb.rb', line 35

def allow_comments?
  true
end

#lang_lexerObject



21
22
23
# File 'lib/rouge/lexers/irb.rb', line 21

def lang_lexer
  @lang_lexer ||= Ruby.new(@options)
end

#output_lexerObject



17
18
19
# File 'lib/rouge/lexers/irb.rb', line 17

def output_lexer
  @output_lexer ||= IRBOutputLexer.new(@options)
end

#prompt_regexObject



25
26
27
28
29
30
31
32
33
# File 'lib/rouge/lexers/irb.rb', line 25

def prompt_regex
  %r(
    ^.*?
    (
      (irb|pry).*?[>"*] |
      [>"*]>
    )
  )x
end