summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Neto <dneto@google.com>2023-03-30 05:09:02 -0400
committerGitHub <noreply@github.com>2023-03-30 11:09:02 +0200
commit5175d68c87a5660da150e3cd942ad90d55b8f143 (patch)
tree4f1031a522a77804a5c5b1571d73371bba221930
parente8fe38fa9a04afc04643d0598058ebb8449e2755 (diff)
downloadpygments-git-5175d68c87a5660da150e3cd942ad90d55b8f143.tar.gz
Lexer for the WebGPU Shading Language (#2386)
See https://w3.org/TR/WGSL Further work is needed to refine it: - treat context-dependent names specially - treat template start and template end tokens specially, perhaps Fixes: #2388
-rw-r--r--AUTHORS1
-rw-r--r--pygments/lexers/_mapping.py1
-rw-r--r--pygments/lexers/wgsl.py404
-rw-r--r--tests/snippets/wgsl/address-space.txt72
-rw-r--r--tests/snippets/wgsl/attribute.txt87
-rw-r--r--tests/snippets/wgsl/block-comment.txt34
-rw-r--r--tests/snippets/wgsl/bool-types.txt47
-rw-r--r--tests/snippets/wgsl/const-numbers.txt549
-rw-r--r--tests/snippets/wgsl/depth-texture.txt97
-rw-r--r--tests/snippets/wgsl/external-texture.txt21
-rw-r--r--tests/snippets/wgsl/line-comment.txt13
-rw-r--r--tests/snippets/wgsl/multisampled-texture.txt24
-rw-r--r--tests/snippets/wgsl/numeric-types.txt642
-rw-r--r--tests/snippets/wgsl/sampled-texture.txt134
-rw-r--r--tests/snippets/wgsl/storage-texture.txt98
-rw-r--r--tests/snippets/wgsl/texel-formats.txt410
-rw-r--r--tests/snippets/wgsl/tiny-render.txt105
-rw-r--r--tests/snippets/wgsl/type-generators.txt43
18 files changed, 2782 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index 876a37d7..e80bd121 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -163,6 +163,7 @@ Other contributors, listed alphabetically, are:
* Mher Movsisyan -- DTD lexer
* Dejan Muhamedagic -- Crmsh lexer
* Ana Nelson -- Ragel, ANTLR, R console lexers
+* David Neto, Google LLC -- WebGPU Shading Language lexer
* Kurt Neufeld -- Markdown lexer
* Nam T. Nguyen -- Monokai style
* Jesper Noehr -- HTML formatter "anchorlinenos"
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py
index 34a3bd2a..ed3d00b1 100644
--- a/pygments/lexers/_mapping.py
+++ b/pygments/lexers/_mapping.py
@@ -530,6 +530,7 @@ LEXERS = {
'WDiffLexer': ('pygments.lexers.diff', 'WDiff', ('wdiff',), ('*.wdiff',), ()),
'WatLexer': ('pygments.lexers.webassembly', 'WebAssembly', ('wast', 'wat'), ('*.wat', '*.wast'), ()),
'WebIDLLexer': ('pygments.lexers.webidl', 'Web IDL', ('webidl',), ('*.webidl',), ()),
+ 'WgslLexer': ('pygments.lexers.wgsl', 'WebGPU Shading Language', ('wgsl',), ('*.wgsl',), ('text/wgsl',)),
'WhileyLexer': ('pygments.lexers.whiley', 'Whiley', ('whiley',), ('*.whiley',), ('text/x-whiley',)),
'WoWTocLexer': ('pygments.lexers.wowtoc', 'World of Warcraft TOC', ('wowtoc',), ('*.toc',), ()),
'WrenLexer': ('pygments.lexers.wren', 'Wren', ('wren',), ('*.wren',), ()),
diff --git a/pygments/lexers/wgsl.py b/pygments/lexers/wgsl.py
new file mode 100644
index 00000000..2a72c904
--- /dev/null
+++ b/pygments/lexers/wgsl.py
@@ -0,0 +1,404 @@
+"""
+ pygments.lexers.wgsl
+ ~~~~~~~~~~~~~~~~~~~~
+
+ Lexer for the WebGPU Shading Language.
+
+ :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+from pygments.lexer import RegexLexer, include, bygroups, words, default
+from pygments.token import Comment, Operator, Keyword, Name, \
+ Number, Punctuation, Whitespace
+from pygments import unistring as uni
+
+__all__ = ['WgslLexer']
+
+LF = '\\u000a'
+VT = '\\u000b'
+FF = '\\u000c'
+CR = '\\u000d'
+NextLine = '\\u0085'
+LineSep = '\\u2028'
+ParaSep = '\\u2029'
+LineEndCodePoints = [LF,VT,FF,CR,NextLine,LineSep,ParaSep]
+NotLineEndRE = '[^' + "".join(LineEndCodePoints) + ']'
+LineEndRE = '[' + "".join(LineEndCodePoints) + ']'
+
+# https://www.w3.org/TR/WGSL/#syntax-ident_pattern_token
+ident_pattern_token = '([{}][{}]+)|[{}]'.format(uni.xid_start,uni.xid_continue,uni.xid_start)
+
+class WgslLexer(RegexLexer):
+ """
+ Lexer for the WebGPU Shading Language.
+ """
+ name = 'WebGPU Shading Language'
+ url = 'https://www.w3.org/TR/WGSL/'
+ aliases = ['wgsl']
+ filenames = ['*.wgsl']
+ mimetypes = ['text/wgsl']
+
+ # https://www.w3.org/TR/WGSL/#var-and-value
+ keyword_decl = (words('var let const override'.split(),suffix=r'\b'), Keyword.Declaration)
+ # https://www.w3.org/TR/WGSL/#keyword-summary
+ keywords = (words("""
+ alias
+ break
+ case
+ const_assert
+ continue
+ continuing
+ default
+ diagnostic
+ discard
+ else
+ enable
+ false
+ fn
+ for
+ if
+ loop
+ requires
+ return
+ struct
+ switch
+ true
+ while
+ """.split(), suffix=r'\b'), Keyword)
+
+ # https://www.w3.org/TR/WGSL/#reserved-words
+ keyword_reserved = (words("""
+ NULL
+ Self
+ abstract
+ active
+ alignas
+ alignof
+ as
+ asm
+ asm_fragment
+ async
+ attribute
+ auto
+ await
+ become
+ binding_array
+ cast
+ catch
+ class
+ co_await
+ co_return
+ co_yield
+ coherent
+ column_major
+ common
+ compile
+ compile_fragment
+ concept
+ const_cast
+ consteval
+ constexpr
+ constinit
+ crate
+ debugger
+ decltype
+ delete
+ demote
+ demote_to_helper
+ do
+ dynamic_cast
+ enum
+ explicit
+ export
+ extends
+ extern
+ external
+ fallthrough
+ filter
+ final
+ finally
+ friend
+ from
+ fxgroup
+ get
+ goto
+ groupshared
+ highp
+ impl
+ implements
+ import
+ inline
+ instanceof
+ interface
+ layout
+ lowp
+ macro
+ macro_rules
+ match
+ mediump
+ meta
+ mod
+ module
+ move
+ mut
+ mutable
+ namespace
+ new
+ nil
+ noexcept
+ noinline
+ nointerpolation
+ noperspective
+ null
+ nullptr
+ of
+ operator
+ package
+ packoffset
+ partition
+ pass
+ patch
+ pixelfragment
+ precise
+ precision
+ premerge
+ priv
+ protected
+ pub
+ public
+ readonly
+ ref
+ regardless
+ register
+ reinterpret_cast
+ require
+ resource
+ restrict
+ self
+ set
+ shared
+ sizeof
+ smooth
+ snorm
+ static
+ static_assert
+ static_cast
+ std
+ subroutine
+ super
+ target
+ template
+ this
+ thread_local
+ throw
+ trait
+ try
+ type
+ typedef
+ typeid
+ typename
+ typeof
+ union
+ unless
+ unorm
+ unsafe
+ unsized
+ use
+ using
+ varying
+ virtual
+ volatile
+ wgsl
+ where
+ with
+ writeonly
+ yield
+ """.split(), suffix=r'\b'), Keyword.Reserved)
+
+ # https://www.w3.org/TR/WGSL/#predeclared-enumerants
+ predeclared_enums = (words("""
+ read write read_write
+ function private workgroup uniform storage
+ perspective linear flat
+ center centroid sample
+ vertex_index instance_index position front_facing frag_depth
+ local_invocation_id local_invocation_index
+ global_invocation_id workgroup_id num_workgroups
+ sample_index sample_mask
+ rgba8unorm
+ rgba8snorm
+ rgba8uint
+ rgba8sint
+ rgba16uint
+ rgba16sint
+ rgba16float
+ r32uint
+ r32sint
+ r32float
+ rg32uint
+ rg32sint
+ rg32float
+ rgba32uint
+ rgba32sint
+ rgba32float
+ bgra8unorm
+ """.split(), suffix=r'\b'), Name.Builtin)
+
+ # https://www.w3.org/TR/WGSL/#predeclared-types
+ predeclared_types = (words("""
+ bool
+ f16
+ f32
+ i32
+ sampler sampler_comparison
+ texture_depth_2d
+ texture_depth_2d_array
+ texture_depth_cube
+ texture_depth_cube_array
+ texture_depth_multisampled_2d
+ texture_external
+ texture_external
+ u32
+ """.split(), suffix=r'\b'), Name.Builtin)
+
+ # https://www.w3.org/TR/WGSL/#predeclared-types
+ predeclared_type_generators = (words("""
+ array
+ atomic
+ mat2x2
+ mat2x3
+ mat2x4
+ mat3x2
+ mat3x3
+ mat3x4
+ mat4x2
+ mat4x3
+ mat4x4
+ ptr
+ texture_1d
+ texture_2d
+ texture_2d_array
+ texture_3d
+ texture_cube
+ texture_cube_array
+ texture_multisampled_2d
+ texture_storage_1d
+ texture_storage_2d
+ texture_storage_2d_array
+ texture_storage_3d
+ vec2
+ vec3
+ vec4
+ """.split(), suffix=r'\b'), Name.Builtin)
+
+ # Predeclared type aliases for vectors
+ # https://www.w3.org/TR/WGSL/#vector-types
+ predeclared_type_alias_vectors = (words("""
+ vec2i vec3i vec4i
+ vec2u vec3u vec4u
+ vec2f vec3f vec4f
+ vec2h vec3h vec4h
+ """.split(), suffix=r'\b'), Name.Builtin)
+
+ # Predeclared type aliases for matrices
+ # https://www.w3.org/TR/WGSL/#matrix-types
+ predeclared_type_alias_matrices = (words("""
+ mat2x2f mat2x3f mat2x4f
+ mat3x2f mat3x3f mat3x4f
+ mat4x2f mat4x3f mat4x4f
+ mat2x2h mat2x3h mat2x4h
+ mat3x2h mat3x3h mat3x4h
+ mat4x2h mat4x3h mat4x4h
+ """.split(), suffix=r'\b'), Name.Builtin)
+
+ tokens = {
+ 'blankspace': [
+ # https://www.w3.org/TR/WGSL/#blankspace
+ (r'[\u0020\u0009\u000a\u000b\u000c\u000d\u0085\u200e\u200f\u2028\u2029]+', Whitespace),
+ ],
+ 'comments': [
+ # Line ending comments
+ # Match up CR/LF pair first.
+ (r'//{}*{}{}'.format(NotLineEndRE,CR,LF), Comment.Single),
+ (r'//{}*{}'.format(NotLineEndRE,LineEndRE), Comment.Single),
+ (r'/\*', Comment.Multiline, 'block_comment'),
+ ],
+ 'attribute': [
+ include('blankspace'),
+ include('comments'),
+ (ident_pattern_token, Name.Decorator,'#pop'),
+ default('#pop'),
+ ],
+ 'root': [
+ include('blankspace'),
+ include('comments'),
+
+ # Attributes.
+ # https://www.w3.org/TR/WGSL/#attributes
+ # Mark the '@' and the attribute name as a decorator.
+ (r'@', Name.Decorator, 'attribute'),
+
+ # Keywords
+ (r'(true|false)\b', Keyword.Constant),
+ keyword_decl,
+ keywords,
+ keyword_reserved,
+
+ # Predeclared
+ predeclared_enums,
+ predeclared_types,
+ predeclared_type_generators,
+ predeclared_type_alias_vectors,
+ predeclared_type_alias_matrices,
+
+ # Decimal float literals
+ # https://www.w3.org/TR/WGSL/#syntax-decimal_float_literal
+ # 0, with type-specifying suffix.
+ (r'0[fh]', Number.Float),
+ # Other decimal integer, with type-specifying suffix.
+ (r'[1-9][0-9]*[fh]', Number.Float),
+ # Has decimal point, at least one digit after decimal.
+ (r'[0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[fh]?', Number.Float),
+ # Has decimal point, at least one digit before decimal.
+ (r'[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?[fh]?', Number.Float),
+ # Has at least one digit, and has an exponent.
+ (r'[0-9]+[eE][+-]?[0-9]+[fh]?', Number.Float),
+
+ # Hex float literals
+ # https://www.w3.org/TR/WGSL/#syntax-hex_float_literal
+ (r'0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+([pP][+-]?[0-9]+[fh]?)?', Number.Float),
+ (r'0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*([pP][+-]?[0-9]+[fh]?)?', Number.Float),
+ (r'0[xX][0-9a-fA-F]+[pP][+-]?[0-9]+[fh]?', Number.Float),
+
+ # Hexadecimal integer literals
+ # https://www.w3.org/TR/WGSL/#syntax-hex_int_literal
+ (r'0[xX][0-9a-fA-F]+[iu]?', Number.Hex),
+ # Decimal integer literals
+ # https://www.w3.org/TR/WGSL/#syntax-decimal_int_literal
+ # We need two rules here because 01 is not valid.
+ (r'[1-9][0-9]*[iu]?', Number.Integer),
+ (r'0[iu]?', Number.Integer), # Must match last.
+
+ # Operators and Punctuation
+ (r'[{}()\[\],\.;:]', Punctuation),
+ (r'->', Punctuation), # Return-type arrow
+ (r'[+\-*/%&|<>^!~=]', Operator),
+
+ # TODO: Treat context-depedendent names specially
+ # https://www.w3.org/TR/WGSL/#context-dependent-name
+
+ # Identifiers
+ (ident_pattern_token, Name),
+
+ # TODO: templates start and end tokens.
+ # https://www.w3.org/TR/WGSL/#template-lists-sec
+ ],
+ 'block_comment': [
+ # https://www.w3.org/TR/WGSL/#block-comment
+ (r'[^*/]+', Comment.Multiline),
+ (r'/\*', Comment.Multiline, '#push'),
+ (r'\*/', Comment.Multiline, '#pop'),
+ (r'[*/]', Comment.Multiline),
+ ],
+ }
diff --git a/tests/snippets/wgsl/address-space.txt b/tests/snippets/wgsl/address-space.txt
new file mode 100644
index 00000000..9d7414bb
--- /dev/null
+++ b/tests/snippets/wgsl/address-space.txt
@@ -0,0 +1,72 @@
+---input---
+alias a=ptr<function,i32>;
+alias b=ptr<private,i32>;
+alias c=ptr<workgroup,i32>;
+alias d=ptr<uniform,i32>;
+alias e=ptr<storage,i32>;
+
+---tokens---
+'alias' Keyword
+' ' Text.Whitespace
+'a' Name
+'=' Operator
+'ptr' Name.Builtin
+'<' Operator
+'function' Name.Builtin
+',' Punctuation
+'i32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'b' Name
+'=' Operator
+'ptr' Name.Builtin
+'<' Operator
+'private' Name.Builtin
+',' Punctuation
+'i32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'c' Name
+'=' Operator
+'ptr' Name.Builtin
+'<' Operator
+'workgroup' Name.Builtin
+',' Punctuation
+'i32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'d' Name
+'=' Operator
+'ptr' Name.Builtin
+'<' Operator
+'uniform' Name.Builtin
+',' Punctuation
+'i32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'e' Name
+'=' Operator
+'ptr' Name.Builtin
+'<' Operator
+'storage' Name.Builtin
+',' Punctuation
+'i32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
diff --git a/tests/snippets/wgsl/attribute.txt b/tests/snippets/wgsl/attribute.txt
new file mode 100644
index 00000000..417c9bf6
--- /dev/null
+++ b/tests/snippets/wgsl/attribute.txt
@@ -0,0 +1,87 @@
+---input---
+@id(0) override x:i32 = 1;
+@ id(1) override y:i32 = 2;
+@//comment
+id(1) override z:i32 = 3;
+@must_use fn foo() -> i32 { return 32; }
+
+---tokens---
+'@' Name.Decorator
+'id' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'override' Keyword.Declaration
+' ' Text.Whitespace
+'x' Name
+':' Punctuation
+'i32' Name.Builtin
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1' Literal.Number.Integer
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+' ' Text.Whitespace
+'id' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'override' Keyword.Declaration
+' ' Text.Whitespace
+'y' Name
+':' Punctuation
+'i32' Name.Builtin
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'2' Literal.Number.Integer
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'//comment\n' Comment.Single
+
+'id' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'override' Keyword.Declaration
+' ' Text.Whitespace
+'z' Name
+':' Punctuation
+'i32' Name.Builtin
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'3' Literal.Number.Integer
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'must_use' Name.Decorator
+' ' Text.Whitespace
+'fn' Keyword
+' ' Text.Whitespace
+'foo' Name
+'(' Punctuation
+')' Punctuation
+' ' Text.Whitespace
+'->' Punctuation
+' ' Text.Whitespace
+'i32' Name.Builtin
+' ' Text.Whitespace
+'{' Punctuation
+' ' Text.Whitespace
+'return' Keyword
+' ' Text.Whitespace
+'32' Literal.Number.Integer
+';' Punctuation
+' ' Text.Whitespace
+'}' Punctuation
+'\n' Text.Whitespace
diff --git a/tests/snippets/wgsl/block-comment.txt b/tests/snippets/wgsl/block-comment.txt
new file mode 100644
index 00000000..021d4501
--- /dev/null
+++ b/tests/snippets/wgsl/block-comment.txt
@@ -0,0 +1,34 @@
+---input---
+ /**/
+ /*block with newline
+ */
+ /*block with line
+ ending comment// */
+ /* nested /*
+ */
+ */
+
+---tokens---
+' ' Text.Whitespace
+'/*' Comment.Multiline
+'*/' Comment.Multiline
+'\n ' Text.Whitespace
+'/*' Comment.Multiline
+'block with newline\n ' Comment.Multiline
+'*/' Comment.Multiline
+'\n ' Text.Whitespace
+'/*' Comment.Multiline
+'block with line\n ending comment' Comment.Multiline
+'/' Comment.Multiline
+'/' Comment.Multiline
+' ' Comment.Multiline
+'*/' Comment.Multiline
+'\n ' Text.Whitespace
+'/*' Comment.Multiline
+' nested ' Comment.Multiline
+'/*' Comment.Multiline
+'\n ' Comment.Multiline
+'*/' Comment.Multiline
+'\n ' Comment.Multiline
+'*/' Comment.Multiline
+'\n' Text.Whitespace
diff --git a/tests/snippets/wgsl/bool-types.txt b/tests/snippets/wgsl/bool-types.txt
new file mode 100644
index 00000000..7b4a443f
--- /dev/null
+++ b/tests/snippets/wgsl/bool-types.txt
@@ -0,0 +1,47 @@
+---input---
+alias boolean=bool;
+alias bvec2=vec2<bool>;
+alias bvec3=vec3<bool>;
+alias bvec4=vec4<bool>;
+
+---tokens---
+'alias' Keyword
+' ' Text.Whitespace
+'boolean' Name
+'=' Operator
+'bool' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'bvec2' Name
+'=' Operator
+'vec2' Name.Builtin
+'<' Operator
+'bool' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'bvec3' Name
+'=' Operator
+'vec3' Name.Builtin
+'<' Operator
+'bool' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'bvec4' Name
+'=' Operator
+'vec4' Name.Builtin
+'<' Operator
+'bool' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
diff --git a/tests/snippets/wgsl/const-numbers.txt b/tests/snippets/wgsl/const-numbers.txt
new file mode 100644
index 00000000..fdfa881c
--- /dev/null
+++ b/tests/snippets/wgsl/const-numbers.txt
@@ -0,0 +1,549 @@
+---input---
+const a = 0;
+const au = 0u;
+const ai = 0i;
+const b = 12345;
+const bu = 12345u;
+const bi= 12345i;
+const c = 0x0;
+const cu = 0x0u;
+const ci = 0x0i;
+const d = 0x12345;
+const di = 0x12345i;
+const du = 0x12345u;
+const eh = 0h;
+const ef = 0f;
+const f = 1.;
+const fh = 1.h;
+const ff = 1.f;
+const g = .1;
+const gh = .1h;
+const gf = .1f;
+const g = 1e1;
+const gh = 1e1h;
+const gf = 1e1f;
+const h = 1e+1;
+const hh = 1e+1h;
+const hf = 1e+1f;
+const i = 1e-1;
+const ih = 1e-1h;
+const if = 1e-1f;
+const j = 1.0e+1;
+const jh = 1.0e+1h;
+const jf= 1.0e+1f;
+const k = 1.0e-1;
+const kh = 1.0e-1h;
+const kf= 1.0e-1f;
+const l = 0x1p1;
+const lh = 0x1p1h;
+const lf = 0x1p1f;
+const m = 0x1p+1;
+const mh = 0x1p+1h;
+const mf = 0x1p+1f;
+const n = 0x1p-1;
+const nh = 0x1p-1h;
+const nf = 0x1p-1f;
+const o = 0x1.p1;
+const oh = 0x1.p1h;
+const of = 0x1.p1f;
+const p = 0x.1p1;
+const ph = 0x.1p1h;
+const pf = 0x.1p1f;
+
+---tokens---
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'a' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0' Literal.Number.Integer
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'au' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0u' Literal.Number.Integer
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'ai' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0i' Literal.Number.Integer
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'b' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'12345' Literal.Number.Integer
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'bu' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'12345u' Literal.Number.Integer
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'bi' Name
+'=' Operator
+' ' Text.Whitespace
+'12345i' Literal.Number.Integer
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'c' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x0' Literal.Number.Hex
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'cu' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x0u' Literal.Number.Hex
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'ci' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x0i' Literal.Number.Hex
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'d' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x12345' Literal.Number.Hex
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'di' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x12345i' Literal.Number.Hex
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'du' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x12345u' Literal.Number.Hex
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'eh' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0h' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'ef' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0f' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'f' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1.' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'fh' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1.h' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'ff' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1.f' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'g' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'.1' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'gh' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'.1h' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'gf' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'.1f' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'g' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1e1' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'gh' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1e1h' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'gf' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1e1f' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'h' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1e+1' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'hh' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1e+1h' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'hf' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1e+1f' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'i' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1e-1' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'ih' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1e-1h' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'if' Keyword
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1e-1f' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'j' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1.0e+1' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'jh' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1.0e+1h' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'jf' Name
+'=' Operator
+' ' Text.Whitespace
+'1.0e+1f' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'k' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1.0e-1' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'kh' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'1.0e-1h' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'kf' Name
+'=' Operator
+' ' Text.Whitespace
+'1.0e-1f' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'l' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x1p1' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'lh' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x1p1h' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'lf' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x1p1f' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'m' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x1p+1' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'mh' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x1p+1h' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'mf' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x1p+1f' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'n' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x1p-1' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'nh' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x1p-1h' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'nf' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x1p-1f' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'o' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x1.p1' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'oh' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x1.p1h' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'of' Keyword.Reserved
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x1.p1f' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'p' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x.1p1' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'ph' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x.1p1h' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
+
+'const' Keyword.Declaration
+' ' Text.Whitespace
+'pf' Name
+' ' Text.Whitespace
+'=' Operator
+' ' Text.Whitespace
+'0x.1p1f' Literal.Number.Float
+';' Punctuation
+'\n' Text.Whitespace
diff --git a/tests/snippets/wgsl/depth-texture.txt b/tests/snippets/wgsl/depth-texture.txt
new file mode 100644
index 00000000..c93e9c7d
--- /dev/null
+++ b/tests/snippets/wgsl/depth-texture.txt
@@ -0,0 +1,97 @@
+---input---
+@group(0) @binding(1) var texture_depth_2d;
+@group(0) @binding(2) var texture_depth_2d_array;
+@group(0) @binding(4) var texture_depth_cube;
+@group(0) @binding(5) var texture_depth_cube_array;
+@group(0) @binding(5) var texture_depth_multisampled_2d;
+
+---tokens---
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_depth_2d' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'2' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_depth_2d_array' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'4' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_depth_cube' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'5' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_depth_cube_array' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'5' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_depth_multisampled_2d' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
diff --git a/tests/snippets/wgsl/external-texture.txt b/tests/snippets/wgsl/external-texture.txt
new file mode 100644
index 00000000..41f30b59
--- /dev/null
+++ b/tests/snippets/wgsl/external-texture.txt
@@ -0,0 +1,21 @@
+---input---
+@group(0) @binding(5) var texture_external;
+
+---tokens---
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'5' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_external' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
diff --git a/tests/snippets/wgsl/line-comment.txt b/tests/snippets/wgsl/line-comment.txt
new file mode 100644
index 00000000..72a535ff
--- /dev/null
+++ b/tests/snippets/wgsl/line-comment.txt
@@ -0,0 +1,13 @@
+---input---
+ // this is a line-ending comment
+ //* embed a bock comment start, after a space
+// /* embed a bock comment start, v2
+
+---tokens---
+' ' Text.Whitespace
+'// this is a line-ending comment\n' Comment.Single
+
+' ' Text.Whitespace
+'//* embed a bock comment start, after a space\n' Comment.Single
+
+'// /* embed a bock comment start, v2\n' Comment.Single
diff --git a/tests/snippets/wgsl/multisampled-texture.txt b/tests/snippets/wgsl/multisampled-texture.txt
new file mode 100644
index 00000000..a94fe1f0
--- /dev/null
+++ b/tests/snippets/wgsl/multisampled-texture.txt
@@ -0,0 +1,24 @@
+---input---
+@group(0) @binding(5) var texture_multisampled_2d<f32>;
+
+---tokens---
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'5' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_multisampled_2d' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
diff --git a/tests/snippets/wgsl/numeric-types.txt b/tests/snippets/wgsl/numeric-types.txt
new file mode 100644
index 00000000..21743649
--- /dev/null
+++ b/tests/snippets/wgsl/numeric-types.txt
@@ -0,0 +1,642 @@
+---input---
+enable f16;
+alias int=i32;
+alias uint=u32;
+alias float=f32;
+alias half=f16;
+alias ivec2=vec2i;
+alias uvec2=vec2u;
+alias vec2=vec2f;
+alias ivec3=vec3i;
+alias uvec3=vec3u;
+alias vec3=vec3f;
+alias ivec4=vec4i;
+alias uvec4=vec4u;
+alias ivec2_=vec2<i32>;
+alias uvec2_=vec2<u32>;
+alias vec2_=vec2<f32>;
+alias ivec3_=vec3<i32>;
+alias uvec3_=vec3<u32>;
+alias vec3_=vec3<f32>;
+alias ivec4_=vec4<i32>;
+alias uvec4_=vec4<u32>;
+alias vec4_=vec4<f32>;
+alias hvec2=vec2h;
+alias hvec3=vec3h;
+alias hvec4=vec4h;
+alias hvec4_=vec4<f16>;
+alias m22=mat2x2f;
+alias m23=mat2x3f;
+alias m24=mat2x4f;
+alias m32=mat3x2f;
+alias m33=mat3x3f;
+alias m34=mat3x4f;
+alias m42=mat4x2f;
+alias m43=mat4x3f;
+alias m44=mat4x4f;
+alias m22_=mat2x2<f32>;
+alias m23_=mat2x3<f32>;
+alias m24_=mat2x4<f32>;
+alias m32_=mat3x2<f32>;
+alias m33_=mat3x3<f32>;
+alias m34_=mat3x4<f32>;
+alias m42_=mat4x2<f32>;
+alias m43_=mat4x3<f32>;
+alias m44_=mat4x4<f32>;
+alias m22=mat2x2h;
+alias m23=mat2x3h;
+alias h24=mat2x4h;
+alias h32=mat3x2h;
+alias h33=mat3x3h;
+alias h34=mat3x4h;
+alias h42=mat4x2h;
+alias h43=mat4x3h;
+alias h44=mat4x4h;
+alias h22_=mat2x2<f16>;
+alias h23_=mat2x3<f16>;
+alias h24_=mat2x4<f16>;
+alias h32_=mat3x2<f16>;
+alias h33_=mat3x3<f16>;
+alias h34_=mat3x4<f16>;
+alias h42_=mat4x2<f16>;
+alias h43_=mat4x3<f16>;
+alias h44_=mat4x4<f16>;
+
+---tokens---
+'enable' Keyword
+' ' Text.Whitespace
+'f16' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'int' Name
+'=' Operator
+'i32' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'uint' Name
+'=' Operator
+'u32' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'float' Name
+'=' Operator
+'f32' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'half' Name
+'=' Operator
+'f16' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'ivec2' Name
+'=' Operator
+'vec2i' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'uvec2' Name
+'=' Operator
+'vec2u' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'vec2' Name.Builtin
+'=' Operator
+'vec2f' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'ivec3' Name
+'=' Operator
+'vec3i' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'uvec3' Name
+'=' Operator
+'vec3u' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'vec3' Name.Builtin
+'=' Operator
+'vec3f' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'ivec4' Name
+'=' Operator
+'vec4i' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'uvec4' Name
+'=' Operator
+'vec4u' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'ivec2_' Name
+'=' Operator
+'vec2' Name.Builtin
+'<' Operator
+'i32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'uvec2_' Name
+'=' Operator
+'vec2' Name.Builtin
+'<' Operator
+'u32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'vec2_' Name
+'=' Operator
+'vec2' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'ivec3_' Name
+'=' Operator
+'vec3' Name.Builtin
+'<' Operator
+'i32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'uvec3_' Name
+'=' Operator
+'vec3' Name.Builtin
+'<' Operator
+'u32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'vec3_' Name
+'=' Operator
+'vec3' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'ivec4_' Name
+'=' Operator
+'vec4' Name.Builtin
+'<' Operator
+'i32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'uvec4_' Name
+'=' Operator
+'vec4' Name.Builtin
+'<' Operator
+'u32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'vec4_' Name
+'=' Operator
+'vec4' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'hvec2' Name
+'=' Operator
+'vec2h' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'hvec3' Name
+'=' Operator
+'vec3h' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'hvec4' Name
+'=' Operator
+'vec4h' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'hvec4_' Name
+'=' Operator
+'vec4' Name.Builtin
+'<' Operator
+'f16' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m22' Name
+'=' Operator
+'mat2x2f' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m23' Name
+'=' Operator
+'mat2x3f' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m24' Name
+'=' Operator
+'mat2x4f' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m32' Name
+'=' Operator
+'mat3x2f' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m33' Name
+'=' Operator
+'mat3x3f' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m34' Name
+'=' Operator
+'mat3x4f' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m42' Name
+'=' Operator
+'mat4x2f' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m43' Name
+'=' Operator
+'mat4x3f' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m44' Name
+'=' Operator
+'mat4x4f' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m22_' Name
+'=' Operator
+'mat2x2' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m23_' Name
+'=' Operator
+'mat2x3' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m24_' Name
+'=' Operator
+'mat2x4' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m32_' Name
+'=' Operator
+'mat3x2' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m33_' Name
+'=' Operator
+'mat3x3' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m34_' Name
+'=' Operator
+'mat3x4' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m42_' Name
+'=' Operator
+'mat4x2' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m43_' Name
+'=' Operator
+'mat4x3' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m44_' Name
+'=' Operator
+'mat4x4' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m22' Name
+'=' Operator
+'mat2x2h' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'m23' Name
+'=' Operator
+'mat2x3h' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h24' Name
+'=' Operator
+'mat2x4h' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h32' Name
+'=' Operator
+'mat3x2h' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h33' Name
+'=' Operator
+'mat3x3h' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h34' Name
+'=' Operator
+'mat3x4h' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h42' Name
+'=' Operator
+'mat4x2h' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h43' Name
+'=' Operator
+'mat4x3h' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h44' Name
+'=' Operator
+'mat4x4h' Name.Builtin
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h22_' Name
+'=' Operator
+'mat2x2' Name.Builtin
+'<' Operator
+'f16' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h23_' Name
+'=' Operator
+'mat2x3' Name.Builtin
+'<' Operator
+'f16' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h24_' Name
+'=' Operator
+'mat2x4' Name.Builtin
+'<' Operator
+'f16' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h32_' Name
+'=' Operator
+'mat3x2' Name.Builtin
+'<' Operator
+'f16' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h33_' Name
+'=' Operator
+'mat3x3' Name.Builtin
+'<' Operator
+'f16' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h34_' Name
+'=' Operator
+'mat3x4' Name.Builtin
+'<' Operator
+'f16' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h42_' Name
+'=' Operator
+'mat4x2' Name.Builtin
+'<' Operator
+'f16' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h43_' Name
+'=' Operator
+'mat4x3' Name.Builtin
+'<' Operator
+'f16' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'h44_' Name
+'=' Operator
+'mat4x4' Name.Builtin
+'<' Operator
+'f16' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
diff --git a/tests/snippets/wgsl/sampled-texture.txt b/tests/snippets/wgsl/sampled-texture.txt
new file mode 100644
index 00000000..4b200716
--- /dev/null
+++ b/tests/snippets/wgsl/sampled-texture.txt
@@ -0,0 +1,134 @@
+---input---
+@group(0) @binding(0) var texture_1d<f32>;
+@group(0) @binding(1) var texture_2d<f32>;
+@group(0) @binding(2) var texture_2d_array<f32>;
+@group(0) @binding(3) var texture_3d<f32>;
+@group(0) @binding(4) var texture_cube<f32>;
+@group(0) @binding(5) var texture_cube_array<f32>;
+
+---tokens---
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_1d' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_2d' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'2' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_2d_array' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'3' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_3d' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'4' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_cube' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'5' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_cube_array' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
diff --git a/tests/snippets/wgsl/storage-texture.txt b/tests/snippets/wgsl/storage-texture.txt
new file mode 100644
index 00000000..0b66cb5c
--- /dev/null
+++ b/tests/snippets/wgsl/storage-texture.txt
@@ -0,0 +1,98 @@
+---input---
+@group(0) @binding(0) var texture_storage_1d<rgba8unorm,write>;
+@group(0) @binding(1) var texture_storage_2d<rgba8unorm,write>;
+@group(0) @binding(2) var texture_storage_2d_array<rgba8unorm,write>;
+@group(0) @binding(3) var texture_storage_3d<rgba8unorm,write>;
+
+---tokens---
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_1d' Name.Builtin
+'<' Operator
+'rgba8unorm' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rgba8unorm' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'2' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d_array' Name.Builtin
+'<' Operator
+'rgba8unorm' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'3' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_3d' Name.Builtin
+'<' Operator
+'rgba8unorm' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
diff --git a/tests/snippets/wgsl/texel-formats.txt b/tests/snippets/wgsl/texel-formats.txt
new file mode 100644
index 00000000..127b92eb
--- /dev/null
+++ b/tests/snippets/wgsl/texel-formats.txt
@@ -0,0 +1,410 @@
+---input---
+@group(0) @binding(0) var texture_storage_2d<rgba8unorm,write>;
+@group(0) @binding(1) var texture_storage_2d<rgba8snorm,write>;
+@group(0) @binding(2) var texture_storage_2d<rgba8uint,write>;
+@group(0) @binding(3) var texture_storage_2d<rgba8sint,write>;
+@group(0) @binding(4) var texture_storage_2d<rgba16uint,write>;
+@group(0) @binding(5) var texture_storage_2d<rgba16sint,write>;
+@group(0) @binding(6) var texture_storage_2d<rgba16float,write>;
+@group(0) @binding(7) var texture_storage_2d<r32uint,write>;
+@group(0) @binding(8) var texture_storage_2d<r32sint,write>;
+@group(0) @binding(9) var texture_storage_2d<r32float,write>;
+@group(1) @binding(0) var texture_storage_2d<rg32uint,write>;
+@group(1) @binding(1) var texture_storage_2d<rg32sint,write>;
+@group(1) @binding(2) var texture_storage_2d<rg32float,write>;
+@group(1) @binding(3) var texture_storage_2d<rgba32uint,write>;
+@group(1) @binding(4) var texture_storage_2d<rgba32sint,write>;
+@group(1) @binding(5) var texture_storage_2d<rgba32float,write>;
+@group(1) @binding(6) var texture_storage_2d<bgra8unorm,write>;
+
+---tokens---
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rgba8unorm' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rgba8snorm' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'2' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rgba8uint' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'3' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rgba8sint' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'4' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rgba16uint' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'5' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rgba16sint' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'6' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rgba16float' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'7' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'r32uint' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'8' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'r32sint' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'9' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'r32float' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rg32uint' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rg32sint' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'2' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rg32float' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'3' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rgba32uint' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'4' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rgba32sint' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'5' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'rgba32float' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'@' Name.Decorator
+'group' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'binding' Name.Decorator
+'(' Punctuation
+'6' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'texture_storage_2d' Name.Builtin
+'<' Operator
+'bgra8unorm' Name.Builtin
+',' Punctuation
+'write' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
diff --git a/tests/snippets/wgsl/tiny-render.txt b/tests/snippets/wgsl/tiny-render.txt
new file mode 100644
index 00000000..9d0fb2f8
--- /dev/null
+++ b/tests/snippets/wgsl/tiny-render.txt
@@ -0,0 +1,105 @@
+---input---
+@vertex
+fn vmain(@location(0) v: vec4<f32>) -> @builtin(position) vec4f {
+ return v;
+}
+
+@fragment
+fn fmain(@builtin(position) pos: vec4f) -> @location(0) vec4f {
+ return vec4f(0.25,0.25,1.0,1.0);
+}
+
+---tokens---
+'@' Name.Decorator
+'vertex' Name.Decorator
+'\n' Text.Whitespace
+
+'fn' Keyword
+' ' Text.Whitespace
+'vmain' Name
+'(' Punctuation
+'@' Name.Decorator
+'location' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'v' Name
+':' Punctuation
+' ' Text.Whitespace
+'vec4' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+')' Punctuation
+' ' Text.Whitespace
+'->' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'builtin' Name.Decorator
+'(' Punctuation
+'position' Name.Builtin
+')' Punctuation
+' ' Text.Whitespace
+'vec4f' Name.Builtin
+' ' Text.Whitespace
+'{' Punctuation
+'\n ' Text.Whitespace
+'return' Keyword
+' ' Text.Whitespace
+'v' Name
+';' Punctuation
+'\n' Text.Whitespace
+
+'}' Punctuation
+'\n\n' Text.Whitespace
+
+'@' Name.Decorator
+'fragment' Name.Decorator
+'\n' Text.Whitespace
+
+'fn' Keyword
+' ' Text.Whitespace
+'fmain' Name
+'(' Punctuation
+'@' Name.Decorator
+'builtin' Name.Decorator
+'(' Punctuation
+'position' Name.Builtin
+')' Punctuation
+' ' Text.Whitespace
+'pos' Name
+':' Punctuation
+' ' Text.Whitespace
+'vec4f' Name.Builtin
+')' Punctuation
+' ' Text.Whitespace
+'->' Punctuation
+' ' Text.Whitespace
+'@' Name.Decorator
+'location' Name.Decorator
+'(' Punctuation
+'0' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'vec4f' Name.Builtin
+' ' Text.Whitespace
+'{' Punctuation
+'\n ' Text.Whitespace
+'return' Keyword
+' ' Text.Whitespace
+'vec4f' Name.Builtin
+'(' Punctuation
+'0.25' Literal.Number.Float
+',' Punctuation
+'0.25' Literal.Number.Float
+',' Punctuation
+'1.0' Literal.Number.Float
+',' Punctuation
+'1.0' Literal.Number.Float
+')' Punctuation
+';' Punctuation
+'\n' Text.Whitespace
+
+'}' Punctuation
+'\n' Text.Whitespace
diff --git a/tests/snippets/wgsl/type-generators.txt b/tests/snippets/wgsl/type-generators.txt
new file mode 100644
index 00000000..afbb6dbe
--- /dev/null
+++ b/tests/snippets/wgsl/type-generators.txt
@@ -0,0 +1,43 @@
+---input---
+// Test predeclared type generators, other than vector, matrix, and texture.
+alias a=array<f32>;
+alias b=atomic<i32>;
+alias c=ptr<function,i32>;
+
+---tokens---
+'// Test predeclared type generators, other than vector, matrix, and texture.\n' Comment.Single
+
+'alias' Keyword
+' ' Text.Whitespace
+'a' Name
+'=' Operator
+'array' Name.Builtin
+'<' Operator
+'f32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'b' Name
+'=' Operator
+'atomic' Name.Builtin
+'<' Operator
+'i32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace
+
+'alias' Keyword
+' ' Text.Whitespace
+'c' Name
+'=' Operator
+'ptr' Name.Builtin
+'<' Operator
+'function' Name.Builtin
+',' Punctuation
+'i32' Name.Builtin
+'>' Operator
+';' Punctuation
+'\n' Text.Whitespace