[webkit-changes] [WebKit/WebKit] 03ad7a: [WGSL] Extra trailing semicolons cause parsing fai...

Tadeu Zagallo noreply at github.com
Tue Sep 26 00:31:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 03ad7af7faf13b4e64d69cc18b3d4465c62ec334
      https://github.com/WebKit/WebKit/commit/03ad7af7faf13b4e64d69cc18b3d4465c62ec334
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-09-26 (Tue, 26 Sep 2023)

  Changed paths:
    M Source/WebGPU/WGSL/Parser.cpp
    M Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp

  Log Message:
  -----------
  [WGSL] Extra trailing semicolons cause parsing failure
https://bugs.webkit.org/show_bug.cgi?id=262044
rdar://115993754

Reviewed by Dan Glastonbury.

Although we skip extraneous semicolons at the begining of parseGlobalDecl and
parseStatement, that only works if there is declaration/statement after the
skipped semicolon. If it is a trailing semicolon, these functions will fail
as they expect to see the start of a declaration/statement after that.
In order to fix it, we move the skipping into the functions that consume
a list of declarations/statements, as they already detect whether they are
at the end of the list.

* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser<Lexer>::parseShader):
(WGSL::Parser<Lexer>::parseGlobalDecl):
(WGSL::Parser<Lexer>::parseStatement):
(WGSL::Parser<Lexer>::parseCompoundStatement):
* Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp:
(TEST):

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




More information about the webkit-changes mailing list