pub struct RegexTerminal<'a> {
pub automaton: DFA<&'a [u32]>,
/* private fields */
}Expand description
A special type of Terminal which is a regex recognizer.
Implements label so that regex machines can be used. The string representation/uuid of the machine is its regex pattern.
Fields§
§automaton: DFA<&'a [u32]>The regex automaton this terminal represents.
Implementations§
Trait Implementations§
Source§impl<'a> Debug for RegexTerminal<'a>
impl<'a> Debug for RegexTerminal<'a>
Source§impl<'a> Label<'a> for RegexTerminal<'a>
impl<'a> Label<'a> for RegexTerminal<'a>
Source§fn _first(
&self,
state: &mut GLLState<'a>,
_: &mut HashSet<Rc<str>>,
) -> GLLResult<'a, bool>
fn _first( &self, state: &mut GLLState<'a>, _: &mut HashSet<Rc<str>>, ) -> GLLResult<'a, bool>
A regex is sort of between a non-terminal and a terminal. They way first is used, we want
it to return true if some terminal is parsable from this point. In the case of a regex, this means the pattern is accepting.
Source§fn first_set(
&self,
_: &GLLState<'a>,
) -> ImplementationResult<'a, Vec<(Vec<GLLBlockLabel<'a>>, Option<Terminal<'a>>)>>
fn first_set( &self, _: &GLLState<'a>, ) -> ImplementationResult<'a, Vec<(Vec<GLLBlockLabel<'a>>, Option<Terminal<'a>>)>>
Returns the first-follow set of the label. Read more
Source§fn code(&self, _: &mut GLLState<'a>) -> GLLResult<'a, ()>
fn code(&self, _: &mut GLLState<'a>) -> GLLResult<'a, ()>
Any code to run when encountering this label. Read more
Source§fn _weight(
&self,
_: &GLLState<'a>,
) -> Option<ImplementationResult<'a, Value<'a>>>
fn _weight( &self, _: &GLLState<'a>, ) -> Option<ImplementationResult<'a, Value<'a>>>
Optionally return the weight of this label. Read more
Source§fn to_string(&self) -> &str
fn to_string(&self) -> &str
A string representation of the chunk (likely a GLL block) that this label represents.
Source§fn str_parts(&self) -> Vec<&str>
fn str_parts(&self) -> Vec<&str>
The chunk represented by
Label::to_string, but split by symbol into a vector.Source§fn attr_rep_map(&self) -> (Vec<&str>, Vec<&str>)
fn attr_rep_map(&self) -> (Vec<&str>, Vec<&str>)
A tuple of string representations for any associated attributes. Read more
Source§fn is_terminal(&self) -> bool
fn is_terminal(&self) -> bool
Is this label a terminal? Read more
Source§fn _is_nullable(
&self,
_: &GLLState<'a>,
_: &mut HashSet<Rc<str>>,
) -> ImplementationResult<'a, bool>
fn _is_nullable( &self, _: &GLLState<'a>, _: &mut HashSet<Rc<str>>, ) -> ImplementationResult<'a, bool>
Internal method for
Label::is_nullable to do the recursive step. Read moreSource§fn first(&self, state: &mut GLLState<'a>) -> GLLResult<'a, bool>
fn first(&self, state: &mut GLLState<'a>) -> GLLResult<'a, bool>
Check if the next token in the current state is accepted by this label’s first-follow set. Read more
Source§fn is_nullable(&self, state: &GLLState<'a>) -> ImplementationResult<'a, bool>
fn is_nullable(&self, state: &GLLState<'a>) -> ImplementationResult<'a, bool>
Could this label resolve to epsilon? Read more
Auto Trait Implementations§
impl<'a> Freeze for RegexTerminal<'a>
impl<'a> RefUnwindSafe for RegexTerminal<'a>
impl<'a> Send for RegexTerminal<'a>
impl<'a> Sync for RegexTerminal<'a>
impl<'a> Unpin for RegexTerminal<'a>
impl<'a> UnsafeUnpin for RegexTerminal<'a>
impl<'a> UnwindSafe for RegexTerminal<'a>
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
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>
Converts
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>
Converts
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