pub enum Syntax {
Recv(Type),
Send(Type),
Call(Box<Spanned<Syntax>>),
Choose(Vec<Spanned<Syntax>>),
Offer(Vec<Spanned<Syntax>>),
Split {
tx_only: Box<Spanned<Syntax>>,
rx_only: Box<Spanned<Syntax>>,
},
Loop(Option<String>, Box<Spanned<Syntax>>),
Break(Option<String>),
Continue(Option<String>),
Block(Vec<Spanned<Syntax>>),
Type(Type),
}
Expand description
The surface syntax for a macro invocation: a single statement-like item, or a block of them.
While the Target
of the compiler (and its corresponding types in the Dialectic library) have
continuations for almost every expression, the surface syntax is not in continuation passing
style, instead encoding sequences of operations using the ;
operator within blocks.
Variants§
Recv(Type)
Syntax: recv T
.
Send(Type)
Syntax: send T
.
Call(Box<Spanned<Syntax>>)
Syntax: call T
or call { ... }
.
Choose(Vec<Spanned<Syntax>>)
Syntax: choose { 0 => ..., ... }
.
Offer(Vec<Spanned<Syntax>>)
Syntax: offer { 0 => ..., ... }
.
Split
Syntax: split { -> ..., <- ... }
.
Fields
Loop(Option<String>, Box<Spanned<Syntax>>)
Syntax: loop { ... }
or 'label loop { ... }
.
Break(Option<String>)
Syntax: break
or break 'label
.
Continue(Option<String>)
Syntax: continue
or continue 'label
.
Block(Vec<Spanned<Syntax>>)
Syntax: { ... }
Type(Type)
Syntax: T
.
Implementations§
Source§impl Syntax
impl Syntax
Sourcepub fn recv(ty: &str) -> Self
pub fn recv(ty: &str) -> Self
Construct a Syntax::Recv
from a string representing a type.
§Panics
If the type does not parse correctly, this panics.
Sourcepub fn send(ty: &str) -> Self
pub fn send(ty: &str) -> Self
Construct a Syntax::Send
from a string representing a type.
§Panics
If the type does not parse correctly, this panics.
Sourcepub fn call(callee: impl Into<Spanned<Syntax>>) -> Self
pub fn call(callee: impl Into<Spanned<Syntax>>) -> Self
Construct a Syntax::Call
from its inner callee.
Sourcepub fn loop_(label: Option<String>, body: impl Into<Spanned<Syntax>>) -> Self
pub fn loop_(label: Option<String>, body: impl Into<Spanned<Syntax>>) -> Self
Construct a Syntax::Loop
from its (optional) label and its body.
Sourcepub fn type_(ty: &str) -> Self
pub fn type_(ty: &str) -> Self
Construct a Syntax::Type
from a string representing a type.
§Panics
If the type does not parse correctly, this panics.