def _parse_hierarchy(self, bvh):
    self.current_token = 0
    if (bvh[self.current_token] != ('IDENT', 'HIERARCHY')):
        return None
    self.current_token = (self.current_token + 1)
    if (bvh[self.current_token] != ('IDENT', 'ROOT')):
        return None
    self.current_token = (self.current_token + 1)
    if (bvh[self.current_token][0] != 'IDENT'):
        return None
    root_name = bvh[self.current_token][1]
    root_bone = self._new_bone(None, root_name)
    self.current_token = (self.current_token + 2)
    (offsets, self.current_token) = self._read_offset(bvh, self.current_token)
    (channels, self.current_token) = self._read_channels(bvh, self.current_token)
    root_bone['offsets'] = offsets
    root_bone['channels'] = channels
    self._skeleton[root_name] = root_bone
    self._push_bone_context(root_name)
    for channel in channels:
        self._motion_channels.append((root_name, channel))
    while (bvh[self.current_token][1] == 'JOINT'):
        self.current_token = self._parse_joint(bvh, self.current_token)
    self.root_name = root_name
def _parse_hierarchy(self, bvh):
    self.current_token = 0
    if (bvh[self.current_token] != ('IDENT', 'HIERARCHY')):
        return None
    self.current_token = (self.current_token + 1)
    if (bvh[self.current_token] != ('IDENT', 'ROOT')):
        return None
    self.current_token = (self.current_token + 1)
    if (bvh[self.current_token][0] != 'IDENT'):
        return None
    root_name = bvh[self.current_token][1]
    root_bone = self._new_bone(None, root_name)
    self.current_token = (self.current_token + 2)
    (offsets, self.current_token) = self._read_offset(bvh, self.current_token)
    (channels, self.current_token) = self._read_channels(bvh, self.current_token)
    root_bone['offsets'] = offsets
    root_bone['channels'] = channels
    self._skeleton[root_name] = root_bone
    self._push_bone_context(root_name)
    for channel in channels:
        self._motion_channels.append((root_name, channel))
    while (bvh[self.current_token][1] == 'JOINT'):
        self.current_token = self._parse_joint(bvh, self.current_token)
    self.root_name = root_name