class Sass::Util::MultibyteStringScanner

def self.new(str)

def self.new(str)
  return StringScanner.new(str) if str.ascii_only?
  super
end

def _forward(str)

def _forward(str)
  @mb_last_pos = @mb_pos
  @mb_pos += str.size if str
  str
end

def _match(str)

def _match(str)
  @mb_matched_size = str && str.size
  str
end

def _matched(res)

def _matched(res)
  _match matched
  res
end

def _size(str)

def _size(str)
  str && str.size
end

def check(pattern); _match super; end

def check(pattern); _match super; end

def check_until(pattern); _matched super; end

def check_until(pattern); _matched super; end

def get_byte

def get_byte
  raise "MultibyteStringScanner doesn't support #get_byte."
end

def getbyte

def getbyte
  raise "MultibyteStringScanner doesn't support #getbyte."
end

def getch; _forward _match super; end

def getch; _forward _match super; end

def initialize(str)

def initialize(str)
  super(StringScanner.new(str))
  @mb_pos = 0
  @mb_matched_size = nil
  @mb_last_pos = nil
end

def initialize(str)

def initialize(str)
  super
  @mb_pos = 0
  @mb_matched_size = nil
  @mb_last_pos = nil
end

def is_a?(klass)

def is_a?(klass)
  __getobj__.is_a?(klass) || super
end

def match?(pattern); _size check(pattern); end

def match?(pattern); _size check(pattern); end

def matched_size; @mb_matched_size; end

def matched_size; @mb_matched_size; end

def peek(len); string[@mb_pos, len]; end

def peek(len); string[@mb_pos, len]; end

def pos; @mb_pos; end

def pos; @mb_pos; end

def pos=(n)

def pos=(n)
  @mb_last_pos = nil
  # We set position kind of a lot during parsing, so we want it to be as
  # efficient as possible. This is complicated by the fact that UTF-8 is a
  # variable-length encoding, so it's difficult to find the byte length that
  # corresponds to a given character length.
  #
  # Our heuristic here is to try to count the fewest possible characters. So
  # if the new position is close to the current one, just count the
  # characters between the two; if the new position is closer to the
  # beginning of the string, just count the characters from there.
  if @mb_pos - n < @mb_pos / 2
    # New position is close to old position
    byte_delta = @mb_pos > n ? -string[n...@mb_pos].bytesize : string[@mb_pos...n].bytesize
    super(byte_pos + byte_delta)
  else
    # New position is close to BOS
    super(string[0...n].bytesize)
  end
  @mb_pos = n
end

def reset

def reset
  @mb_pos = 0
  @mb_matched_size = nil
  @mb_last_pos = nil
  super
end

def rest_size; rest.size; end

def rest_size; rest.size; end

def scan(pattern); _forward _match super; end

def scan(pattern); _forward _match super; end

def scan_full(pattern, advance_pointer_p, return_string_p)

def scan_full(pattern, advance_pointer_p, return_string_p)
  res = _match super(pattern, advance_pointer_p, true)
  _forward res if advance_pointer_p
  return res if return_string_p
end

def scan_until(pattern); _forward _matched super; end

def scan_until(pattern); _forward _matched super; end

def search_full(pattern, advance_pointer_p, return_string_p)

def search_full(pattern, advance_pointer_p, return_string_p)
  res = super(pattern, advance_pointer_p, true)
  _forward res if advance_pointer_p
  _matched((res if return_string_p))
end

def skip(pattern); _size scan(pattern); end

def skip(pattern); _size scan(pattern); end

def skip_until(pattern); _matched _size scan_until(pattern); end

def skip_until(pattern); _matched _size scan_until(pattern); end

def string=(str)

def string=(str)
  @mb_pos = 0
  @mb_matched_size = nil
  @mb_last_pos = nil
  super
end

def terminate

def terminate
  @mb_pos = string.size
  @mb_matched_size = nil
  @mb_last_pos = nil
  super
end

def unscan

def unscan
  super
  @mb_pos = @mb_last_pos
  @mb_last_pos = @mb_matched_size = nil
end