Skip to content

Commit 2ccc1b1

Browse files
committed
Implement accept and accept_mut.
Signed-off-by: James Goppert <james.goppert@gmail.com>
1 parent 0e57555 commit 2ccc1b1

File tree

4 files changed

+586
-79
lines changed

4 files changed

+586
-79
lines changed

src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct Args {
1515

1616
fn main() -> Result<(), Box<dyn std::error::Error>> {
1717
let args = Args::parse();
18-
let mut def = rumoca_parser::parse_file(&args.model_file);
18+
let def = rumoca_parser::parse_file(&args.model_file);
1919

2020
if args.verbose {
2121
println!("{:#?}", def);

src/s2_analysis/print_visitor.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ impl Visitor for PrintVisitor {
3030
self.level -= 1;
3131
}
3232

33-
fn enter_stored_definition(&mut self, _node: &mut ast::StoredDefinition) {
33+
fn enter_stored_definition(&mut self, _node: &ast::StoredDefinition) {
3434
self.print("Stored definition");
3535
}
3636

37-
fn enter_class_definition(&mut self, node: &mut ast::ClassDefinition) {
37+
fn enter_class_definition(&mut self, node: &ast::ClassDefinition) {
3838
if let ast::ClassSpecifier::Long { name, .. } = &node.specifier {
3939
self.print(&format!("class {}", name));
4040
}
4141
}
4242

43-
fn exit_class_definition(&mut self, _node: &mut ast::ClassDefinition) {
43+
fn exit_class_definition(&mut self, _node: &ast::ClassDefinition) {
4444
println!("\n");
4545
}
4646

47-
fn enter_expression(&mut self, node: &mut ast::Expression) {
47+
fn enter_expression(&mut self, node: &ast::Expression) {
4848
match node {
4949
ast::Expression::Binary { op, .. } => {
5050
self.print(&format!("{:?}", op));
@@ -80,7 +80,7 @@ impl Visitor for PrintVisitor {
8080
}
8181
}
8282

83-
fn enter_equation(&mut self, node: &mut ast::Equation) {
83+
fn enter_equation(&mut self, node: &ast::Equation) {
8484
match node {
8585
ast::Equation::Connect { .. } => {
8686
self.print("connect");
@@ -96,11 +96,11 @@ impl Visitor for PrintVisitor {
9696
}
9797
}
9898

99-
fn enter_component_declaration(&mut self, node: &mut ast::ComponentDeclaration) {
99+
fn enter_component_declaration(&mut self, node: &ast::ComponentDeclaration) {
100100
self.print(&format!("component: {}", node.declaration.name));
101101
}
102102

103-
fn exit_component_reference(&mut self, node: &mut ast::ComponentReference) {
103+
fn exit_component_reference(&mut self, node: &ast::ComponentReference) {
104104
let mut s: String = "".to_string();
105105
for (index, part) in node.parts.iter().enumerate() {
106106
if index != 0 || node.local {

0 commit comments

Comments
 (0)