⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 239398 in webkit


Ignore:
Timestamp:
Dec 19, 2018, 3:27:45 PM (8 years ago)
Author:
mmaxfield@apple.com
Message:

[WHLSL] Add a handwritten lexer
​https://bugs.webkit.org/show_bug.cgi?id=192294

Reviewed by Jon Lee.

This is infrastructure necessary for ​https://bugs.webkit.org/show_bug.cgi?id=192355. The
implementation matches the lexing rules in the spec (specifically, the rules that start
with an uppercase letter). The spec is at
​https://github.com/gpuweb/WHLSL/blob/master/Spec/WHLSL.g4.

This patch also modifies the lexer according to ​https://github.com/gpuweb/WHLSL/pull/283.

No new tests because the lexer isn't hooked up yet; there are tests in the parser,
once that gets committed.

  • Modules/webgpu/WHLSL/WHLSLLexer.cpp: Added.

(WebCore::WHLSL::Lexer::Token::typeName):
(WebCore::WHLSL::Lexer::recognizeKeyword):
(WebCore::WHLSL::Lexer::consumeTokenFromStream):
(WebCore::WHLSL::Lexer::skipWhitespaceAndComments):
(WebCore::WHLSL::isWhitespace):
(WebCore::WHLSL::isNewline):
(WebCore::WHLSL::Lexer::skipWhitespace):
(WebCore::WHLSL::Lexer::skipLineComment):
(WebCore::WHLSL::Lexer::skipLongComment):
(WebCore::WHLSL::Lexer::coreDecimalIntLiteral const):
(WebCore::WHLSL::Lexer::decimalIntLiteral const):
(WebCore::WHLSL::Lexer::decimalUintLiteral const):
(WebCore::WHLSL::isHexadecimalCharacter):
(WebCore::WHLSL::Lexer::coreHexadecimalIntLiteral const):
(WebCore::WHLSL::Lexer::hexadecimalIntLiteral const):
(WebCore::WHLSL::Lexer::hexadecimalUintLiteral const):
(WebCore::WHLSL::Lexer::intLiteral const):
(WebCore::WHLSL::Lexer::uintLiteral const):
(WebCore::WHLSL::Lexer::digit const):
(WebCore::WHLSL::Lexer::digitStar const):
(WebCore::WHLSL::Lexer::character const):
(WebCore::WHLSL::Lexer::coreFloatLiteralType1 const):
(WebCore::WHLSL::Lexer::coreFloatLiteral const):
(WebCore::WHLSL::Lexer::floatLiteral const):
(WebCore::WHLSL::Lexer::validIdentifier const):
(WebCore::WHLSL::Lexer::identifier const):
(WebCore::WHLSL::Lexer::operatorName const):

  • Modules/webgpu/WHLSL/WHLSLLexer.h: Added.

