Method: Andromeda::Cmd::Reader#match_line

Defined in:
lib/andromeda/cmd.rb

#match_line(state, line) {|:garbage, state, line| ... } ⇒ Object

Yields:

  • (:garbage, state, line)


167
168
169
170
171
172
173
174
175
176
177
# File 'lib/andromeda/cmd.rb', line 167

def match_line(state, line)
  m = @start_matcher.match line
  return yield :start, state, ({ cmd: m[1].to_sym, tim: m[2].to_i, len: m[3].to_i }) if m
  m = @end_matcher.match line
  return yield :end, state, m[1].to_sym if m
  m = @comment_matcher.match line
  return yield :comment, state, m[1] if m
  m = @line_matcher.match line
  return yield :line, state, m[1] if m
  yield :garbage, state, line
end