mirror of
https://github.com/github/codeql.git
synced 2026-07-27 22:11:55 +02:00
This macro allows the easy addition of multiple rules at the same time. In addition, it also accepts an input and output schema, which eventually will be used to check the validity of the rewrite rules.
26 lines
798 B
Rust
26 lines
798 B
Rust
/// Smoke test: load a few real Swift translation rules through the new
|
|
/// `yeast::rules!` macro using the bare-rule-body syntax, and confirm the
|
|
/// input + output schemas accept them. Compiles only — any type-checking
|
|
/// error surfaces as a compile-time error.
|
|
#[test]
|
|
fn rules_macro_compiles_against_real_swift_schemas() {
|
|
let _rules: Vec<yeast::Rule> = yeast::rules! {
|
|
input: "tree-sitter-swift/node-types.yml",
|
|
output: "ast_types.yml",
|
|
[
|
|
(simple_identifier) @name
|
|
=>
|
|
(name_expr
|
|
identifier: (identifier #{name})),
|
|
|
|
(integer_literal) @lit
|
|
=>
|
|
(int_literal #{lit}),
|
|
|
|
(line_string_literal) @lit
|
|
=>
|
|
(string_literal #{lit}),
|
|
]
|
|
};
|
|
}
|