(WebCore::WHLSL::Lexer::Lexer):
(WebCore::WHLSL::Lexer::consumeToken):
(WebCore::WHLSL::Lexer::unconsumeToken):
(WebCore::WHLSL::Lexer::state const):
(WebCore::WHLSL::Lexer::setState):
(WebCore::WHLSL::Lexer::isFullyConsumed const):
(WebCore::WHLSL::Lexer::errorString):
(WebCore::WHLSL::Lexer::string const):
(WebCore::WHLSL::Lexer::anyCharacter const):

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
Location:
trunk/Source/WebCore
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r239397 r239398  
     12018-12-19  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [WHLSL] Add a handwritten lexer
     4        https://bugs.webkit.org/show_bug.cgi?id=192294
     5
     6        Reviewed by Jon Lee.
     7
     8        This is infrastructure necessary for https://bugs.webkit.org/show_bug.cgi?id=192355. The
     9        implementation matches the lexing rules in the spec (specifically, the rules that start
     10        with an uppercase letter). The spec is at
     11        https://github.com/gpuweb/WHLSL/blob/master/Spec/WHLSL.g4.
     12
     13        This patch also modifies the lexer according to https://github.com/gpuweb/WHLSL/pull/283.
     14
     15        No new tests because the lexer isn't hooked up yet; there are tests in the parser,
     16        once that gets committed.
     17
     18        * Modules/webgpu/WHLSL/WHLSLLexer.cpp: Added.
     19        (WebCore::WHLSL::Lexer::Token::typeName):
     20        (WebCore::WHLSL::Lexer::recognizeKeyword):
     21        (WebCore::WHLSL::Lexer::consumeTokenFromStream):
     22        (WebCore::WHLSL::Lexer::skipWhitespaceAndComments):
     23        (WebCore::WHLSL::isWhitespace):
     24        (WebCore::WHLSL::isNewline):
     25        (WebCore::WHLSL::Lexer::skipWhitespace):
     26        (WebCore::WHLSL::Lexer::skipLineComment):
     27        (WebCore::WHLSL::Lexer::skipLongComment):
     28        (WebCore::WHLSL::Lexer::coreDecimalIntLiteral const):
     29        (WebCore::WHLSL::Lexer::decimalIntLiteral const):
     30        (WebCore::WHLSL::Lexer::decimalUintLiteral const):
     31        (WebCore::WHLSL::isHexadecimalCharacter):
     32        (WebCore::WHLSL::Lexer::coreHexadecimalIntLiteral const):
     33        (WebCore::WHLSL::Lexer::hexadecimalIntLiteral const):
     34        (WebCore::WHLSL::Lexer::hexadecimalUintLiteral const):
     35        (WebCore::WHLSL::Lexer::intLiteral const):
     36        (WebCore::WHLSL::Lexer::uintLiteral const):
     37        (WebCore::WHLSL::Lexer::digit const):
     38        (WebCore::WHLSL::Lexer::digitStar const):
     39        (WebCore::WHLSL::Lexer::character const):
     40        (WebCore::WHLSL::Lexer::coreFloatLiteralType1 const):
     41        (WebCore::WHLSL::Lexer::coreFloatLiteral const):
     42        (WebCore::WHLSL::Lexer::floatLiteral const):
     43        (WebCore::WHLSL::Lexer::validIdentifier const):
     44        (WebCore::WHLSL::Lexer::identifier const):
     45        (WebCore::WHLSL::Lexer::operatorName const):
     46        * Modules/webgpu/WHLSL/WHLSLLexer.h: Added.
     47        (WebCore::WHLSL::Lexer::Lexer):
     48        (WebCore::WHLSL::Lexer::consumeToken):
     49        (WebCore::WHLSL::Lexer::unconsumeToken):
     50        (WebCore::WHLSL::Lexer::state const):
     51        (WebCore::WHLSL::Lexer::setState):
     52        (WebCore::WHLSL::Lexer::isFullyConsumed const):
     53        (WebCore::WHLSL::Lexer::errorString):
     54        (WebCore::WHLSL::Lexer::string const):
     55        (WebCore::WHLSL::Lexer::anyCharacter const):
     56        * Sources.txt:
     57        * WebCore.xcodeproj/project.pbxproj:
     58
    1592018-12-18  Simon Fraser  <simon.fraser@apple.com>
    260
  • trunk/Source/WebCore/Sources.txt

    r239351 r239398  
    302302
    303303Modules/webgpu/DOMWindowWebGPU.cpp
     304Modules/webgpu/WHLSL/WHLSLLexer.cpp
    304305Modules/webgpu/WebGPU.cpp
    305306Modules/webgpu/WebGPUAdapter.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r239351 r239398  
    1321313213                C1E1D235203DF15400584665 /* ScreenProperties.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScreenProperties.h; sourceTree = "<group>"; };
    1321413214                C2015C091BE6FE2C00822389 /* FontVariantBuilder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontVariantBuilder.h; sourceTree = "<group>"; };
     13215                C210E91121B4BD1000B7F83D /* WHLSLLexer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLLexer.cpp; sourceTree = "<group>"; };
     13216                C210E91221B4BD1000B7F83D /* WHLSLLexer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLLexer.h; sourceTree = "<group>"; };
    1321513217                C21DF2E71D9E4E9900F5B24C /* CSSFontVariationValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontVariationValue.cpp; sourceTree = "<group>"; };
    1321613218                C21DF2E81D9E4E9900F5B24C /* CSSFontVariationValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontVariationValue.h; sourceTree = "<group>"; };
    … …  
    2521825220                        usesTabs = 0;
    2521925221                };
     25222                C210E90D21B4BCA400B7F83D /* WHLSL */ = {
     25223                        isa = PBXGroup;
     25224                        children = (
     25225                                C210E91121B4BD1000B7F83D /* WHLSLLexer.cpp */,
     25226                                C210E91221B4BD1000B7F83D /* WHLSLLexer.h */,
     25227                        );
     25228                        path = WHLSL;
     25229                        sourceTree = "<group>";
     25230                };
    2522025231                C96F5EBF1B5872260091EA9D /* mediasession */ = {
    2522125232                        isa = PBXGroup;
    … …  
    2556025571                        isa = PBXGroup;
    2556125572                        children = (
     25573                                C210E90D21B4BCA400B7F83D /* WHLSL */,
    2556225574                                D00F5941216ECC7A000D71DB /* DOMWindowWebGPU.cpp */,
    2556325575                                D00F5940216ECC7A000D71DB /* DOMWindowWebGPU.h */,
Note: See TracChangeset for help on using the changeset viewer.