mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-24 18:52:58 +03:00
Minor documentation
This commit is contained in:
parent
62d2de8c95
commit
b08706a2ff
@ -14,12 +14,13 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! This module contains a reconstructor Trait for the AST.
|
//! This module contains a Reconstructor trait for the AST.
|
||||||
//! It implements default methods for each node to be made
|
//! It implements default methods for each node to be made
|
||||||
//! given the information of the old node.
|
//! given the information of the old node.
|
||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
|
/// A Reconstructor trait for expressions in the AST.
|
||||||
pub trait ExpressionReconstructor {
|
pub trait ExpressionReconstructor {
|
||||||
type AdditionalOutput: Default;
|
type AdditionalOutput: Default;
|
||||||
|
|
||||||
@ -108,6 +109,7 @@ pub trait ExpressionReconstructor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A Reconstructor trait for statements in the AST.
|
||||||
pub trait StatementReconstructor: ExpressionReconstructor {
|
pub trait StatementReconstructor: ExpressionReconstructor {
|
||||||
fn reconstruct_statement(&mut self, input: Statement) -> Statement {
|
fn reconstruct_statement(&mut self, input: Statement) -> Statement {
|
||||||
match input {
|
match input {
|
||||||
@ -207,6 +209,7 @@ pub trait StatementReconstructor: ExpressionReconstructor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A Reconstructor trait for the program represented by the AST.
|
||||||
pub trait ProgramReconstructor: StatementReconstructor {
|
pub trait ProgramReconstructor: StatementReconstructor {
|
||||||
fn reconstruct_program(&mut self, input: Program) -> Program {
|
fn reconstruct_program(&mut self, input: Program) -> Program {
|
||||||
Program {
|
Program {
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
|
/// A Visitor trait for expressions in the AST.
|
||||||
pub trait ExpressionVisitor<'a> {
|
pub trait ExpressionVisitor<'a> {
|
||||||
type AdditionalInput: Default;
|
type AdditionalInput: Default;
|
||||||
type Output: Default;
|
type Output: Default;
|
||||||
@ -88,6 +89,7 @@ pub trait ExpressionVisitor<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A Visitor trait for statements in the AST.
|
||||||
pub trait StatementVisitor<'a>: ExpressionVisitor<'a> {
|
pub trait StatementVisitor<'a>: ExpressionVisitor<'a> {
|
||||||
fn visit_statement(&mut self, input: &'a Statement) {
|
fn visit_statement(&mut self, input: &'a Statement) {
|
||||||
match input {
|
match input {
|
||||||
@ -145,6 +147,7 @@ pub trait StatementVisitor<'a>: ExpressionVisitor<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A Visitor trait for the program represented by the AST.
|
||||||
pub trait ProgramVisitor<'a>: StatementVisitor<'a> {
|
pub trait ProgramVisitor<'a>: StatementVisitor<'a> {
|
||||||
fn visit_program(&mut self, input: &'a Program) {
|
fn visit_program(&mut self, input: &'a Program) {
|
||||||
input
|
input
|
||||||
|
Loading…
Reference in New Issue
Block a user