I'd like to write a declarative macro that I can use to annotate my source code for use by a non-Rust parser. Ideally, for purposes of Rust code, this macro would consume its input (typically a string constant) and generate no corresponding syntax at all in the compiled output.
The error I'm getting at the moment is this:
error: macro expansion ignores token `{` and any following
--> src/tests/sdd.rs:6:43
|
6 | macro_rules! track_file( ($($tt:tt)*) => {{}} );
| ^
|
::: src/tests/asciidoc_lang/root/index.rs:3:1
|
3 | track_file!("docs/modules/ROOT/pages/index.adoc");
| ------------------------------------------------- caused by the macro expansion here
|
= note: the usage of `track_file!` is likely invalid in item context
I don't typically work with declarative macros, so please be gentle. If there's a better way to accomplish this, I'd love to hear about it. The non-Rust parser is malleable (I'm writing it), but I'd prefer not to parse raw comments.
Edit: For context, here's a PR (not yet working, obvs) where I'd like to use this pattern: chore: Add macros to allow spec coverage tool to track spec implementation by scouten · Pull Request #167 · scouten/asciidoc-parser · GitHub. The intent here is to write an external parser that recognises specific tags (i.e. the no-op decl macros).