This repository has been archived on 2024-06-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
coffee.pygments/tests/snippets/wgsl/attribute.txt
David Neto 5175d68c87
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
2023-03-30 11:09:02 +02:00

87 lines
2.2 KiB
Text

---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