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

Add support for semicolon delimiters to wit-parser #1212

Merged
merged 2 commits into from
Sep 26, 2023

Conversation

alexcrichton
Copy link
Member

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.

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.
@alexcrichton alexcrichton merged commit 553ec51 into bytecodealliance:main Sep 26, 2023
15 checks passed
@alexcrichton alexcrichton deleted the semicolons branch September 26, 2023 13:49
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.

None yet

2 participants