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

[zig] Parser: Add support for basic import exposes #7673

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gamebox
Copy link
Collaborator

@gamebox gamebox commented Mar 7, 2025

DO NOT MERGE! Working on supporting all exposes syntax.

}
n += 1;
}
fmt.push(']');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will there be a coherent effort at some point to handle optional multiline formatting (either based on trailing commas or newlines)? I presume so, which is why I haven't been commenting about it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We also need to support moving comments over, and my thinking is to handle those both in the same way. (altho I do like the trailing comment behavior!)

const scratch_top = self.store.scratchTokenTop();
while (self.peek() != .CloseSquare) {
if (self.parseIdent()) |ident| {
self.store.addScratchToken(ident);
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be nice if the exposes field would hold an enum along the lines of

const ExposedItem = union(enum) {
    value: Ident.Idx,
    @"type": Ident.Idx,
    custom_union: struct {
        name: Ident.Idx,
        tags: []Ident.Idx,
    },
};

The main benefit of value being distinct from @"type" is that we don't have to look at the first letter of the text to check if it's uppercase.

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