pub enum Symbol {
NonTerminal(SpannableNode<Ident>, Vec<SpannableNode<Ident>>),
Assignment(Vec<SpannableNode<Assignment>>),
Terminal(SpannableNode<Terminal>),
Epsilon,
}Expand description
Variants§
NonTerminal(SpannableNode<Ident>, Vec<SpannableNode<Ident>>)
A non-terminal with optional parameters.
Assignment(Vec<SpannableNode<Assignment>>)
A list of Assignment enclosed by {}.
Terminal(SpannableNode<Terminal>)
A Terminal.
Epsilon
Nothing.
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub fn new_unspanned_nonterminal(arg_0: Ident, arg_1: Vec<Ident>) -> Self
pub fn new_unspanned_nonterminal(arg_0: Ident, arg_1: Vec<Ident>) -> Self
Construct a Self::NonTerminal with dummy span information.
Sourcepub fn new_unspanned_assignment(arg_0: Vec<Assignment>) -> Self
pub fn new_unspanned_assignment(arg_0: Vec<Assignment>) -> Self
Construct a Self::Assignment with dummy span information.
Sourcepub fn new_unspanned_terminal(arg_0: Terminal) -> Self
pub fn new_unspanned_terminal(arg_0: Terminal) -> Self
Construct a Self::Terminal with dummy span information.
Sourcepub fn new_unspanned_epsilon() -> Self
pub fn new_unspanned_epsilon() -> Self
Construct a Self::Epsilon with dummy span information.
Source§impl Symbol
impl Symbol
Sourcepub const fn is_terminal(&self) -> bool
pub const fn is_terminal(&self) -> bool
Check if this symbol is not a non-terminal.
Sourcepub const fn is_assignment(&self) -> bool
pub const fn is_assignment(&self) -> bool
Check if this symbol is an Assignment.
Sourcepub fn simple_terminal(ident: &str) -> Self
pub fn simple_terminal(ident: &str) -> Self
Create a symbol which is just a Terminal::LitString representing the input parameter.
Sourcepub fn simple_ident(ident: &str) -> Self
pub fn simple_ident(ident: &str) -> Self
Create a symbol which is just a non-terminal Ident::Unknown with no arguments, representing the input parameter.
Trait Implementations§
Source§impl Parse for Symbol
impl Parse for Symbol
Source§fn parse(lexer: &mut LexerBridge<'_>) -> ParseResult<Self>where
Self: Sized,
fn parse(lexer: &mut LexerBridge<'_>) -> ParseResult<Self>where
Self: Sized,
Given a lexer, try to parse a valid instance of this node. Read more
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,
impl Eq for Symbol
impl StructuralPartialEq for Symbol
Auto Trait Implementations§
impl Freeze for Symbol
impl RefUnwindSafe for Symbol
impl Send for Symbol
impl Sync for Symbol
impl Unpin for Symbol
impl UnwindSafe for Symbol
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<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
Compare self to
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>
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 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>
Wrap dummy span information around the node.
Source§fn into_spanned(self, span: Range<usize>) -> SpannableNode<T>
fn into_spanned(self, span: Range<usize>) -> SpannableNode<T>
Convert the node into a
SpannableNode with the specified Span.