RuleTreeSet

Struct RuleTreeSet 

Source
pub struct RuleTreeSet<T> { /* private fields */ }

Implementations§

Source§

impl<T> RuleTreeSet<T>

Source

pub fn get_num_nt(&self) -> VarId

Source

pub fn get_tree(&self, var: VarId) -> Option<&GrTree>

Source

pub fn get_trees_iter(&self) -> impl Iterator<Item = (VarId, &GrTree)>

Returns all the non-empty trees

Source

pub fn get_vars(&self) -> impl Iterator<Item = VarId> + '_

Returns all the variables corresponding to a non-empty tree

Source

pub fn get_next_available_var(&self) -> VarId

Returns a variable ID that doesn’t exist yet.

Source

pub fn get_terminals(&self) -> HashSet<TokenId>

Returns a set of all the terminals used in the ruleset.

Source

pub fn set_symbol_table(&mut self, symbol_table: SymbolTable)

Source

pub fn get_symbol_table(&self) -> Option<&SymbolTable>

Source

pub fn set_start(&mut self, start: VarId)

Sets the starting production rule.

Source

pub fn to_str( &self, var: VarId, node: Option<usize>, emphasis: Option<usize>, ) -> String

Builds the string representation of the rule tree set of variable var, optionally starting at node node. If emphasis contains a node ID, this subpart of the tree is emphasized in the string.

Source

pub fn get_log_mut(&mut self) -> &mut BufLog

Source§

impl RuleTreeSet<General>

Source

pub fn new() -> Self

Source

pub fn with_log(log: BufLog) -> Self

Source

pub fn get_tree_mut(&mut self, var: VarId) -> &mut GrTree

Gets the tree corresponding to var. Creates it if it doesn’t exist yet.

Source

pub fn set_tree(&mut self, var: VarId, tree: GrTree)

Sets the tree corresponding to var. If the variable already exists, the tree is replaced. Otherwise, the set is enlarged to add it.

Source

pub fn normalize(&mut self)

Normalizes all the production rules.

Trait Implementations§

Source§

impl BuildFrom<RuleTreeSet<General>> for ProdRuleSet<General>

Source§

fn build_from(rules: RuleTreeSet<General>) -> Self

Builds a ProdRuleSet<General> from a RuleTreeSet<General>.

If an error is encountered or was already encountered before, an empty shell object is built with the log detailing the error(s).

Source§

impl BuildFrom<RuleTreeSet<General>> for RuleTreeSet<Normalized>

Source§

fn build_from(rules: RuleTreeSet<General>) -> Self

Transforms a General ruleset to a Normalized ruleset

If an error is encountered or was already encountered before, an empty shell object is built with the log detailing the error(s).

Source§

impl BuildFrom<RuleTreeSet<Normalized>> for ProdRuleSet<General>

Source§

fn build_from(rules: RuleTreeSet<Normalized>) -> Self

Builds a ProdRuleSet<General> from a RuleTreeSet<Normalized>.

If an error is encountered or was already encountered before, an empty shell object is built with the log detailing the error(s).

Source§

impl<T: Clone> Clone for RuleTreeSet<T>

Source§

fn clone(&self) -> RuleTreeSet<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for RuleTreeSet<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> HasBuildErrorSource for RuleTreeSet<T>

Source§

impl<T> LogReader for RuleTreeSet<T>

Source§

type Item = BufLog

Source§

fn get_log(&self) -> &Self::Item

Source§

fn give_log(self) -> Self::Item

Auto Trait Implementations§

§

impl<T> Freeze for RuleTreeSet<T>

§

impl<T> !RefUnwindSafe for RuleTreeSet<T>

§

impl<T> Send for RuleTreeSet<T>
where T: Send,

§

impl<T> !Sync for RuleTreeSet<T>

§

impl<T> Unpin for RuleTreeSet<T>
where T: Unpin,

§

impl<T> UnwindSafe for RuleTreeSet<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<S> BuildFrom<S> for S

Source§

fn build_from(source: S) -> S

Converts to this type from the input type.
Source§

impl<S, T> BuildInto<T> for S
where T: BuildFrom<S>,

Source§

fn build_into(self) -> T

Calls T::from(self) to convert a [S] into a [T].

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LogStatus for T
where T: LogReader + Debug,

Source§

fn num_notes(&self) -> usize

Source§

fn num_warnings(&self) -> usize

Source§

fn num_errors(&self) -> usize

Source§

fn has_no_errors(&self) -> bool

Source§

fn has_no_warnings(&self) -> bool

Source§

fn get_messages(&self) -> impl Iterator<Item = &LogMsg>

Source§

fn get_messages_str(&self) -> String

Source§

fn get_notes(&self) -> impl Iterator<Item = &String>

Source§

fn get_warnings(&self) -> impl Iterator<Item = &String>

Source§

fn get_errors(&self) -> impl Iterator<Item = &String>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<S, T> TryBuildFrom<S> for T

Source§

type Error = BuildError

The type returned in the event of a conversion error.
Source§

fn try_build_from(source: S) -> Result<T, <T as TryBuildFrom<S>>::Error>

Performs the conversion.
Source§

impl<S, T> TryBuildInto<T> for S
where T: TryBuildFrom<S>,

Source§

type Error = <T as TryBuildFrom<S>>::Error

The type returned in the event of a conversion error.
Source§

fn try_build_into(self) -> Result<T, <T as TryBuildFrom<S>>::Error>

Performs the conversion.
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.