class IDL::AST::Leaf

def set_repo_id(id)

def set_repo_id(id)
  if @repo_id
    if id != @repo_id
      raise "#{self.scoped_name} already has a different repository ID assigned: #{@repo_id}"
    end
  end
  id_arr = id.split(':')
  if @repo_ver
    if id_arr.first != 'IDL' or id_arr.last != @repo_ver
      raise "supplied repository ID (#{id}) does not match previously assigned repository version for #{self.scoped_name} = #{@repo_ver}"
    end
  end
  # check validity of IDL format repo IDs
  if id_arr.first == 'IDL'
    id_arr.shift
    id_str = id_arr.shift.to_s
    raise 'ID identifiers should not start or end with \'/\'' if id_str[0, 1] == '/' or id_str[-1, 1] == '/'
    raise "ID identifiers should not start with one of '#{REPO_ID_XCHARS.join("', '")}'" if REPO_ID_XCHARS.include?(id_str[0, 1])
    raise 'Invalid ID! Only a..z, A..Z, 0..9, \'.\', \'-\', \'_\' or \'\/\' allowed for identifiers' unless REPO_ID_RE =~ id_str
  end
  @repo_id = id
end