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

Syntax, type-checking, and runtime support for optional list elements #615

Merged
merged 2 commits into from
Dec 14, 2022

Conversation

TristonianJones
Copy link
Collaborator

As a refinement to optional values, this change introduces support for optional list elements during list literal construction:

// If 'b' is present on 'a', then the output will be [a.b, 'hello', 'world']
// else ['hello', 'world']
[?a.?b, 'hello', 'world'] 

There are some minor changes to the grammar to split up the .? and [? tokens so that ? appears as it's own token as otherwise the parser gets confused by a[?b] versus [?a[?b]]

@TristonianJones
Copy link
Collaborator Author

/gcbrun

@TristonianJones TristonianJones merged commit 32ac613 into google:master Dec 14, 2022
@TristonianJones TristonianJones deleted the opt-indices branch December 14, 2022 23:04
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