-
-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add WebGPU Shading Language lexer (#776)
https://w3.org/TR/WGSL Generated from the Pygments lexer I wrote, in pygments/pygments#2386
- Loading branch information
Showing
11 changed files
with
759 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@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; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
[ | ||
{"type":"NameDecorator","value":"@id"}, | ||
{"type":"Punctuation","value":"("}, | ||
{"type":"LiteralNumberInteger","value":"0"}, | ||
{"type":"Punctuation","value":")"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"KeywordDeclaration","value":"override"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Name","value":"x"}, | ||
{"type":"Punctuation","value":":"}, | ||
{"type":"NameBuiltin","value":"i32"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"LiteralNumberInteger","value":"1"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"TextWhitespace","value":"\n"}, | ||
{"type":"NameDecorator","value":"@"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"NameDecorator","value":"id"}, | ||
{"type":"Punctuation","value":"("}, | ||
{"type":"LiteralNumberInteger","value":"1"}, | ||
{"type":"Punctuation","value":")"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"KeywordDeclaration","value":"override"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Name","value":"y"}, | ||
{"type":"Punctuation","value":":"}, | ||
{"type":"NameBuiltin","value":"i32"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"LiteralNumberInteger","value":"2"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"TextWhitespace","value":"\n"}, | ||
{"type":"NameDecorator","value":"@"}, | ||
{"type":"CommentSingle","value":"//comment\n"}, | ||
{"type":"NameDecorator","value":"id"}, | ||
{"type":"Punctuation","value":"("}, | ||
{"type":"LiteralNumberInteger","value":"1"}, | ||
{"type":"Punctuation","value":")"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"KeywordDeclaration","value":"override"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Name","value":"z"}, | ||
{"type":"Punctuation","value":":"}, | ||
{"type":"NameBuiltin","value":"i32"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"LiteralNumberInteger","value":"3"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"TextWhitespace","value":"\n"}, | ||
{"type":"NameDecorator","value":"@must_use"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Keyword","value":"fn"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Name","value":"foo"}, | ||
{"type":"Punctuation","value":"()"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Punctuation","value":"-\u003e"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"NameBuiltin","value":"i32"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Punctuation","value":"{"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Keyword","value":"return"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"LiteralNumberInteger","value":"32"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Punctuation","value":"}"}, | ||
{"type":"TextWhitespace","value":"\n"} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/**/ | ||
/*block with newline | ||
*/ | ||
/*block with line | ||
ending comment// */ | ||
/* nested /* | ||
*/ | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[ | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"CommentMultiline","value":"/**/"}, | ||
{"type":"TextWhitespace","value":"\n "}, | ||
{"type":"CommentMultiline","value":"/*block with newline\n */"}, | ||
{"type":"TextWhitespace","value":"\n "}, | ||
{"type":"CommentMultiline","value":"/*block with line\n ending comment// */"}, | ||
{"type":"TextWhitespace","value":"\n "}, | ||
{"type":"CommentMultiline","value":"/* nested /*\n */\n */"}, | ||
{"type":"TextWhitespace","value":"\n"} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
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; |
Oops, something went wrong.