atproto_mlf/mlf_ast

The parser’s intermediate tree: a near-literal shape of mlf source, before lowering to atproto_lexicon/ast. It keeps mlf-only notions (inline types, self {}, use imports, annotations, tokens-in-enums) that the target lexicon AST either expands away or represents differently. lower consumes this tree.

Types

pub type AnnArg {
  Positional(value: AnnValue)
  Named(name: String, value: AnnValue)
}

Constructors

pub type AnnValue {
  AvString(value: String)
  AvInt(value: Int)
  AvFloat(value: Float)
  AvBool(value: Bool)
  AvNull
  AvArray(values: List(AnnValue))
  AvObject(entries: List(#(String, AnnValue)))
  AvRef(path: List(String))
}

Constructors

  • AvString(value: String)
  • AvInt(value: Int)
  • AvFloat(value: Float)
  • AvBool(value: Bool)
  • AvNull
  • AvArray(values: List(AnnValue))
  • AvObject(entries: List(#(String, AnnValue)))
  • AvRef(path: List(String))
pub type Annotation {
  Annotation(
    selectors: List(String),
    name: String,
    args: List(AnnArg),
  )
}

Constructors

  • Annotation(
      selectors: List(String),
      name: String,
      args: List(AnnArg),
    )
pub type CValue {
  CvString(value: String)
  CvInt(value: Int)
  CvBool(value: Bool)
  CvRef(path: List(String))
}

Constructors

  • CvString(value: String)
  • CvInt(value: Int)
  • CvBool(value: Bool)
  • CvRef(path: List(String))
pub type Constraint {
  CMinLength(value: Int)
  CMaxLength(value: Int)
  CMinGraphemes(value: Int)
  CMaxGraphemes(value: Int)
  CMinimum(value: Int)
  CMaximum(value: Int)
  CFormat(value: String)
  CEnum(values: List(ValueRef))
  CKnownValues(values: List(ValueRef))
  CDefault(value: CValue)
  CConst(value: CValue)
  CAccept(values: List(String))
  CMaxSize(value: Int)
}

Constructors

  • CMinLength(value: Int)
  • CMaxLength(value: Int)
  • CMinGraphemes(value: Int)
  • CMaxGraphemes(value: Int)
  • CMinimum(value: Int)
  • CMaximum(value: Int)
  • CFormat(value: String)
  • CEnum(values: List(ValueRef))
  • CKnownValues(values: List(ValueRef))
  • CDefault(value: CValue)
  • CConst(value: CValue)
  • CAccept(values: List(String))
  • CMaxSize(value: Int)
pub type ErrorDef {
  ErrorDef(docs: option.Option(String), name: String)
}

Constructors

pub type Field {
  Field(
    docs: option.Option(String),
    annotations: List(Annotation),
    name: String,
    required: Bool,
    ty: MType,
    span: token.Span,
  )
}

Constructors

pub type Item {
  IRecord(
    docs: option.Option(String),
    annotations: List(Annotation),
    name: String,
    fields: List(Field),
    span: token.Span,
  )
  IDefType(
    docs: option.Option(String),
    annotations: List(Annotation),
    name: String,
    ty: MType,
    span: token.Span,
  )
  IInlineType(
    docs: option.Option(String),
    annotations: List(Annotation),
    name: String,
    ty: MType,
    span: token.Span,
  )
  IToken(
    docs: option.Option(String),
    annotations: List(Annotation),
    name: String,
    span: token.Span,
  )
  IQuery(
    docs: option.Option(String),
    annotations: List(Annotation),
    name: String,
    params: List(Field),
    ret: Ret,
    span: token.Span,
  )
  IProcedure(
    docs: option.Option(String),
    annotations: List(Annotation),
    name: String,
    params: List(Field),
    ret: Ret,
    span: token.Span,
  )
  ISubscription(
    docs: option.Option(String),
    annotations: List(Annotation),
    name: String,
    params: List(Field),
    messages: option.Option(MType),
    span: token.Span,
  )
  ISelf(
    docs: option.Option(String),
    annotations: List(Annotation),
    span: token.Span,
  )
  IUse(path: List(String), imports: UseImports, span: token.Span)
}

Constructors

pub type MType {
  MPrimitive(kind: Prim, span: token.Span)
  MRef(path: List(String), span: token.Span)
  MArray(inner: MType, span: token.Span)
  MObject(fields: List(Field), span: token.Span)
  MParen(inner: MType, span: token.Span)
  MUnion(members: List(MType), closed: Bool, span: token.Span)
  MConstrained(
    base: MType,
    constraints: List(Constraint),
    span: token.Span,
  )
}

Constructors

pub type Prim {
  PString
  PInteger
  PBoolean
  PBytes
  PBlob
  PNull
  PUnknown
}

Constructors

  • PString
  • PInteger
  • PBoolean
  • PBytes
  • PBlob
  • PNull
  • PUnknown
pub type Ret {
  RNone
  RType(ty: MType)
  RTypeErrors(ty: MType, errors: List(ErrorDef))
}

Constructors

pub type UseImports {
  UAll
  UWildcard
  UNamespaceAlias(alias: String)
  UItems(items: List(UseItem))
}

Constructors

  • UAll
  • UWildcard
  • UNamespaceAlias(alias: String)
  • UItems(items: List(UseItem))
pub type UseItem {
  UseItem(name: String, alias: option.Option(String))
}

Constructors

pub type ValueRef {
  VLiteral(value: String)
  VRef(path: List(String))
}

Constructors

  • VLiteral(value: String)
  • VRef(path: List(String))

Values

pub fn mtype_span(t: MType) -> token.Span
Search Document