Skip to content
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

Quote Macro #93

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Quote Macro #93

wants to merge 5 commits into from

Conversation

NicholasLYang
Copy link
Collaborator

@NicholasLYang NicholasLYang commented Mar 7, 2021

I noticed we're using string interpolation a lot for code generation. There's a really handy quote macro crate that lets you turn code into a syntax object of sorts. I'm trying out converting the strings to quote macro. Let me know what you think!

Eventually we could look into using proc macros instead of handlebars.

@NicholasLYang NicholasLYang force-pushed the nicholas/quote-macro branch from ab2e5f8 to 9a2964c Compare March 7, 2021 20:10
@fruffy
Copy link
Collaborator

fruffy commented Mar 8, 2021

Btw you can also mark these as draft if they are not ready yet. CI should still run afaik

@fruffy
Copy link
Collaborator

fruffy commented Mar 15, 2021

Hmm this is hard to review. We used to have reference files for the queries that show the impact of changes like that. But we do not have those for the new compiler, right now. Without those, it is hard to tell how the quote macro changes the syntax of the generated filters. @jessberg which filters currently compile?

@jessberg
Copy link
Collaborator

Hmm this is hard to review. We used to have reference files for the queries that show the impact of changes like that. But we do not have those for the new compiler, right now. Without those, it is hard to tell how the quote macro changes the syntax of the generated filters. @jessberg which filters currently compile?

Currently get_service_name.cql and height.cql should work. You can compile them using:

target/debug/dtc -q example_queries/get_service_name.cql -o rust_filter/filter.rs -c sim -r productpage-v1

and

target/debug/dtc -q example_queries/height.cql -u example_udfs/height.rs -o rust_filter/filter.rs -c sim -r productpage-v1

@fruffy
Copy link
Collaborator

fruffy commented Mar 15, 2021

Okay, I will open a separate pull request with tests and reference files for those. After we can rebase this pull request and check the difference.

@fruffy
Copy link
Collaborator

fruffy commented Mar 15, 2021

Okay, you can update this pull request now. It is possible that the tests will fail because of a mismatch in reference files. We will have to update these.

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.

3 participants