Class: RDist::Analyzer::State::WaitingBlock

Inherits:
Base
  • Object
show all
Defined in:
lib/rdist/analyzer/state/waitingblock.rb

Direct Known Subclasses

InBlock

Instance Method Summary collapse

Methods inherited from Base

#reset

Constructor Details

#initialize(analyzer) ⇒ WaitingBlock

Returns a new instance of WaitingBlock.



5
6
7
8
9
# File 'lib/rdist/analyzer/state/waitingblock.rb', line 5

def initialize(analyzer)
  super(analyzer)
  @pattern_open_token = analyzer.pattern_open_token
  @pattern_close_token = analyzer.pattern_close_token
end

Instance Method Details

#analyze(line) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rdist/analyzer/state/waitingblock.rb', line 12

def analyze(line)
  if end_of_code?(line)
    return @analyzer.set_state_after_end_of_code_marker
  end
  if multi_line_comment_begin?(line)
    return @analyzer.set_state_in_multi_line_comment
  end
  return if one_linear_block?(line)
  return unless (match_data = have_open_token?(line))
  indent = get_indent_from(match_data)
  block_name = get_block_name_from(match_data)
  @analyzer.set_state_in_block(indent, block_name)
end