#[repr(align(16))]pub enum Syntax {
Wrapped {
value: Value,
span: Span,
},
List {
list: Vec<Syntax>,
span: Span,
},
Vector {
vector: Vec<Syntax>,
span: Span,
},
Identifier {
ident: Identifier,
span: Span,
},
}Expand description
Representation of a Scheme syntax object, or s-expression.
Variants§
Wrapped
A wrapped value.
List
A nested grouping of pairs. If the expression is a proper list, then the last element of expression will be Null. This vector is guaranteed to contain at least two elements.
Vector
Identifier
Implementations§
Source§impl Syntax
impl Syntax
pub fn add_scope(&mut self, scope: Scope)
pub fn flip_scope(&mut self, scope: Scope)
pub fn remove_scope(&mut self, scope: Scope)
pub fn wrap(value: Value) -> Syntax
pub fn unwrap(self) -> Value
pub fn datum_to_syntax(scopes: &BTreeSet<Scope>, value: Value) -> Syntax
pub fn syntax_to_datum(value: Value) -> Value
pub fn from_str( s: &str, file_name: Option<&str>, ) -> Result<Self, ParseSyntaxError>
pub fn span(&self) -> &Span
pub fn as_ident(&self) -> Option<&Identifier>
pub fn new_list(list: Vec<Syntax>, span: impl Into<Span>) -> Self
pub fn as_list(&self) -> Option<&[Syntax]>
pub fn as_list_mut(&mut self) -> Option<&mut [Syntax]>
pub fn is_list(&self) -> bool
pub fn new_vector(vector: Vec<Syntax>, span: impl Into<Span>) -> Self
pub fn is_vector(&self) -> bool
pub fn new_wrapped(value: Value, span: impl Into<Span>) -> Self
pub fn new_identifier(name: &str, span: impl Into<Span>) -> Self
pub fn is_identifier(&self) -> bool
pub fn is_null(&self) -> bool
Trait Implementations§
Source§impl From<Syntax> for UnpackedValue
impl From<Syntax> for UnpackedValue
Auto Trait Implementations§
impl Freeze for Syntax
impl RefUnwindSafe for Syntax
impl Send for Syntax
impl Sync for Syntax
impl Unpin for Syntax
impl UnwindSafe for Syntax
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more