Class: MarshalParser::Lexer

Inherits:
Object
  • Object
show all
Defined in:
lib/marshal-parser/lexer.rb

Defined Under Namespace

Classes: Token

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_string) ⇒ Lexer

Returns a new instance of Lexer.



44
45
46
47
# File 'lib/marshal-parser/lexer.rb', line 44

def initialize(source_string)
  @dump = source_string
  @tokens = []
end

Instance Attribute Details

#tokensObject (readonly)

Returns the value of attribute tokens.



42
43
44
# File 'lib/marshal-parser/lexer.rb', line 42

def tokens
  @tokens
end

Instance Method Details

#runObject



49
50
51
52
53
54
55
# File 'lib/marshal-parser/lexer.rb', line 49

def run
  @index = 0
  @tokens = []

  read_version
  read
end

#source_stringObject



57
58
59
# File 'lib/marshal-parser/lexer.rb', line 57

def source_string
  @dump
end