Class: Rux::DebugLexer

Inherits:
Object
  • Object
show all
Defined in:
lib/rux/debug_lexer.rb

Instance Method Summary collapse

Constructor Details

#initializeDebugLexer

Returns a new instance of DebugLexer.



3
4
5
6
7
# File 'lib/rux/debug_lexer.rb', line 3

def initialize(...)
  @lexer = Lexer.new(...)
  @tokens = @lexer.to_a
  @counter = -1
end

Instance Method Details

#advanceObject



13
14
15
16
17
18
19
20
21
# File 'lib/rux/debug_lexer.rb', line 13

def advance
  @counter += 1

  if @counter >= @tokens.size
    [nil, ['$eof']]
  else
    @tokens[@counter]
  end
end

#source_bufferObject



9
10
11
# File 'lib/rux/debug_lexer.rb', line 9

def source_buffer
  @lexer.source_buffer
end