Class: Kapusta::Compiler::Language::CountedForForm

Inherits:
Struct
  • Object
show all
Defined in:
lib/kapusta/compiler/language.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bindingsObject

Returns the value of attribute bindings

Returns:

  • (Object)

    the current value of bindings



93
94
95
# File 'lib/kapusta/compiler/language.rb', line 93

def bindings
  @bindings
end

#bodyObject

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



93
94
95
# File 'lib/kapusta/compiler/language.rb', line 93

def body
  @body
end

Instance Method Details

#counterObject



96
# File 'lib/kapusta/compiler/language.rb', line 96

def counter = items[0]

#each_extraObject



104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/kapusta/compiler/language.rb', line 104

def each_extra
  i = 0
  while i < extras.length
    item = extras[i]
    if item.is_a?(Sym) && item.name == '&until'
      yield :until, extras[i + 1]
      i += 2
    else
      yield :step, item
      i += 1
    end
  end
end

#extrasObject



102
# File 'lib/kapusta/compiler/language.rb', line 102

def extras = items[3..] || []

#finishObject



100
# File 'lib/kapusta/compiler/language.rb', line 100

def finish = items[2]

#itemsObject



94
# File 'lib/kapusta/compiler/language.rb', line 94

def items = bindings.is_a?(Vec) ? bindings.items : []

#startObject



98
# File 'lib/kapusta/compiler/language.rb', line 98

def start = items[1]