Class: ComponentEmbeddedRuby::Parser::TokenReader

Inherits:
Object
  • Object
show all
Defined in:
lib/component_embedded_ruby/parser/token_reader.rb

Instance Method Summary collapse

Constructor Details

#initialize(tokens) ⇒ TokenReader

Returns a new instance of TokenReader.



6
7
8
9
# File 'lib/component_embedded_ruby/parser/token_reader.rb', line 6

def initialize(tokens)
  @tokens = tokens
  @position = 0
end

Instance Method Details

#current_tokenObject



11
12
13
# File 'lib/component_embedded_ruby/parser/token_reader.rb', line 11

def current_token
  @tokens[@position]
end

#nextObject



19
20
21
# File 'lib/component_embedded_ruby/parser/token_reader.rb', line 19

def next
  @position += 1
end

#peek_tokenObject



15
16
17
# File 'lib/component_embedded_ruby/parser/token_reader.rb', line 15

def peek_token
  @tokens[@position + 1]
end