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 Grammarwhere
OnceLock<Target>: RefUnwindSafe,
OnceLock<First>: RefUnwindSafe,
OnceLock<Option<(&'static PropertyData, &'static Grammar)>>: RefUnwindSafe,
impl Send for Grammar
impl Sync for Grammar
impl Unpin for Grammar
impl UnsafeUnpin for Grammarwhere
*const str is !null: UnsafeUnpin,
PhantomData<str>: UnsafeUnpin,
Align4<u32>: UnsafeUnpin,
&'static Grammar: UnsafeUnpin,
&'static str: UnsafeUnpin,
PhantomData<Target>: UnsafeUnpin,
PhantomData<First>: UnsafeUnpin,
&'static PropertyData: UnsafeUnpin,
PhantomData<Option<(&'static PropertyData, &'static Grammar)>>: UnsafeUnpin,
*const Grammar is !null: UnsafeUnpin,
PhantomData<Grammar>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
impl UnwindSafe for Grammarwhere
BoxRaw<str>: UnwindSafe,
OnceLock<Target>: UnwindSafe,
OnceLock<First>: UnwindSafe,
OnceLock<Option<(&'static PropertyData, &'static Grammar)>>: UnwindSafe,
BoxRaw<Grammar>: UnwindSafe,
RawVecInner: UnwindSafe,
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