[][src]Struct macro_railroad::lowering::MacroRules

pub struct MacroRules {
    pub name: String,
    pub rules: Matcher,
}

A more coarse representation of parser::MacroRules.

Fields

name: String

This macro's name.

rules: Matcher

The set of rules in this macro. Starts out as a Choice (one for every pattern)

Implementations

impl MacroRules[src]

pub fn foldcommontails(&mut self)[src]

Recursivly fold common prefixes and suffixes in all rules

pub fn remove_internal(&mut self)[src]

Replace all rules starting with dunder-literals (e.g. "__impl") with a single comment.

pub fn collect_nonterminals(&mut self) -> HashMap<Fragment, HashSet<String>>[src]

Collect the unique set of non-terminal symbols.

pub fn ungroup(&mut self)[src]

Unpack all Matcher::Group in the tree

pub fn normalize(&mut self)[src]

Transmogrify the tree by removing superfluous elements.

For example, a Choice([Sequence([Terminal("Foo"), Empty])]) becomes just Terminal("Foo").

pub fn any<F: FnMut(&Matcher) -> bool>(&self, predicate: F) -> bool[src]

Tests if any Matcher matches the given predicate.

pub fn contains(&self, needle: &Matcher) -> bool[src]

Tests if the given Matcher is found in the graph.

Trait Implementations

impl Clone for MacroRules[src]

impl Debug for MacroRules[src]

impl From<MacroRules> for MacroRules[src]

impl PartialEq<MacroRules> for MacroRules[src]

impl StructuralPartialEq for MacroRules[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.