8000 Implement a derive macro by hchataing · Pull Request #61 · google/pdl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implement a derive macro #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 31, 2023
Merged

Implement a derive macro #61

merged 3 commits into from
Aug 31, 2023

Conversation

hchataing
Copy link
Collaborator
  • Modify pdl_compiler::parser::parse_file to input file path by reference
  • Implement pdl derive proc_macro attribute
  • Implement proc_macro_attribute to derive pdl backend

@mgeisler mgeisler changed the title derive Implement a derive macro Aug 31, 2023
@mgeisler
Copy link
Collaborator

I would love to see this in action — right now I only have a vague idea of how this will actually work. We would also need documentation and the new create should probably have its own README instead of reusing the one from the compiler.

Copy link
Collaborator
@mgeisler mgeisler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks for including an example!

The `pdl` proc_macro attribute is used on a module
definition. The proc_macro implementation preserves
the module name, attributes, and items.

Usage:
```
#[pdl("input.pdl")]
mod backend {
}
```
@hchataing hchataing merged commit e67561a into main Aug 31, 2023
@hchataing hchataing deleted the derive branch August 31, 2023 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0