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

[WGSL] Ignore extraneous semicolons in statements and declarations #9389

Conversation

tadeuzagallo
Copy link
Member

@tadeuzagallo tadeuzagallo commented Jan 31, 2023

4ce5ef2

[WGSL] Ignore extraneous semicolons in statements and declarations
https://bugs.webkit.org/show_bug.cgi?id=251442
rdar://104873247

Reviewed by Myles C. Maxfield.

Update parser to match the spec: semicolons are valid statements and declarations.
Add the code to `parseGlobalDecl` to skip semicolons and update `parseStatement`
so we don't allocate an empty node if we find extraneous semicolons.

* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser<Lexer>::parseGlobalDecl):
(WGSL::Parser<Lexer>::parseStatement):

Canonical link: https://commits.webkit.org/259668@main

a80cb1b

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe
βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug   πŸ›  gtk   πŸ›  wincairo
βœ… πŸ§ͺ webkitperl   πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac   πŸ§ͺ gtk-wk2
  πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk1   πŸ§ͺ api-gtk
βœ… πŸ›  tv   πŸ§ͺ mac-wk2
  πŸ›  tv-sim   πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch βœ… πŸ§ͺ mac-wk2-stress
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch-sim

@tadeuzagallo tadeuzagallo self-assigned this Jan 31, 2023
@tadeuzagallo tadeuzagallo added the WebGPU For bugs in WebGPU label Jan 31, 2023
@@ -530,16 +535,16 @@ Expected<UniqueRef<AST::Statement>, Error> Parser<Lexer>::parseStatement()
{
START_PARSE();

if (current().m_type == TokenType::Semicolon) {
consume();
return parseStatement();
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be a loop instead of recursive? (I'm thinking about stack space)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point

@tadeuzagallo tadeuzagallo force-pushed the eng/WGSL-Ignore-extraneous-commas-in-statements-and-declarations branch from 91962ad to a80cb1b Compare February 1, 2023 07:27
@tadeuzagallo tadeuzagallo added the merge-queue Applied to send a pull request to merge-queue label Feb 1, 2023
https://bugs.webkit.org/show_bug.cgi?id=251442
rdar://104873247

Reviewed by Myles C. Maxfield.

Update parser to match the spec: semicolons are valid statements and declarations.
Add the code to `parseGlobalDecl` to skip semicolons and update `parseStatement`
so we don't allocate an empty node if we find extraneous semicolons.

* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser<Lexer>::parseGlobalDecl):
(WGSL::Parser<Lexer>::parseStatement):

Canonical link: https://commits.webkit.org/259668@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/WGSL-Ignore-extraneous-commas-in-statements-and-declarations branch from a80cb1b to 4ce5ef2 Compare February 1, 2023 09:38
@webkit-commit-queue
Copy link
Collaborator

Committed 259668@main (4ce5ef2): https://commits.webkit.org/259668@main

Reviewed commits have been landed. Closing PR #9389 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit 4ce5ef2 into WebKit:main Feb 1, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Feb 1, 2023
@tadeuzagallo tadeuzagallo deleted the eng/WGSL-Ignore-extraneous-commas-in-statements-and-declarations branch May 17, 2023 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebGPU For bugs in WebGPU
Projects
None yet
4 participants