Skip to content

Add support for semicolon delimiters to wit-parser #1212

Merged
alexcrichton merged 2 commits intobytecodealliance:mainfrom
alexcrichton:semicolons
Sep 26, 2023
Merged

Add support for semicolon delimiters to wit-parser #1212
alexcrichton merged 2 commits intobytecodealliance:mainfrom
alexcrichton:semicolons

Conversation

@alexcrichton
Copy link
Copy Markdown
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.
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