Class: Ripper::Lexer

Inherits:
Ripper show all
Defined in:
lib/ripper/lexer.rb

Overview

:nodoc: internal use only

Defined Under Namespace

Classes: Elem

Constant Summary

Constants inherited from Ripper

EVENTS, PARSER_EVENTS, SCANNER_EVENTS, Version

Instance Method Summary collapse

Methods inherited from Ripper

#column, dedent_string, #encoding, #end_seen?, #error?, #filename, #initialize, lex, #lineno, parse, sexp, sexp_raw, slice, token_match, tokenize, #yydebug, #yydebug=

Constructor Details

This class inherits a constructor from Ripper

Instance Method Details

#lexObject



54
55
56
# File 'lib/ripper/lexer.rb', line 54

def lex
  parse().sort_by(&:pos).map(&:to_a)
end

#parseObject



58
59
60
61
62
63
64
# File 'lib/ripper/lexer.rb', line 58

def parse
  @buf = []
  @stack = []
  super
  @buf.flatten!
  @buf
end

#tokenizeObject



50
51
52
# File 'lib/ripper/lexer.rb', line 50

def tokenize
  parse().sort_by(&:pos).map(&:tok)
end