class Regexp::Scanner

def emit(type, token, text)

Emits an array with the details of the scanned pattern
def emit(type, token, text)
  #puts "EMIT: type: #{type}, token: #{token}, text: #{text}, ts: #{ts}, te: #{te}"
  emit_literal if literal_run
  # Ragel runs with byte-based indices (ts, te). These are of little value to
  # end-users, so we keep track of char-based indices and emit those instead.
  ts_char_pos = char_pos
  te_char_pos = char_pos + text.length
  tok = [type, token, text, ts_char_pos, te_char_pos]
  self.prev_token = tok
  self.char_pos = te_char_pos
  if block
    block.call type, token, text, ts_char_pos, te_char_pos
    # TODO: in v3.0.0,remove `collect_tokens:` kwarg and only collect if no block given
    tokens << tok if collect_tokens
  elsif collect_tokens
    tokens << tok
  end
end