pub enum Atom {
Ident(Ident),
Dict(Dictionary),
LitBool(bool),
LitNum(i32),
LitFloat(NotNan<f32>),
LitString(String),
Group(SpannableNode<Expression>),
}Expand description
The base elements of each expression.
The data in here is kind of similar to wagon_value::Value and TryFrom is implemented for it as a result.
However, an Atom includes additional syntactic data, which is not important (or even not available) for Value (for example, an Ident).
As a result, Atom::Ident, Atom::Dict and Atom::Group can not be directly converted and manual implementation is required.
§Grammar
Atom -> Ident
| Dictionary
| bool
| i32
| f32
| String
|
"(" Expression ")"
;
Variants§
Ident(Ident)
An Ident.
Dict(Dictionary)
A Dictionary.
LitBool(bool)
A bool.
LitNum(i32)
An i32.
LitFloat(NotNan<f32>)
An f32.
LitString(String)
A String.
Group(SpannableNode<Expression>)
Another full Expression. Enclosed by ().
Implementations§
Source§impl Atom
impl Atom
Sourcepub fn new_unspanned_ident(arg_0: Ident) -> Self
pub fn new_unspanned_ident(arg_0: Ident) -> Self
Construct a Self::Ident with dummy span information.
Sourcepub fn new_unspanned_dict(arg_0: Dictionary) -> Self
pub fn new_unspanned_dict(arg_0: Dictionary) -> Self
Construct a Self::Dict with dummy span information.
Sourcepub fn new_unspanned_litbool(arg_0: bool) -> Self
pub fn new_unspanned_litbool(arg_0: bool) -> Self
Construct a Self::LitBool with dummy span information.
Sourcepub fn new_unspanned_litnum(arg_0: i32) -> Self
pub fn new_unspanned_litnum(arg_0: i32) -> Self
Construct a Self::LitNum with dummy span information.
Sourcepub fn new_unspanned_litfloat(arg_0: NotNan<f32>) -> Self
pub fn new_unspanned_litfloat(arg_0: NotNan<f32>) -> Self
Construct a Self::LitFloat with dummy span information.
Sourcepub fn new_unspanned_litstring(arg_0: String) -> Self
pub fn new_unspanned_litstring(arg_0: String) -> Self
Construct a Self::LitString with dummy span information.
Sourcepub fn new_unspanned_group(arg_0: Expression) -> Self
pub fn new_unspanned_group(arg_0: Expression) -> Self
Construct a Self::Group with dummy span information.
Trait Implementations§
Source§impl Parse for Atom
impl Parse for Atom
Source§fn parse(lexer: &mut LexerBridge<'_>) -> ParseResult<Self>
fn parse(lexer: &mut LexerBridge<'_>) -> ParseResult<Self>
Source§fn parse_sep(
lexer: &mut LexerBridge<'_>,
join: Tokens,
) -> ParseResult<Vec<Self>>where
Self: Sized,
fn parse_sep(
lexer: &mut LexerBridge<'_>,
join: Tokens,
) -> ParseResult<Vec<Self>>where
Self: Sized,
Source§fn parse_sep_end(
lexer: &mut LexerBridge<'_>,
join: Tokens,
end: Tokens,
) -> ParseResult<Vec<Self>>where
Self: Sized,
fn parse_sep_end(
lexer: &mut LexerBridge<'_>,
join: Tokens,
end: Tokens,
) -> ParseResult<Vec<Self>>where
Self: Sized,
Source§impl TryFrom<Atom> for RecursiveValue
impl TryFrom<Atom> for RecursiveValue
impl Eq for Atom
impl StructuralPartialEq for Atom
Auto Trait Implementations§
impl Freeze for Atom
impl RefUnwindSafe for Atom
impl Send for Atom
impl Sync for Atom
impl Unpin for Atom
impl UnwindSafe for Atom
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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 moreSource§impl<T> WrapSpannable<T, SpannableNode<T>> for Twhere
T: Parse,
impl<T> WrapSpannable<T, SpannableNode<T>> for Twhere
T: Parse,
Source§fn wrap_spannable(self) -> SpannableNode<T>
fn wrap_spannable(self) -> SpannableNode<T>
Source§fn into_spanned(self, span: Range<usize>) -> SpannableNode<T>
fn into_spanned(self, span: Range<usize>) -> SpannableNode<T>
SpannableNode with the specified Span.