class CodeRay::Encoders::Encoder

def token content, kind

or end_line, depending on the +content+.
By default, it calls text_token, begin_group, end_group, begin_line,

For simple scanners, it's enougth to implement this method.
Called with +content+ and +kind+ of the currently scanned token.
def token content, kind
  case content
  when String
    text_token content, kind
  when :begin_group
    begin_group kind
  when :end_group
    end_group kind
  when :begin_line
    begin_line kind
  when :end_line
    end_line kind
  else
    raise ArgumentError, 'Unknown token content type: %p, kind = %p' % [content, kind]
  end
end