Enum wagon_parser::parser::symbol::Symbol
source · 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,
source§impl PartialEq for Symbol
impl PartialEq for Symbol
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§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> 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
.