-
Notifications
You must be signed in to change notification settings - Fork 48
Rust Engine: print infrastructure #1600
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
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a36d91c
feat(rengine): make `Fragment[Ref]` complete
W95Psp b03673a
feat(rengine/macros): intro. partial_apply
W95Psp 3639e1c
feat(rengine/macros): intro. `prepend_associated_functions_with`
W95Psp cd66ec3
feat(rengine): enhance and fix `Print` trait
W95Psp d741169
feat(rengine): intro. trait `PrettyAst`
W95Psp 46237cd
fix(ocaml_of_json_schema): escape `module`
W95Psp a526066
chore: update lockfile
W95Psp 7f22dbb
fix(rengine): fix some clippy warnings
W95Psp af84fbc
feat(rengine): introduce module backend
W95Psp 04a3555
doc(rengine): add more doc
W95Psp 51ef3dd
fix(ocaml_of_json_schema): make esacping more uniform
W95Psp 7c1ef74
fix(rengine/macros): drop commented line
W95Psp 6124f9d
refactor(rengine): factor out list of visitbale AST types
W95Psp bd6af66
doc(rengine/macros): partial_apply
W95Psp 229aef3
doc(rengine): explicit differences between backends and printers
W95Psp 77053bf
misc(rengine): drop `opt!`
W95Psp 643423e
fix(rengine): drop `pretty_iter!`
W95Psp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| use proc_macro::TokenStream; | ||
| use quote::quote; | ||
| use syn::{ExprPath, Token, parse_macro_input}; | ||
|
|
||
| struct PartialApplyArgs { | ||
| ident: ExprPath, | ||
| bang: Option<Token![!]>, | ||
| prefix: proc_macro2::TokenStream, | ||
| } | ||
|
|
||
| impl syn::parse::Parse for PartialApplyArgs { | ||
| fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> { | ||
| let ident = input.parse()?; | ||
| let bang = input.parse()?; | ||
| input.parse::<syn::Token![,]>()?; | ||
| Ok(PartialApplyArgs { | ||
| ident, | ||
| bang, | ||
| prefix: input.parse()?, | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| /// See [`super::partial_apply`]. | ||
| pub(crate) fn partial_apply(attr: TokenStream, item: TokenStream) -> TokenStream { | ||
W95Psp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| let PartialApplyArgs { | ||
| ident, | ||
| bang, | ||
| prefix, | ||
| } = parse_macro_input!(attr as PartialApplyArgs); | ||
| let input_macro = parse_macro_input!(item as syn::ItemMacro); | ||
| let macro_name = input_macro.ident; | ||
| let attrs = input_macro.attrs; | ||
| quote! { | ||
| #(#attrs)* | ||
| macro_rules! #macro_name { | ||
| ($($rest:tt)*) => { | ||
| #ident #bang(#prefix $($rest)*) | ||
| }; | ||
| } | ||
| } | ||
| .into() | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.