Enum wagon_parser::parser::rule::Rule
source · pub enum Rule {
Analytic(String, Vec<SpannableNode<Ident>>, Vec<SpannableNode<Rhs>>),
Generate(String, Vec<SpannableNode<Ident>>, Vec<SpannableNode<Rhs>>),
Import(String, ImportType, String),
Exclude(String, Vec<SpannableNode<String>>),
}
Expand description
A single rule in the WAG grammar.
§Grammar
Rule -> Ident RuleType;
RuleType -> RealRule | ImportRule;
RealRule -> NTArgs? RuleArrow Rhs;
RuleArrow ->
"->" | "=>"
;
ImportRule -> ImportArrow Identifier;
ImportArrow -> "<-" | "<=" | "<<" | "</"
;
NTArgs -> “<” AttrIdentifierList “>”; AttrIdentifierList -> Ident “,” AttrIdentifierList | Ident;
Variants§
Analytic(String, Vec<SpannableNode<Ident>>, Vec<SpannableNode<Rhs>>)
An analytic rule (->
).
Generate(String, Vec<SpannableNode<Ident>>, Vec<SpannableNode<Rhs>>)
A generative rule (=>
).
Import(String, ImportType, String)
An import rule (<-/=/<
).
Exclude(String, Vec<SpannableNode<String>>)
An import exclude rule (</
).
Implementations§
source§impl Rule
impl Rule
sourcepub fn new_unspanned_analytic(
arg_0: String,
arg_1: Vec<Ident>,
arg_2: Vec<Rhs>
) -> Self
pub fn new_unspanned_analytic( arg_0: String, arg_1: Vec<Ident>, arg_2: Vec<Rhs> ) -> Self
Construct a Self::Analytic
with dummy span information.
sourcepub fn new_unspanned_generate(
arg_0: String,
arg_1: Vec<Ident>,
arg_2: Vec<Rhs>
) -> Self
pub fn new_unspanned_generate( arg_0: String, arg_1: Vec<Ident>, arg_2: Vec<Rhs> ) -> Self
Construct a Self::Generate
with dummy span information.
sourcepub fn new_unspanned_import(
arg_0: String,
arg_1: ImportType,
arg_2: String
) -> Self
pub fn new_unspanned_import( arg_0: String, arg_1: ImportType, arg_2: String ) -> Self
Construct a Self::Import
with dummy span information.
sourcepub fn new_unspanned_exclude(arg_0: String, arg_1: Vec<String>) -> Self
pub fn new_unspanned_exclude(arg_0: String, arg_1: Vec<String>) -> Self
Construct a Self::Exclude
with dummy span information.
Trait Implementations§
source§impl Parse for Rule
impl Parse for Rule
source§fn parse(lexer: &mut LexerBridge<'_>) -> ParseResult<Self>
fn parse(lexer: &mut LexerBridge<'_>) -> ParseResult<Self>
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 Rule
impl PartialEq for Rule
impl Eq for Rule
impl StructuralPartialEq for Rule
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnwindSafe for Rule
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
.