Skip to content

Commit 73c6b40

Browse files
committed
yeast: Define Swift rules using the rules! macro
This gives us access to the input/output schemas during macro expansion, which we'll need in order to know whether an output node is a leaf node or not. We could in principle get rid of all of the inner `rule!` applications now and just inline them directly, but to prevent churn I have opted not to do so at this time.
1 parent 18b48aa commit 73c6b40

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • unified/extractor/src/languages/swift

‎unified/extractor/src/languages/swift/swift.rs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ fn member_chain(
143143
}
144144

145145
fn translation_rules() -> Vec<Rule<SwiftContext>> {
146-
vec![
146+
yeast::rules! {
147+
input: "swift_node_types.yml",
148+
output: "ast_types.yml",
149+
[
147150
// ---- Top-level ----
148151
// These rules translate the swift-syntax AST (camelCase kind names),
149152
// produced by the sibling `adapter` module from swift-syntax JSON.
@@ -1568,7 +1571,8 @@ fn translation_rules() -> Vec<Rule<SwiftContext>> {
15681571
tree!((unhandled_node))
15691572
}
15701573
),
1571-
]
1574+
]
1575+
}
15721576
}
15731577

15741578
pub fn language_spec(desugared_ast_schema: &'static str) -> desugaring::LanguageSpec {

0 commit comments

Comments
 (0)