docs: def _next_code_point_handler(whence, ctx):
      """Retrieves the next code point from within a quoted string or symbol."""
      data_event, self = yield
      queue = ctx.queue
      unicode_escapes_allowed = ctx.ion_type is not IonType.CLOB
      escaped_newline = False
      escape_sequence = b''
      low_surrogate_required = False
      while True:
          if len(queue) == 0:
              yield ctx.read_data_event(self)
          queue_iter = iter(queue)
          code_point_generator = _next_code_point_iter(queue, queue_iter)
          code_point = next(code_point_generator)
          if code_point == _BACKSLASH:
              escape_sequence += six.int2byte(_BACKSLASH)
              num_digits = None
              while True:
                  if len(queue) == 0:
                      yield ctx.read_data_event(self)
                  code_point = next(queue_iter)
                  if six.indexbytes(escape_sequence, -1) == _BACKSLASH:
                      if code_point == _ord(b'u') and unicode_escapes_allowed:
                          # 4-digit unicode escapes, plus '\u' for each surrogate
                          num_digits = 12 if low_surrogate_required else 6
                          low_surrogate_required = False
                      elif low_surrogate_required:
                          _illegal_character(code_point, ctx,
                                             'Unpaired high surrogate escape sequence %s.' % (escape_sequence,))
                      elif code_point == _ord(b'x'):
                          num_digits = 4  # 2-digit hex escapes
                      elif code_point == _ord(b'U') and unicode_escapes_allowed:
                          num_digits = 10  # 8-digit unicode escapes
                      elif code_point in _COMMON_ESCAPES:
                          if code_point == _SLASH or code_point == _QUESTION_MARK:
                              escape_sequence = b''  # Drop the \. Python does not recognize these as escapes.
                          escape_sequence += six.int2byte(code_point)
                          break
                      elif code_point in _NEWLINES:
                          escaped_newline = True
                          break
                      else:
                          # This is a backslash followed by an invalid escape character. This is illegal.
                          _illegal_character(code_point, ctx, 'Invalid escape sequence \\%s.' % (_chr(code_point),))
                      escape_sequence += six.int2byte(code_point)
                  else:
                      if code_point not in _HEX_DIGITS:
                          _illegal_character(code_point, ctx,
                                             'Non-hex character %s found in unicode escape.' % (_chr(code_point),))
                      escape_sequence += six.int2byte(code_point)
                      if len(escape_sequence) == num_digits:
                          break
              if not escaped_newline:
                  decoded_escape_sequence = escape_sequence.decode('unicode-escape')
                  cp_iter = _next_code_point_iter(decoded_escape_sequence, iter(decoded_escape_sequence), to_int=ord)
                  code_point = next(cp_iter)
                  if code_point is None:
                      # This is a high surrogate. Restart the loop to gather the low surrogate.
                      low_surrogate_required = True
                      continue
                  code_point = CodePoint(code_point)
                  code_point.char = decoded_escape_sequence
                  code_point.is_escaped = True
                  ctx.set_code_point(code_point)
                  yield Transition(None, whence)
          elif low_surrogate_required:
              _illegal_character(code_point, ctx, 'Unpaired high surrogate escape sequence %s.' % (escape_sequence,))
          if code_point == _CARRIAGE_RETURN:
              # Normalize all newlines (\r, \n, and \r\n) to \n .
              if len(queue) == 0:
                  yield ctx.read_data_event(self)
              code_point = next(queue_iter)
              if code_point != _NEWLINE:
                  queue.unread(code_point)
                  code_point = _NEWLINE
          while code_point is None:
              yield ctx.read_data_event(self)
              code_point = next(code_point_generator)
          if escaped_newline:
              code_point = CodePoint(code_point)
              code_point.char = _ESCAPED_NEWLINE
              code_point.is_escaped = True
          ctx.set_code_point(code_point)
          yield Transition(None, whence)