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

std.zon.parse: add parsing of enum literals as string #23261

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

Conversation

dasimmet
Copy link
Contributor

Hi @MasonRemaley ,

great job at std.zon!
to fully parse the new build.zig.zon schema's name field at runtime, we do not know the complete enum types,
so instead we could enable parsing those fields into slices.
For Example this type:

struct {
        name: []const u8,
}

can represent this ZON:

.{ .name = .packagen_name }

@dasimmet dasimmet force-pushed the mr/enum-literal-as-string branch from 62c1be0 to 2b54435 Compare March 15, 2025 20:22
Copy link
Contributor

@MasonRemaley MasonRemaley left a comment

Choose a reason for hiding this comment

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

Good idea.

My only suggested change is to rename enum_literals_as_string -> enum_literals_as_strings, other than that LGTM!

@MasonRemaley
Copy link
Contributor

MasonRemaley commented Mar 15, 2025

(Appreciate the tests covering @"..." and putting it behind an option btw, I expected to make those suggestions then saw that you already did both haha.)

dasimmet and others added 2 commits March 16, 2025 12:44
Co-authored-by: Mason Remaley <MasonRemaley@users.noreply.github.com>
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