-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(visitor): move visitors to their own crate.
- Loading branch information
Showing
9 changed files
with
97 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
mod ast; | ||
mod ast_factory; | ||
mod precedence; | ||
mod visit; | ||
|
||
pub mod ast; | ||
|
||
pub use ast::*; | ||
pub use ast_factory::*; | ||
pub use precedence::*; | ||
pub use visit::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
mod debug; | ||
mod span; | ||
mod span_view; | ||
mod debug; | ||
|
||
pub use span::*; | ||
pub use span_view::*; | ||
|
||
pub type ReferenceId = usize; | ||
pub type ReferenceType = usize; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "fuse_visitor" | ||
version = "0.0.0" | ||
authors.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
edition.workspace = true | ||
|
||
[dependencies] | ||
fuse_ast = { workspace = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
mod visitor; | ||
mod visitor_mut; | ||
|
||
pub use visitor::*; | ||
pub use visitor_mut::*; | ||
|
||
/// Placeholder macro for visiting, It is used instead of calling visitor methods directly. | ||
/// Would be useful if we need some operation to happen for every visit. | ||
#[macro_export] | ||
macro_rules! visit { | ||
($expr:expr) => { | ||
$expr | ||
}; | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! visit_list { | ||
($visitor:ident.$method:ident($list:expr $(, $($extra_args:expr), *)?)) => { | ||
for elem in $list { | ||
visit!($visitor.$method(elem $(, $($extra_args),*)?)) | ||
} | ||
}; | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! visit_scope { | ||
($visitor:ident => $block:block) => { | ||
$visitor.enter_scope(); | ||
$block | ||
$visitor.leave_scope(); | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters