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

generator: Generate enums from vk_parse representation #410

Merged
merged 4 commits into from
Apr 18, 2021

Conversation

MarijnS95
Copy link
Collaborator

@MarijnS95 MarijnS95 commented Mar 20, 2021

Depends on #409 merged already.

This change prepares for future additions in vk_parse fields (1) by converting over the enum generation path from vkxml. Most of the conversion is easy by repurposing the existing EnumSpec parsing logic from extension constants for all enumeration variants, with slight modifications to not bail when extends is not set which is specific to extension constants.

As an (unintended) added bonus this unification of the EnumSpec codepath allows aliases (for backwards-compatible names) to be generated as discussed earlier in 2.


@MaikKlein you're probably wondering by now why I'm not helping pushing generator2 over the finish line. Would you mind providing a status/progress update in #344 and clarify the reason behind removing quote!()/syn, instead opting for manual string manipulation?

generator/src/lib.rs Outdated Show resolved Hide resolved
This change prepares for future additions in vk_parse fields ([1]) by
converting over the enum generation path from vkxml.  Most of the
conversion is easy by repurposing the existing `EnumSpec` parsing logic
from extension constants for all enumeration variants, with slight
modifications to not bail when `extends` is not set which is specific to
extension constants.

As an (unintended) added bonus this unification of the `EnumSpec`
codepath allows aliases (for backwards-compatible names) to be generated
as discussed earlier in [2].

[1]: krolli/vk-parse#17
[2]: ash-rs#384 (comment)
All constant aliases for misspelled items (missing `_BIT` andsoforth)
contain the text "backwards compatibility" or "Backwards-compatible
alias".
These already have a match against the name they're aliasing, and some
of the aliases are "deprecated" (since they're just typo fixups for
backwards compatibility).
@MaikKlein MaikKlein merged commit 46ed515 into ash-rs:master Apr 18, 2021
@MarijnS95 MarijnS95 deleted the enum-vk-parse branch April 18, 2021 20:01
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