docs: def declare(full_table_name, definition, context):
      """
      Parse declaration and create new SQL table accordingly.
  
      :param full_table_name: full name of the table
      :param definition: DataJoint table definition
      :param context: dictionary of objects that might be referred to in the table.
      """
  
      table_name = full_table_name.strip('`').split('.')[1]
      if len(table_name) > MAX_TABLE_NAME_LENGTH:
          raise DataJointError(
              'Table name `{name}` exceeds the max length of {max_length}'.format(
                  name=table_name,
                  max_length=MAX_TABLE_NAME_LENGTH))
      # split definition into lines
      definition = re.split(r'\s*\n\s*', definition.strip())
      # check for optional table comment
      table_comment = definition.pop(0)[1:].strip() if definition[0].startswith('#') else ''
      in_key = True  # parse primary keys
      primary_key = []
      attributes = []
      attribute_sql = []
      foreign_key_sql = []
      index_sql = []
      uses_external = False
  
      for line in definition:
          if line.startswith('#'):  # additional comments are ignored
              pass
          elif line.startswith('---') or line.startswith('___'):
              in_key = False  # start parsing dependent attributes
          elif is_foreign_key(line):
              compile_foreign_key(line, context, attributes,
                                  primary_key if in_key else None,
                                  attribute_sql, foreign_key_sql, index_sql)
          elif re.match(r'^(unique\s+)?index[^:]*$', line, re.I):   # index
              compile_index(line, index_sql)
          else:
              name, sql, is_external = compile_attribute(line, in_key, foreign_key_sql)
              uses_external = uses_external or is_external
              if in_key and name not in primary_key:
                  primary_key.append(name)
              if name not in attributes:
                  attributes.append(name)
                  attribute_sql.append(sql)
      # compile SQL
      if not primary_key:
          raise DataJointError('Table must have a primary key')
  
      return (
          'CREATE TABLE IF NOT EXISTS %s (\n' % full_table_name +
          ',\n'.join(attribute_sql + ['PRIMARY KEY (`' + '`,`'.join(primary_key) + '`)'] + foreign_key_sql + index_sql) +
          '\n) ENGINE=InnoDB, COMMENT "%s"' % table_comment), uses_external