[webkit-reviews] review granted: [Bug 236783] [WGSL] The lexer should use the functions from wtf/ASCIICType.h : [Attachment 452367] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 17 10:07:17 PST 2022


Darin Adler <darin at apple.com> has granted Robin Morisset
<rmorisset at apple.com>'s request for review:
Bug 236783: [WGSL] The lexer should use the functions from wtf/ASCIICType.h
https://bugs.webkit.org/show_bug.cgi?id=236783

Attachment 452367: Patch

https://bugs.webkit.org/attachment.cgi?id=452367&action=review




--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 452367
  --> https://bugs.webkit.org/attachment.cgi?id=452367
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=452367&action=review

> Source/WebGPU/WGSL/Lexer.cpp:163
> +	   if (isASCIIDigit (m_current)) {

Stray space here after isASCIIDigit.

> Source/WebGPU/WGSL/Lexer.cpp:191
> -	   } else if (isIdentifierStart(m_current)) {
> +	   } else if (isASCIIAlpha(m_current)) {

Not sure this change is an improvement. Might want isIdentifierStart so the
intent of the code is more apparent. The implementation of that function can
use isASCIIAlpha.

> Source/WebGPU/WGSL/Lexer.cpp:194
> -	       while (isValidIdentifierCharacter(m_current))
> +	       while (isASCIIAlphanumeric(m_current) || m_current == '_')

Ditto.

> Source/WebGPU/WGSL/Lexer.cpp:271
> -    while (isWhiteSpace(m_current)) {
> +    while (isASCIISpace(m_current)) {

It can be ambiguous sometimes which definition of whitespace to use in various
contexts. Might still want a named function for that.

> Source/WebGPU/WGSL/Lexer.cpp:301
> -	   value += readDecimal(m_current);
> +	   value += static_cast<uint64_t>(m_current - '0');

This code looks less elegant than the old.


More information about the webkit-reviews mailing list