derived/ast

Types

pub type Attribute {
  Target(target: Target)
  Deprecated(reason: String)
  Internal
}

Constructors

  • Target(target: Target)
  • Deprecated(reason: String)
  • Internal
pub type DerivedType {
  DerivedType(
    span: #(Int, Int),
    docstring: String,
    attributes: List(Attribute),
    publicity: Publicity,
    opaque_: Bool,
    parsed_type: Type,
    derived_names: List(String),
  )
}

Constructors

  • DerivedType(
      span: #(Int, Int),
      docstring: String,
      attributes: List(Attribute),
      publicity: Publicity,
      opaque_: Bool,
      parsed_type: Type,
      derived_names: List(String),
    )
pub type Field {
  LabelledField(field_type: FieldType, label: String)
  UnlabelledField(field_type: FieldType)
}

Constructors

  • LabelledField(field_type: FieldType, label: String)
  • UnlabelledField(field_type: FieldType)
pub type FieldType {
  NamedType(
    name: String,
    module: option.Option(String),
    parameters: List(FieldType),
  )
  TupleType(elements: List(FieldType))
  FunctionType(parameters: List(FieldType), return: FieldType)
  VariableType(name: String)
}

Constructors

pub type ParseError {
  UnexpectedToken
  IgnoredToken
}

Constructors

  • UnexpectedToken

    Encountered an unexpected token while parsing a derived type

  • IgnoredToken

    Encountered an unexpected token in a place where unknown tokens are expected (e.g. while parsing a function)

pub type Publicity {
  Public
  Private
}

Constructors

  • Public
  • Private
pub type Target {
  Erlang
  Javascript
}

Constructors

  • Erlang
  • Javascript
pub type Type {
  Type(
    name: String,
    parameters: List(String),
    variants: List(Variant),
  )
}

Constructors

  • Type(
      name: String,
      parameters: List(String),
      variants: List(Variant),
    )
pub type Variant {
  Variant(
    name: String,
    docstring: String,
    fields: List(Field),
    attributes: List(Attribute),
  )
}

Constructors

  • Variant(
      name: String,
      docstring: String,
      fields: List(Field),
      attributes: List(Attribute),
    )

Values

pub fn parse(input: String) -> List(DerivedType)

Extract any custom types marked with !derived() from the input string including their docstrings.

All other syntaxes (including invalid syntaxes) are ignored

Search Document