[][src]Struct treebender::rules::Grammar

pub struct Grammar {
    pub start: String,
    pub rules: HashMap<String, Vec<Rc<Rule>>>,
    // some fields omitted


start: Stringrules: HashMap<String, Vec<Rc<Rule>>>


impl Grammar[src]

pub fn new(rules: Vec<Rule>) -> Result<Self, Err>[src]

pub fn is_nullable(&self, s: &str) -> bool[src]

impl Grammar[src]

pub fn parse_chart(&self, input: &[&str]) -> Chart[src]

pub fn parse_forest(&self, input: &[&str]) -> Forest[src]

pub fn unify_tree(
    tree: SynTree<Rc<Rule>, String>
) -> Result<(SynTree<String, String>, NodeRef), Err>

pub fn parse(&self, input: &[&str]) -> Vec<(SynTree<String, String>, NodeRef)>[src]

pub fn read_from_file<P: AsRef<Path>>(path: P) -> Result<Self, Err>[src]

Trait Implementations

impl Debug for Grammar[src]

impl Display for Grammar[src]

impl FromStr for Grammar[src]

Parses a str into a tuple of (rules, nonterminals) Errors if the grammar doesn't parse or is malformed

type Err = Err

The associated error which can be returned from parsing.

fn from_str(s: &str) -> Result<Self, Self::Err>[src]

Parses a grammar from a string. Assumes the first rule's symbol is the start symbol.

Auto Trait Implementations

impl !RefUnwindSafe for Grammar

impl !Send for Grammar

impl !Sync for Grammar

impl Unpin for Grammar

impl !UnwindSafe for Grammar

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToString for T where
    T: Display + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.