Skip to content

Quote Macro#93

Open
NicholasLYang wants to merge 5 commits into
masterfrom
nicholas/quote-macro
Open

Quote Macro#93
NicholasLYang wants to merge 5 commits into
masterfrom
nicholas/quote-macro

Conversation

@NicholasLYang

@NicholasLYang NicholasLYang commented Mar 7, 2021

Copy link
Copy Markdown
Collaborator

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

fruffy commented Mar 8, 2021

Copy link
Copy Markdown
Collaborator

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

@fruffy

fruffy commented Mar 15, 2021

Copy link
Copy Markdown
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?

@jessberg

Copy link
Copy Markdown
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

fruffy commented Mar 15, 2021

Copy link
Copy Markdown
Collaborator

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

fruffy commented Mar 15, 2021

Copy link
Copy Markdown
Collaborator

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