[webkit-changes] [WebKit/WebKit] 4c345f: [WGSL] Handle lexing of line and block comments

Dan Glastonbury noreply at github.com
Tue Feb 14 14:56:22 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4c345f6c899172244aae4b9087c732afa7d01cab
      https://github.com/WebKit/WebKit/commit/4c345f6c899172244aae4b9087c732afa7d01cab
  Author: Dan Glastonbury <djg at apple.com>
  Date:   2023-02-14 (Tue, 14 Feb 2023)

  Changed paths:
    M Source/WebGPU/WGSL/Lexer.cpp
    M Source/WebGPU/WGSL/Lexer.h
    M Tools/TestWebKitAPI/Tests/WGSL/LexerTests.cpp

  Log Message:
  -----------
  [WGSL] Handle lexing of line and block comments
https://bugs.webkit.org/show_bug.cgi?id=252224
rdar://105430947

Reviewed by Myles C. Maxfield and Tadeu Zagallo.

WGSL supports single-line comments prefixed with // and block-comments delimited
by /* and */. Block comments can be nested so, unlike in C & C++, /* /* */ */ is
valid.

Detection of and reporting diagnostics of unbalanced block comments isn't
supported and will be implemented in another patch.

* Source/WebGPU/WGSL/Lexer.cpp:
(WGSL::Lexer<T>::lex):
(WGSL::Lexer<T>::shift):
(WGSL::Lexer<T>::newLine):
(WGSL::Lexer<T>::skipBlockComments):
(WGSL::Lexer<T>::skipLineComment):
(WGSL::Lexer<T>::skipWhitespaceAndComments):
(WGSL::Lexer<T>::skipWhitespace): Deleted.
* Source/WebGPU/WGSL/Lexer.h:
* Tools/TestWebKitAPI/Tests/WGSL/LexerTests.cpp:
(TestWGSLAPI::TEST):

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




More information about the webkit-changes mailing list