Class: ComponentEmbeddedRuby::Parser::TokenReader
- Inherits:
-
Object
- Object
- ComponentEmbeddedRuby::Parser::TokenReader
- Defined in:
- lib/component_embedded_ruby/parser/token_reader.rb
Instance Method Summary collapse
- #current_token ⇒ Object
-
#initialize(tokens) ⇒ TokenReader
constructor
A new instance of TokenReader.
- #next ⇒ Object
- #peek_token ⇒ Object
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_token ⇒ Object
11 12 13 |
# File 'lib/component_embedded_ruby/parser/token_reader.rb', line 11 def current_token @tokens[@position] end |
#next ⇒ Object
19 20 21 |
# File 'lib/component_embedded_ruby/parser/token_reader.rb', line 19 def next @position += 1 end |
#peek_token ⇒ Object
15 16 17 |
# File 'lib/component_embedded_ruby/parser/token_reader.rb', line 15 def peek_token @tokens[@position + 1] end |