Add support for semicolon delimiters to wit-parser #1212
Merged
alexcrichton merged 2 commits intobytecodealliance:mainfrom Sep 26, 2023
Merged
Add support for semicolon delimiters to wit-parser #1212alexcrichton merged 2 commits intobytecodealliance:mainfrom
alexcrichton merged 2 commits intobytecodealliance:mainfrom
Conversation
This commit is an implementation of WebAssembly/component-model#142 to add semicolon delimiters to the WIT text format. The intention of this change is to be rolled out gradually to minimize ecosystem disruption (although some is inevitable). The strategy implemented in this commit is to add support to parse semicolons but optionally do so. Requiring semicolons is configured via: * A new `WIT_REQUIRE_SEMICOLONS` environment variable is now read. If set to `1` then semicolons are required during parsing. * A new `SourceMap::set_require_semicolons` is provided to programmatically indicate what to do. When semicolons are not required they are still parsed, but a failure is not generated if they're not present. This should allow semicolon-using WIT to coexist with non-semicolon-using WIT for a transitionary period. After a release or two the default for requiring semicolons will switch to `true` from the current `false`. That means that `WIT_REQUIRE_SEMICOLONS=0` can be used to keep old WITs compiling. The after a few releases of that support for optionally parsing semicolons will be removed and they'll be unconditionally required.
Additionally add environment-variable support to WIT printing to optionally print semicolons, disabled for now.
This was referenced Sep 20, 2023
pchickey
approved these changes
Sep 20, 2023
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This commit is an implementation of WebAssembly/component-model#142 to
add semicolon delimiters to the WIT text format. The intention of this
change is to be rolled out gradually to minimize ecosystem disruption
(although some is inevitable). The strategy implemented in this commit
is to add support to parse semicolons but optionally do so. Requiring
semicolons is configured via:
WIT_REQUIRE_SEMICOLONSenvironment variable is now read. Ifset to
1then semicolons are required during parsing.SourceMap::set_require_semicolonsis provided toprogrammatically indicate what to do.
When semicolons are not required they are still parsed, but a failure is
not generated if they're not present. This should allow semicolon-using
WIT to coexist with non-semicolon-using WIT for a transitionary period.
After a release or two the default for requiring semicolons will
switch to
truefrom the currentfalse. That means thatWIT_REQUIRE_SEMICOLONS=0can be used to keep old WITs compiling. Theafter a few releases of that support for optionally parsing semicolons
will be removed and they'll be unconditionally required.