================================================================================
Parser example custom types
================================================================================

type A { A }
type A { A(String) }
type Box(inner_type) { Box(inner: inner_type) }
type NamedBox(inner_type) { Box(String, inner: inner_type) }

--------------------------------------------------------------------------------

(source_file
  (type_definition
    (type_name
      name: (type_identifier))
    (data_constructors
      (data_constructor
        name: (constructor_name))))
  (type_definition
    (type_name
      name: (type_identifier))
    (data_constructors
      (data_constructor
        name: (constructor_name)
        arguments: (data_constructor_arguments
          (data_constructor_argument
            value: (type
              name: (type_identifier)))))))
  (type_definition
    (type_name
      name: (type_identifier)
      parameters: (type_parameters
        (type_parameter)))
    (data_constructors
      (data_constructor
        name: (constructor_name)
        arguments: (data_constructor_arguments
          (data_constructor_argument
            label: (label)
            value: (type_var))))))
  (type_definition
    (type_name
      name: (type_identifier)
      parameters: (type_parameters
        (type_parameter)))
    (data_constructors
      (data_constructor
        name: (constructor_name)
        arguments: (data_constructor_arguments
          (data_constructor_argument
            value: (type
              name: (type_identifier)))
          (data_constructor_argument
            label: (label)
            value: (type_var)))))))

================================================================================
Other custom type examples
================================================================================

type Cat {
  Cat(name: String, cuteness: Int)
}

type Animal() {
  Cat(name: String, cuteness: Int)
  Dog(name: String, cuteness: Int)
}

type Result(success_type, failure_type) {
  Ok(success_type)
  Error(failure_type)
}

type Ord {
  LT
  EQ
  GT
}

type Boring {
  Boring
}

--------------------------------------------------------------------------------

(source_file
  (type_definition
    (type_name
      name: (type_identifier))
    (data_constructors
      (data_constructor
        name: (constructor_name)
        arguments: (data_constructor_arguments
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier)))
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier)))))))
  (type_definition
    (type_name
      name: (type_identifier)
      parameters: (type_parameters))
    (data_constructors
      (data_constructor
        name: (constructor_name)
        arguments: (data_constructor_arguments
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier)))
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier)))))
      (data_constructor
        name: (constructor_name)
        arguments: (data_constructor_arguments
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier)))
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier)))))))
  (type_definition
    (type_name
      name: (type_identifier)
      parameters: (type_parameters
        (type_parameter)
        (type_parameter)))
    (data_constructors
      (data_constructor
        name: (constructor_name)
        arguments: (data_constructor_arguments
          (data_constructor_argument
            value: (type_var))))
      (data_constructor
        name: (constructor_name)
        arguments: (data_constructor_arguments
          (data_constructor_argument
            value: (type_var))))))
  (type_definition
    (type_name
      name: (type_identifier))
    (data_constructors
      (data_constructor
        name: (constructor_name))
      (data_constructor
        name: (constructor_name))
      (data_constructor
        name: (constructor_name))))
  (type_definition
    (type_name
      name: (type_identifier))
    (data_constructors
      (data_constructor
        name: (constructor_name)))))

================================================================================
Public custom type definitions
================================================================================

pub type Animal(name, cuteness) {
  Cat(name: String, cuteness: Int)
  Dog(name: String, cuteness: Int)
}

--------------------------------------------------------------------------------

(source_file
  (type_definition
    (visibility_modifier)
    (type_name
      name: (type_identifier)
      parameters: (type_parameters
        (type_parameter)
        (type_parameter)))
    (data_constructors
      (data_constructor
        name: (constructor_name)
        arguments: (data_constructor_arguments
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier)))
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier)))))
      (data_constructor
        name: (constructor_name)
        arguments: (data_constructor_arguments
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier)))
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier))))))))

================================================================================
Public opaque custom type definitions
================================================================================

pub opaque type Animal(name, cuteness) {
  Cat(name: String, cuteness: Int)
  Dog(name: String, cuteness: Int)
}

--------------------------------------------------------------------------------

(source_file
  (type_definition
    (visibility_modifier)
    (opacity_modifier)
    (type_name
      name: (type_identifier)
      parameters: (type_parameters
        (type_parameter)
        (type_parameter)))
    (data_constructors
      (data_constructor
        name: (constructor_name)
        arguments: (data_constructor_arguments
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier)))
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier)))))
      (data_constructor
        name: (constructor_name)
        arguments: (data_constructor_arguments
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier)))
          (data_constructor_argument
            label: (label)
            value: (type
              name: (type_identifier))))))))
