Skip to content

Commit

Permalink
Rust: distinguish [a, b] from [a; b]
Browse files Browse the repository at this point in the history
This splits the `ArrayExpr` class into `ArrayListExpr` and `ArrayRepeatExpr`.
This uses the `synth.from_class` machinery to integrate seamlessly into the
generated code, by hiding the extracted `ArrayExpr` behind an internal class
and replacing it with a hierarchy of those two classes under a new
`ArrayExpr` class.
  • Loading branch information
Paolo Tranquilli committed Dec 3, 2024
1 parent 06b1d8e commit 353f1ca
Show file tree
Hide file tree
Showing 49 changed files with 724 additions and 164 deletions.
8 changes: 8 additions & 0 deletions rust/ast-generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fn class_name(type_name: &str) -> String {
"Fn" => "Function",
"Literal" => "LiteralExpr",
"Type" => "TypeRef",
"ArrayExpr" => "ArrayExprInternal",
_ => type_name,
};
name.to_owned()
Expand Down Expand Up @@ -354,6 +355,13 @@ fn get_fields(node: &AstNodeSrc) -> Vec<FieldInfo> {
is_many: false,
});
}
"ArrayExpr" => {
result.push(FieldInfo {
name: "is_semicolon".to_string(),
tp: "predicate".to_string(),
is_many: true,
});
}
_ => {}
}

Expand Down
2 changes: 1 addition & 1 deletion rust/extractor/src/generated/.generated.list

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 24 additions & 20 deletions rust/extractor/src/generated/top.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions rust/extractor/src/translate/generated.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 353f1ca

Please sign in to comment.