Class: Rubycc::Front::InitializerResolver::Cursor
- Inherits:
-
Object
- Object
- Rubycc::Front::InitializerResolver::Cursor
- Defined in:
- lib/rubycc/front/initializer_resolver.rb
Overview
A forward cursor over one brace level's items. Brace elision hands the same cursor to a subobject's fill so it continues where the parent left off; an explicit nested brace gets a fresh cursor over its own items.
Instance Method Summary collapse
- #advance ⇒ Object
- #eof? ⇒ Boolean
-
#initialize(items) ⇒ Cursor
constructor
A new instance of Cursor.
- #peek ⇒ Object
Constructor Details
#initialize(items) ⇒ Cursor
Returns a new instance of Cursor.
66 67 68 69 |
# File 'lib/rubycc/front/initializer_resolver.rb', line 66 def initialize(items) @items = items @pos = 0 end |
Instance Method Details
#advance ⇒ Object
79 80 81 82 83 |
# File 'lib/rubycc/front/initializer_resolver.rb', line 79 def advance item = @items[@pos] @pos += 1 item end |
#eof? ⇒ Boolean
71 72 73 |
# File 'lib/rubycc/front/initializer_resolver.rb', line 71 def eof? @pos >= @items.size end |
#peek ⇒ Object
75 76 77 |
# File 'lib/rubycc/front/initializer_resolver.rb', line 75 def peek @items[@pos] end |