pub struct ExprBuilder;Expand description
Ergonomic constructor for grammar expressions.
Implementations§
Source§impl ExprBuilder
impl ExprBuilder
Sourcepub const fn empty(self) -> GrammarExpr
pub const fn empty(self) -> GrammarExpr
Builds an empty-string expression.
Sourcepub fn term(self, value: impl Into<String>) -> GrammarExpr
pub fn term(self, value: impl Into<String>) -> GrammarExpr
Builds a literal terminal.
Sourcepub fn terminal(self, value: impl Into<String>) -> GrammarExpr
pub fn terminal(self, value: impl Into<String>) -> GrammarExpr
Builds a literal terminal.
Sourcepub fn terminal_insensitive(self, value: impl Into<String>) -> GrammarExpr
pub fn terminal_insensitive(self, value: impl Into<String>) -> GrammarExpr
Builds a case-insensitive literal terminal.
Sourcepub const fn char(self, value: char) -> GrammarExpr
pub const fn char(self, value: char) -> GrammarExpr
Builds a single-character range expression.
Sourcepub const fn char_range(self, start: char, end: char) -> GrammarExpr
pub const fn char_range(self, start: char, end: char) -> GrammarExpr
Builds an inclusive character range expression.
Sourcepub fn char_class<I>(self, negated: bool, items: I) -> GrammarExprwhere
I: IntoIterator<Item = CharClassItem>,
pub fn char_class<I>(self, negated: bool, items: I) -> GrammarExprwhere
I: IntoIterator<Item = CharClassItem>,
Builds a character class.
Sourcepub const fn any(self) -> GrammarExpr
pub const fn any(self) -> GrammarExpr
Builds an any-character wildcard.
Sourcepub fn nt(self, value: impl Into<String>) -> GrammarExpr
pub fn nt(self, value: impl Into<String>) -> GrammarExpr
Builds a non-terminal reference.
Sourcepub fn non_terminal(self, value: impl Into<String>) -> GrammarExpr
pub fn non_terminal(self, value: impl Into<String>) -> GrammarExpr
Builds a non-terminal reference.
Sourcepub fn choice<I>(self, ordered: bool, alternatives: I) -> GrammarExprwhere
I: IntoIterator<Item = GrammarExpr>,
pub fn choice<I>(self, ordered: bool, alternatives: I) -> GrammarExprwhere
I: IntoIterator<Item = GrammarExpr>,
Builds a choice expression.
Sourcepub fn choice_ordered<I>(self, alternatives: I) -> GrammarExprwhere
I: IntoIterator<Item = GrammarExpr>,
pub fn choice_ordered<I>(self, alternatives: I) -> GrammarExprwhere
I: IntoIterator<Item = GrammarExpr>,
Builds an ordered choice expression.
Sourcepub fn choice_unordered<I>(self, alternatives: I) -> GrammarExprwhere
I: IntoIterator<Item = GrammarExpr>,
pub fn choice_unordered<I>(self, alternatives: I) -> GrammarExprwhere
I: IntoIterator<Item = GrammarExpr>,
Builds an unordered choice expression.
Sourcepub fn seq<I>(self, items: I) -> GrammarExprwhere
I: IntoIterator<Item = GrammarExpr>,
pub fn seq<I>(self, items: I) -> GrammarExprwhere
I: IntoIterator<Item = GrammarExpr>,
Builds a sequence expression.
Sourcepub fn opt(self, expr: GrammarExpr) -> GrammarExpr
pub fn opt(self, expr: GrammarExpr) -> GrammarExpr
Builds an optional expression.
Sourcepub fn rep0(self, expr: GrammarExpr) -> GrammarExpr
pub fn rep0(self, expr: GrammarExpr) -> GrammarExpr
Builds a zero-or-more repetition expression.
Sourcepub fn rep1(self, expr: GrammarExpr) -> GrammarExpr
pub fn rep1(self, expr: GrammarExpr) -> GrammarExpr
Builds a one-or-more repetition expression.
Sourcepub fn repeat(
self,
expr: GrammarExpr,
min: usize,
max: Option<usize>,
) -> GrammarExpr
pub fn repeat( self, expr: GrammarExpr, min: usize, max: Option<usize>, ) -> GrammarExpr
Builds a counted repetition expression.
Sourcepub fn and(self, expr: GrammarExpr) -> GrammarExpr
pub fn and(self, expr: GrammarExpr) -> GrammarExpr
Builds a positive lookahead expression.
Sourcepub fn not(self, expr: GrammarExpr) -> GrammarExpr
pub fn not(self, expr: GrammarExpr) -> GrammarExpr
Builds a negative lookahead expression.
Sourcepub fn capture(
self,
label: Option<impl Into<String>>,
expr: GrammarExpr,
) -> GrammarExpr
pub fn capture( self, label: Option<impl Into<String>>, expr: GrammarExpr, ) -> GrammarExpr
Builds a labelled capture expression.
Sourcepub fn capture_unlabeled(self, expr: GrammarExpr) -> GrammarExpr
pub fn capture_unlabeled(self, expr: GrammarExpr) -> GrammarExpr
Builds an anonymous capture expression.
Trait Implementations§
Source§impl Clone for ExprBuilder
impl Clone for ExprBuilder
Source§fn clone(&self) -> ExprBuilder
fn clone(&self) -> ExprBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExprBuilder
impl Debug for ExprBuilder
Source§impl Default for ExprBuilder
impl Default for ExprBuilder
Source§fn default() -> ExprBuilder
fn default() -> ExprBuilder
Source§impl PartialEq for ExprBuilder
impl PartialEq for ExprBuilder
Source§fn eq(&self, other: &ExprBuilder) -> bool
fn eq(&self, other: &ExprBuilder) -> bool
self and other values to be equal, and is used by ==.impl Copy for ExprBuilder
impl Eq for ExprBuilder
impl StructuralPartialEq for ExprBuilder
Auto Trait Implementations§
impl Freeze for ExprBuilder
impl RefUnwindSafe for ExprBuilder
impl Send for ExprBuilder
impl Sync for ExprBuilder
impl Unpin for ExprBuilder
impl UnsafeUnpin for ExprBuilder
impl UnwindSafe for ExprBuilder
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
key and return true if they are equal.§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
§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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more