Module: CodeMiner::LoopProcessor

Included in:
Parser
Defined in:
lib/codeminer/processors/loop_processor.rb

Instance Method Summary collapse

Instance Method Details

#on_for(params, receiver, body) ⇒ Object



23
24
25
26
# File 'lib/codeminer/processors/loop_processor.rb', line 23

def on_for(params, receiver, body)
  params_container = ExpressionContainer.wrap(params, :positional)
  ForExpression.new(params_container, receiver, body, extract_src_by_token(pop_keyword('for')))
end

#on_until(test, body) ⇒ Object



10
11
12
# File 'lib/codeminer/processors/loop_processor.rb', line 10

def on_until(test, body)
  UntilExpression.new(test, body, extract_src_by_token(pop_keyword('until')))
end

#on_until_mod(test, body) ⇒ Object



5
6
7
8
# File 'lib/codeminer/processors/loop_processor.rb', line 5

def on_until_mod(test, body)
  pop_keyword('until')
  UntilExpression.new(test, body, extract_src_by_token(body))
end

#on_while(test, body) ⇒ Object



14
15
16
# File 'lib/codeminer/processors/loop_processor.rb', line 14

def on_while(test, body)
  WhileExpression.new(test, body, extract_src_by_token(pop_keyword('while')))
end

#on_while_mod(test, body) ⇒ Object



18
19
20
21
# File 'lib/codeminer/processors/loop_processor.rb', line 18

def on_while_mod(test, body)
  pop_keyword('while')
  WhileExpression.new(test, body, extract_src_by_token(body))
end