SemanticAnalyzer

Struct SemanticAnalyzer 

Source
pub struct SemanticAnalyzer<'t> { /* private fields */ }
Expand description

A visitor that performs semantic analysis on an AST.

Implementations§

Source§

impl<'t> SemanticAnalyzer<'t>

Source

pub fn new(text: &'t str) -> SemanticAnalyzer<'t>

Create a new semantic analyzer.

Source

pub fn analyze(&mut self, ast: &Ast) -> Result<(), Errors>

Traverse the given AST and store any errors that occur.

Note that this implementation is a bit weird in that we create the Err variant of the result by hand.

Trait Implementations§

Source§

impl Visitor for SemanticAnalyzer<'_>

A visitor that performs semantic analysis on an AST.

Source§

type Error = ()

An error that might occur when visiting the AST.
Source§

type Output = ()

The result of visiting the AST.
Source§

fn visit_root(&mut self, root: &Root) -> Result<Self::Output, Self::Error>

This method is called on a root node.
Source§

fn visit_condition( &mut self, condition: &Condition, ) -> Result<Self::Output, Self::Error>

This method is called on a condition node.
Source§

fn visit_action( &mut self, _action: &Action, ) -> Result<Self::Output, Self::Error>

This method is called on an action node.
Source§

fn visit_description( &mut self, _description: &Description, ) -> Result<Self::Output, Self::Error>

This method is called on an action description node.

Auto Trait Implementations§

§

impl<'t> Freeze for SemanticAnalyzer<'t>

§

impl<'t> RefUnwindSafe for SemanticAnalyzer<'t>

§

impl<'t> Send for SemanticAnalyzer<'t>

§

impl<'t> Sync for SemanticAnalyzer<'t>

§

impl<'t> Unpin for SemanticAnalyzer<'t>

§

impl<'t> UnwindSafe for SemanticAnalyzer<'t>

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<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, 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.