Skip to content

Fix a grammar error#486

Merged
alexcrichton merged 1 commit intoWebAssembly:mainfrom
wspringer:fix/package-decl
Mar 31, 2025
Merged

Fix a grammar error#486
alexcrichton merged 1 commit intoWebAssembly:mainfrom
wspringer:fix/package-decl

Conversation

@wspringer
Copy link
Copy Markdown
Contributor

@wspringer wspringer commented Mar 30, 2025

In the existing situation, the package-decl always requires a semicolon at the end, which has some unexpected effects for nested package definitions:

Incorrectly considered valid according to the current grammar:

package foo:bar; {
  …
}

Note the semicolon between the package name and the curly braces.

Incorrectly considered invalid according to the current grammar:

package foo:bar {
  …
}

In order to fix this, this PR lifts the semicolon token out of the package-decl rule, into the wit-file rule.

Copy link
Copy Markdown
Collaborator

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

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

Thanks!

@alexcrichton alexcrichton merged commit 110eb6e into WebAssembly:main Mar 31, 2025
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