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!, eager_load!, #eager_load!, enable_debug!, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #hash_option, #initialize, lazy, lex, #lex, #lexer_option, #list_option, lookup_fancy, mimetypes, option, option_docs, #reset!, skip_auto_load?, #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)


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

def allow_comments?
  true
end

#lang_lexerObject



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

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

#output_lexerObject



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

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

#prompt_regexObject



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

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