Trait SyntaxTreeVisitor

Source
pub trait SyntaxTreeVisitor<E> {
Show 20 methods // Required methods fn visit_function(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_parameters(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_parameter(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_variable(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_group(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_range(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_standard_dice(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_custom_dice(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_custom_faces(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_drop_lowest(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_drop_highest(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_add(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_sub(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_mul(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_div(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_mod(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_exp(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_neg(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_constant(&mut self, node: &Node<'_>) -> Result<(), E>; fn visit_negative_constant(&mut self, node: &Node<'_>) -> Result<(), E>;
}
Expand description

A visitor for the syntax tree produced by the dice language parser. Each method visits a specific type of node in the syntax tree, and is responsible for visiting any interesting children of that node.

§Type Parameters

  • E: The type of error that can occur while visiting the syntax tree.

Required Methods§

Source

fn visit_function(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “function” node in the syntax tree.

§Parameters
  • node: The “function” node.
§Errors

An error if one occurs while visiting the “function” node.

Source

fn visit_parameters(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “parameters” node in the syntax tree.

§Parameters
  • node: The “parameters” node.
§Errors

An error if one occurs while visiting the “parameters” node.

Source

fn visit_parameter(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “parameter” node in the syntax tree.

§Parameters
  • node: The “parameter” node.
§Errors

An error if one occurs while visiting the “parameter” node.

Source

fn visit_variable(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “variable” node in the syntax tree.

§Parameters
  • node: The “variable” node.
§Errors

An error if one occurs while visiting the “variable” node.

Source

fn visit_group(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “group” node in the syntax tree.

§Parameters
  • node: The “group” node.
§Errors

An error if one occurs while visiting the “group” node.

Source

fn visit_range(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “range” node in the syntax tree.

§Parameters
  • node: The “range” node.
§Errors

An error if one occurs while visiting the “range” node.

Source

fn visit_standard_dice(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “standard_dice” node in the syntax tree.

§Parameters
  • node: The “standard_dice” node.
§Errors

An error if one occurs while visiting the “standard_dice” node.

Source

fn visit_custom_dice(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “custom_dice” node in the syntax tree.

§Parameters
  • node: The “custom_dice” node.
§Errors

An error if one occurs while visiting the “custom_dice” node.

Source

fn visit_custom_faces(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “custom_faces” node in the syntax tree.

§Parameters
  • node: The “custom_faces” node.
§Errors

An error if one occurs while visiting the “custom_faces” node.

Source

fn visit_drop_lowest(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “custom_face” node in the syntax tree.

§Parameters
  • node: The “custom_face” node.

Visit a “drop_lowest” node in the syntax tree.

§Parameters
  • node: The “drop_lowest” node.
§Errors

An error if one occurs while visiting the “drop_lowest” node.

Source

fn visit_drop_highest(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “drop_highest” node in the syntax tree.

§Parameters
  • node: The “drop_highest” node.
§Errors

An error if one occurs while visiting the “drop_highest” node.

Source

fn visit_add(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “add” node in the syntax tree.

§Parameters
  • node: The “add” node.
§Errors

An error if one occurs while visiting the “add” node.

Source

fn visit_sub(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “sub” node in the syntax tree.

§Parameters
  • node: The “sub” node.
§Errors

An error if one occurs while visiting the “sub” node.

Source

fn visit_mul(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “mul” node in the syntax tree.

§Parameters
  • node: The “mul” node.
§Errors

An error if one occurs while visiting the “mul” node.

Source

fn visit_div(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “div” node in the syntax tree.

§Parameters
  • node: The “div” node.
§Errors

An error if one occurs while visiting the “div” node.

Source

fn visit_mod(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “mod” node in the syntax tree.

§Parameters
  • node: The “mod” node.
§Errors

An error if one occurs while visiting the “mod” node.

Source

fn visit_exp(&mut self, node: &Node<'_>) -> Result<(), E>

Visit an “exp” node in the syntax tree.

§Parameters
  • node: The “exp” node.
§Errors

An error if one occurs while visiting the “exp” node.

Source

fn visit_neg(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “neg” node in the syntax tree.

§Parameters
  • node: The “neg” node.
§Errors

An error if one occurs while visiting the “neg” node.

Source

fn visit_constant(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “constant” node in the syntax tree.

§Parameters
  • node: The “constant” node.
§Errors

An error if one occurs while visiting the “constant” node.

Source

fn visit_negative_constant(&mut self, node: &Node<'_>) -> Result<(), E>

Visit a “negative_constant” node in the syntax tree.

§Parameters
  • node: The “negative_constant” node.
§Errors

An error if one occurs while visiting the “negative_constant” node.

Implementors§