Enum parol::grammar::symbol::TerminalKind
source · pub enum TerminalKind {
Legacy,
Regex,
Raw,
}
Expand description
Determines how the terminal literal is interpreted by parol
Variants§
Legacy
Uninterpreted by parol, same as regex - the old double quoted form
Regex
Uninterpreted by parol, usually used for regular expressions
Raw
Meta characters will be escaped when regex for scanner is created
Implementations§
source§impl TerminalKind
impl TerminalKind
sourcepub fn behaves_like(&self, other: TerminalKind) -> bool
pub fn behaves_like(&self, other: TerminalKind) -> bool
Behavioral equivalence
use parol::TerminalKind;
assert!(TerminalKind::Legacy.behaves_like(TerminalKind::Legacy));
assert!(TerminalKind::Legacy.behaves_like(TerminalKind::Regex));
assert!(!TerminalKind::Legacy.behaves_like(TerminalKind::Raw));
assert!(TerminalKind::Regex.behaves_like(TerminalKind::Regex));
assert!(TerminalKind::Regex.behaves_like(TerminalKind::Legacy));
assert!(!TerminalKind::Regex.behaves_like(TerminalKind::Raw));
assert!(TerminalKind::Raw.behaves_like(TerminalKind::Raw));
assert!(!TerminalKind::Raw.behaves_like(TerminalKind::Regex));
assert!(!TerminalKind::Raw.behaves_like(TerminalKind::Legacy));
sourcepub fn expands_like(
this_term: &str,
this_kind: TerminalKind,
other_term: &str,
other_kind: TerminalKind
) -> bool
pub fn expands_like( this_term: &str, this_kind: TerminalKind, other_term: &str, other_kind: TerminalKind ) -> bool
Equivalence regarding expansion result
use parol::TerminalKind;
assert!(TerminalKind::expands_like(
"\n", TerminalKind::Legacy,
"\n", TerminalKind::Regex));
assert!(TerminalKind::expands_like(
"{", TerminalKind::Raw,
r"\{", TerminalKind::Regex));
assert!(TerminalKind::expands_like(
"{", TerminalKind::Raw,
r"\{", TerminalKind::Legacy));
assert!(!TerminalKind::expands_like(
r"\{", TerminalKind::Raw,
r"\{", TerminalKind::Legacy));
Trait Implementations§
source§impl Clone for TerminalKind
impl Clone for TerminalKind
source§fn clone(&self) -> TerminalKind
fn clone(&self) -> TerminalKind
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TerminalKind
impl Debug for TerminalKind
source§impl Hash for TerminalKind
impl Hash for TerminalKind
source§impl Ord for TerminalKind
impl Ord for TerminalKind
source§fn cmp(&self, other: &TerminalKind) -> Ordering
fn cmp(&self, other: &TerminalKind) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for TerminalKind
impl PartialEq for TerminalKind
source§fn eq(&self, other: &TerminalKind) -> bool
fn eq(&self, other: &TerminalKind) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for TerminalKind
impl PartialOrd for TerminalKind
source§fn partial_cmp(&self, other: &TerminalKind) -> Option<Ordering>
fn partial_cmp(&self, other: &TerminalKind) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for TerminalKind
impl Eq for TerminalKind
impl StructuralPartialEq for TerminalKind
Auto Trait Implementations§
impl Freeze for TerminalKind
impl RefUnwindSafe for TerminalKind
impl Send for TerminalKind
impl Sync for TerminalKind
impl Unpin for TerminalKind
impl UnwindSafe for TerminalKind
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.