pub enum Grammar {
Show 14 variants
Keyword(Box<str>),
Literal(char),
Type(TypeRef),
Property(PropertyRef),
Function(Box<str>, Box<Grammar>),
SquareBlock(Box<Grammar>),
ParenBlock(Box<Grammar>),
Sequence(Vec<Grammar>),
All(Vec<Grammar>),
Any(Vec<Grammar>),
One(Vec<Grammar>),
Repeat {
item: Box<Grammar>,
min: u32,
max: u32,
commas: bool,
},
NonEmpty(Box<Grammar>),
Never,
}Expand description
A grammar, parsed.
Variants§
Keyword(Box<str>)
A keyword, in lowercase, matched ignoring ASCII case.
Literal(char)
A literal token: ,, /, +, : and the like.
Type(TypeRef)
<name> or <name [min,max]>.
Property(PropertyRef)
<'name'>: whatever that property’s value can be.
Function(Box<str>, Box<Grammar>)
name( … ).
SquareBlock(Box<Grammar>)
[ … ] written as a literal block in the value: '[' … ']'.
ParenBlock(Box<Grammar>)
( … ): a parenthesized block in the value.
Sequence(Vec<Grammar>)
Juxtaposition: all, in order.
All(Vec<Grammar>)
&&: all, in any order.
Any(Vec<Grammar>)
||: one or more, in any order.
One(Vec<Grammar>)
|: exactly one.
Repeat
A multiplier: *, +, ?, {a,b}, and # when commas.
NonEmpty(Box<Grammar>)
[ … ]!: the group must match at least one value.
Never
Matches nothing: for a definition that’s prose, not grammar.
Implementations§
Trait Implementations§
impl StructuralPartialEq for Grammar
Auto Trait Implementations§
impl !Freeze for Grammar
impl Forget for Grammar
impl Move for Grammar
impl RefUnwindSafe for Grammar
impl Send for Grammar
impl Sync for Grammar
impl Unpin for Grammar
impl UnsafeUnpin for Grammar
impl UnwindSafe for Grammar
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