readName static method

String readName(
  1. UDocCursor cursor
)

Implementation

static String readName(UDocCursor cursor) {
  cursor.skip(1);
  final StringBuffer buffer = StringBuffer();
  while (!cursor.isEmpty && isRegular(cursor.peek)) {
    final int byte = cursor.u8();
    if (byte == 0x23 && cursor.remaining >= 2) {
      final int high = _hex(cursor.peekAt(0));
      final int low = _hex(cursor.peekAt(1));
      if (high >= 0 && low >= 0) {
        cursor.skip(2);
        buffer.writeCharCode((high << 4) | low);
        continue;
      }
    }
    buffer.writeCharCode(byte);
  }
  return buffer.toString();
}