pub enum Rule {
Show 17 variants
Blank,
String(String),
Pattern {
value: String,
flags: Option<String>,
},
Symbol(String),
Seq(Vec<Rule>),
Choice(Vec<Rule>),
Repeat(Box<Rule>),
Repeat1(Box<Rule>),
Field {
name: String,
content: Box<Rule>,
},
Alias {
content: Box<Rule>,
value: String,
named: bool,
},
Token(Box<Rule>),
ImmediateToken(Box<Rule>),
Prec {
value: Precedence,
content: Box<Rule>,
},
PrecLeft {
value: Precedence,
content: Box<Rule>,
},
PrecRight {
value: Precedence,
content: Box<Rule>,
},
PrecDynamic {
value: i32,
content: Box<Rule>,
},
Reserved {
context_name: String,
content: Box<Rule>,
},
}Expand description
Grammar rule variants.
Variants§
Blank
Epsilon (empty match).
String(String)
Literal token.
Pattern
Regex token.
Symbol(String)
Reference to another rule.
Seq(Vec<Rule>)
Sequence of rules (must match in order).
Choice(Vec<Rule>)
Alternation (first matching wins).
Repeat(Box<Rule>)
Zero or more repetitions.
Repeat1(Box<Rule>)
One or more repetitions.
Field
Named field.
Alias
Rename node.
Token(Box<Rule>)
Force tokenization.
ImmediateToken(Box<Rule>)
Immediate tokenization.
Prec
Precedence.
PrecLeft
Left-associative precedence.
PrecRight
Right-associative precedence.
PrecDynamic
Dynamic precedence.
Reserved
Reserved word context.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Rule
impl<'de> Deserialize<'de> for Rule
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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