Type Alias UntypedPattern

Source
pub type UntypedPattern = Pattern<(), (), Namespace, (u8, Span)>;

Aliased Type§

pub enum UntypedPattern {
    Int {
        location: Span,
        value: String,
        base: Base,
    },
    ByteArray {
        location: Span,
        value: Vec<(u8, Span)>,
        preferred_format: ByteArrayFormatPreference,
    },
    Var {
        location: Span,
        name: String,
    },
    Assign {
        name: String,
        location: Span,
        pattern: Box<Pattern<(), (), Namespace, (u8, Span)>>,
    },
    Discard {
        name: String,
        location: Span,
    },
    List {
        location: Span,
        elements: Vec<Pattern<(), (), Namespace, (u8, Span)>>,
        tail: Option<Box<Pattern<(), (), Namespace, (u8, Span)>>>,
    },
    Constructor {
        is_record: bool,
        location: Span,
        name: String,
        arguments: Vec<CallArg<Pattern<(), (), Namespace, (u8, Span)>>>,
        module: Option<Namespace>,
        constructor: (),
        spread_location: Option<Span>,
        tipo: (),
    },
    Pair {
        location: Span,
        fst: Box<Pattern<(), (), Namespace, (u8, Span)>>,
        snd: Box<Pattern<(), (), Namespace, (u8, Span)>>,
    },
    Tuple {
        location: Span,
        elems: Vec<Pattern<(), (), Namespace, (u8, Span)>>,
    },
}

Variants§

§

Int

Fields

§location: Span
§value: String
§base: Base
§

ByteArray

Fields

§location: Span
§value: Vec<(u8, Span)>
§preferred_format: ByteArrayFormatPreference
§

Var

The creation of a variable. e.g. expect [this_is_a_var, .._] = x e.g. let foo = 42

Fields

§location: Span
§name: String
§

Assign

A name given to a sub-pattern using the as keyword.

when foo is {
   [_, _] as the_list -> ...
}

Fields

§name: String
§location: Span
§pattern: Box<Pattern<(), (), Namespace, (u8, Span)>>
§

Discard

A pattern that binds to any value but does not assign a variable. Always starts with an underscore.

Fields

§name: String
§location: Span
§

List

Fields

§location: Span
§elements: Vec<Pattern<(), (), Namespace, (u8, Span)>>
§

Constructor

The constructor for a custom type. Starts with an uppercase letter.

Fields

§is_record: bool
§location: Span
§name: String
§arguments: Vec<CallArg<Pattern<(), (), Namespace, (u8, Span)>>>
§constructor: ()
§spread_location: Option<Span>
§tipo: ()
§

Pair

Fields

§location: Span
§

Tuple

Fields

§location: Span
§elems: Vec<Pattern<(), (), Namespace, (u8, Span)>>

Implementations§

Source§

impl UntypedPattern

Source

pub fn true_(location: Span) -> UntypedPattern

Source

pub fn collect_identifiers<F>(&self, collect: &mut F)
where F: FnMut((String, Span)),