wesl 0.7.26 → 0.7.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +283 -147
- package/dist/index.js +1765 -1143
- package/package.json +2 -2
- package/src/AbstractElems.ts +264 -82
- package/src/ClickableError.ts +8 -1
- package/src/Linker.ts +63 -67
- package/src/LinkerUtil.ts +141 -7
- package/src/LowerAndEmit.ts +660 -304
- package/src/Mangler.ts +1 -1
- package/src/ModuleResolver.ts +15 -4
- package/src/ParseWESL.ts +21 -33
- package/src/SrcMap.ts +7 -19
- package/src/StandardTypes.ts +1 -1
- package/src/WeslDevice.ts +1 -0
- package/src/debug/ASTtoString.ts +92 -76
- package/src/index.ts +1 -1
- package/src/parse/AttachComments.ts +289 -0
- package/src/parse/ExpressionUtil.ts +3 -3
- package/src/parse/Keywords.ts +1 -1
- package/src/parse/ParseAttribute.ts +49 -71
- package/src/parse/ParseCall.ts +3 -4
- package/src/parse/ParseControlFlow.ts +100 -56
- package/src/parse/ParseDirective.ts +9 -8
- package/src/parse/ParseDoBlock.ts +63 -0
- package/src/parse/ParseExpression.ts +11 -10
- package/src/parse/ParseFn.ts +11 -33
- package/src/parse/ParseGlobalVar.ts +36 -27
- package/src/parse/ParseIdent.ts +4 -5
- package/src/parse/ParseLocalVar.ts +16 -12
- package/src/parse/ParseLoop.ts +76 -39
- package/src/parse/ParseModule.ts +65 -19
- package/src/parse/ParseSimpleStatement.ts +112 -66
- package/src/parse/ParseStatement.ts +40 -67
- package/src/parse/ParseStruct.ts +8 -22
- package/src/parse/ParseType.ts +10 -13
- package/src/parse/ParseUtil.ts +26 -12
- package/src/parse/ParseValueDeclaration.ts +18 -31
- package/src/parse/ParseWesl.ts +11 -14
- package/src/parse/ParsingContext.ts +11 -9
- package/src/parse/WeslStream.ts +138 -121
- package/src/parse/stream/RegexMatchers.ts +45 -0
- package/src/parse/stream/WeslLexer.ts +249 -0
- package/src/test/BevyLink.test.ts +18 -11
- package/src/test/ConditionalElif.test.ts +4 -2
- package/src/test/DeclCommentEmit.test.ts +122 -0
- package/src/test/DoBlock.test.ts +164 -0
- package/src/test/FilterValidElements.test.ts +4 -6
- package/src/test/Linker.test.ts +23 -7
- package/src/test/Mangling.test.ts +8 -4
- package/src/test/ParseComments.test.ts +234 -6
- package/src/test/ParseConditionsV2.test.ts +47 -175
- package/src/test/ParseElifV2.test.ts +12 -33
- package/src/test/ParseErrorV2.test.ts +0 -0
- package/src/test/ParseWeslV2.test.ts +247 -626
- package/src/test/StatementEmit.test.ts +143 -0
- package/src/test/StripWesl.ts +24 -3
- package/src/test/TestLink.ts +19 -3
- package/src/test/TestUtil.ts +18 -8
- package/src/test/Tokenizer.test.ts +96 -0
- package/src/test/__snapshots__/ParseWeslV2.test.ts.snap +10 -42
- package/src/RawEmit.ts +0 -103
- package/src/Reflection.ts +0 -336
- package/src/TransformBindingStructs.ts +0 -320
- package/src/parse/ContentsHelpers.ts +0 -70
- package/src/parse/stream/CachingStream.ts +0 -48
- package/src/parse/stream/MatchersStream.ts +0 -85
|
@@ -10,26 +10,19 @@ test("parse @elif basic", () => {
|
|
|
10
10
|
"module
|
|
11
11
|
const %a @if
|
|
12
12
|
attribute @if(false)
|
|
13
|
-
text ' const '
|
|
14
13
|
typeDecl %a
|
|
15
14
|
decl %a
|
|
16
|
-
|
|
17
|
-
text '
|
|
18
|
-
'
|
|
15
|
+
literal literal(1)
|
|
19
16
|
const %a @elif
|
|
20
17
|
attribute @elif(true)
|
|
21
|
-
text ' const '
|
|
22
18
|
typeDecl %a
|
|
23
19
|
decl %a
|
|
24
|
-
|
|
25
|
-
text '
|
|
26
|
-
'
|
|
20
|
+
literal literal(2)
|
|
27
21
|
const %a @else
|
|
28
22
|
attribute @else
|
|
29
|
-
text ' const '
|
|
30
23
|
typeDecl %a
|
|
31
24
|
decl %a
|
|
32
|
-
|
|
25
|
+
literal literal(3)"
|
|
33
26
|
`);
|
|
34
27
|
});
|
|
35
28
|
|
|
@@ -40,15 +33,11 @@ test("parse @elif with complex condition", () => {
|
|
|
40
33
|
fn f() @if
|
|
41
34
|
attribute @if(foo)
|
|
42
35
|
decl %f
|
|
43
|
-
|
|
44
|
-
text '{}'
|
|
45
|
-
text '
|
|
46
|
-
'
|
|
36
|
+
block
|
|
47
37
|
fn f() @elif
|
|
48
38
|
attribute @elif(bar && !baz)
|
|
49
39
|
decl %f
|
|
50
|
-
|
|
51
|
-
text '{}'"
|
|
40
|
+
block"
|
|
52
41
|
`);
|
|
53
42
|
});
|
|
54
43
|
|
|
@@ -60,34 +49,24 @@ test("parse multiple @elif", () => {
|
|
|
60
49
|
"module
|
|
61
50
|
const %x @if
|
|
62
51
|
attribute @if(a)
|
|
63
|
-
text ' const '
|
|
64
52
|
typeDecl %x
|
|
65
53
|
decl %x
|
|
66
|
-
|
|
67
|
-
text '
|
|
68
|
-
'
|
|
54
|
+
literal literal(1)
|
|
69
55
|
const %x @elif
|
|
70
56
|
attribute @elif(b)
|
|
71
|
-
text ' const '
|
|
72
57
|
typeDecl %x
|
|
73
58
|
decl %x
|
|
74
|
-
|
|
75
|
-
text '
|
|
76
|
-
'
|
|
59
|
+
literal literal(2)
|
|
77
60
|
const %x @elif
|
|
78
61
|
attribute @elif(c)
|
|
79
|
-
text ' const '
|
|
80
62
|
typeDecl %x
|
|
81
63
|
decl %x
|
|
82
|
-
|
|
83
|
-
text '
|
|
84
|
-
'
|
|
64
|
+
literal literal(3)
|
|
85
65
|
const %x @else
|
|
86
66
|
attribute @else
|
|
87
|
-
text ' const '
|
|
88
67
|
typeDecl %x
|
|
89
68
|
decl %x
|
|
90
|
-
|
|
69
|
+
literal literal(4)"
|
|
91
70
|
`);
|
|
92
71
|
});
|
|
93
72
|
|
|
@@ -98,8 +77,8 @@ test("parse @elif on import", () => {
|
|
|
98
77
|
expect(astToString(ast.moduleElem)).toMatchInlineSnapshot(`
|
|
99
78
|
"module
|
|
100
79
|
import a::val; @if
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
80
|
+
attribute @if(false)
|
|
81
|
+
import b::val; @elif
|
|
82
|
+
attribute @elif(true)"
|
|
104
83
|
`);
|
|
105
84
|
});
|
|
Binary file
|