From c0c8166280208eec6a9b13431e8c1fc940fdea71 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Sun, 15 May 2022 21:03:12 +0200 Subject: [PATCH 01/31] Added files for language WGSL --- components.json | 4 + components/prism-wgsl.js | 94 ++++++++++++++++++++ examples/prism-wgsl.html | 60 +++++++++++++ tests/languages/wgsl/comment_feature.test | 15 ++++ tests/languages/wgsl/function_feature.test | 21 +++++ tests/languages/wgsl/keyword_feature.test | 71 ++++++++++++++++ tests/languages/wgsl/literal_feature.test | 53 ++++++++++++ tests/languages/wgsl/type_feature.test | 99 ++++++++++++++++++++++ 8 files changed, 417 insertions(+) create mode 100644 components/prism-wgsl.js create mode 100644 examples/prism-wgsl.html create mode 100644 tests/languages/wgsl/comment_feature.test create mode 100644 tests/languages/wgsl/function_feature.test create mode 100644 tests/languages/wgsl/keyword_feature.test create mode 100644 tests/languages/wgsl/literal_feature.test create mode 100644 tests/languages/wgsl/type_feature.test diff --git a/components.json b/components.json index 2be443c4d8..4e5f83d8ce 100644 --- a/components.json +++ b/components.json @@ -1523,6 +1523,10 @@ "alias": "webidl", "owner": "RunDevelopment" }, + "wgsl": { + "title": "WGSL", + "owner": "Dr4gonthree" + }, "wiki": { "title": "Wiki markup", "require": "markup", diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js new file mode 100644 index 0000000000..9191dff9f3 --- /dev/null +++ b/components/prism-wgsl.js @@ -0,0 +1,94 @@ +Prism.languages.wgsl = { + 'comment': { + pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/, + greedy: true, + }, + 'attributes': { + pattern: /(@)(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))/u, + lookbehind: true, + alias: 'symbol', + }, + 'functions': { + pattern: /\b(fn)\s+(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))(?=(?:\()|(?:<))/u, + lookbehind: true, + alias: 'function', + inside: {}, + }, + 'keyword': [ + { pattern: /\b(?:bitcast|block|break|case|continue|continuing|default|discard|else|elseif|enable|fallthrough|for|function|if|loop|private|read|read_write|return|storage|switch|uniform|workgroup|write)\b/ }, + { pattern: /\b(?:asm|const|do|enum|handle|mat|premerge|regardless|typedef|unless|using|vec|void|while)\b/ }, + { pattern: /\b(?:let|var)\b/ }, + { pattern: /\b(?:type)\b/ }, + { pattern: /\b(?:enum)\b/ }, + { pattern: /\bfn\b/ }, + ], + 'function-calls': { + pattern: /(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))(?=\()/u, + alias: 'function', + inside: {}, + }, + 'types': [ + { pattern: /\b(?:bool|i32|u32|f32)\b/, alias: 'builtin' }, + { pattern: /\b(?:i64|u64|f64)\b/, alias: 'builtin' }, + { pattern: /\b(?:vec[2-4]|mat[2-4]x[2-4])\b/, alias: 'builtin' }, + { pattern: /\b(?:atomic)\b/, alias: 'builtin' }, + { pattern: /\b(?:array)\b/, alias: 'builtin' }, + { pattern: /\b(?:override|ptr|sampler|sampler_comparison|staticAssert|struct)\b/, alias: 'builtin' }, + { pattern: /\b(?:texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array|texture_multisampled_2d)\b/, alias: 'builtin' }, + { pattern: /\b(?:texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d|texture_depth_2d)\b/, alias: 'builtin' }, + { pattern: /\b(?:texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/, alias: 'builtin' }, + { pattern: /\b(?:[A-Z][A-Za-z0-9]*)\b/, alias: 'class-name' }, + ], + 'built-in-values': [ + { pattern: /\b(?:vertex_index|instance_index|position)\b/, alias: 'namespace' }, + { pattern: /\b(?:front_facing|frag_depth|sample_index|sample_mask)\b/, alias: 'namespace' }, + { pattern: /\b(?:local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/, alias: 'namespace' }, + ], + 'bool-literal': { + pattern: /\b(?:true|false)\b/, + alias: 'boolean', + }, + 'hex-int-literal': [ + { pattern: /\b0[xX][0-9a-fA-F]+[iu]?(?!(?:\.|p|P))\b/, alias:'number' }, + ], + 'hex-float-literal': [ + { pattern: /0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+(?:[pP](?:\+|-)?[0-9]+[fh]?)?/, alias:'number' }, + { pattern: /0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*(?:[pP](?:\+|-)?[0-9]+[fh]?)?/, alias:'number' }, + { pattern: /0[xX][0-9a-fA-F]+[pP](?:\+|-)?[0-9]+[fh]?/, alias:'number' }, + ], + 'decimal-float-literal-a': [ + { pattern: /[0-9]*\.[0-9]+(?:[eE](?:\+|-)?[0-9]+)?[fh]?/, alias:'number' }, + { pattern: /[0-9]+\.[0-9]*(?:[eE](?:\+|-)?[0-9]+)?[fh]?/, alias:'number' }, + { pattern: /[0-9]+[eE](?:\+|-)?[0-9]+[fh]?/, alias:'number' }, + ], + 'variables': { + pattern: /\b(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))\b/u, + alias: 'variable', + }, + 'decimal-float-literal-b': [ + { pattern: /0[fh]/, alias:'number' }, + { pattern: /[1-9][0-9]*[fh]/, alias:'number' }, + ], + 'int-literal': [ + { pattern: /0[iu]?/, alias:'number' }, + { pattern: /[1-9][0-9]*[iu]?/, alias:'number' }, + ], + 'operator': [ + { pattern: /(?:\^|~|\||\|\||&&|<<|>>|!)(?!=)/ }, + { pattern: /&(?![&=])/ }, + { pattern: /(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/}, + { pattern: /(?])=(?!=|>)/ }, + { pattern: /(?:=(?:=)?(?!>)|!=|<=|(?=)/ }, + { pattern: /(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/ }, + { pattern: /\.(?!\.)/ }, + { pattern: /->/ }, + ], + 'punctuation': [ + { pattern: /,/ }, + { pattern: /[{}]/ }, + { pattern: /[\(\)]/ }, + { pattern: /;/ }, + { pattern: /[\[\]]/ }, + { pattern: /(?]/ }, + ], +}; diff --git a/examples/prism-wgsl.html b/examples/prism-wgsl.html new file mode 100644 index 0000000000..16626c0e8c --- /dev/null +++ b/examples/prism-wgsl.html @@ -0,0 +1,60 @@ +

Full example

+
// Vertex shader
+struct CameraUniform {
+    view_proj: mat4x4<f32>;
+};
+[[group(1), binding(0)]]
+var<uniform> camera: CameraUniform;
+
+struct InstanceInput {
+    [[location(5)]] model_matrix_0: vec4<f32>;
+    [[location(6)]] model_matrix_1: vec4<f32>;
+    [[location(7)]] model_matrix_2: vec4<f32>;
+    [[location(8)]] model_matrix_3: vec4<f32>;
+};
+
+struct VertexInput {
+    [[location(0)]] position: vec3<f32>; 
+    [[location(1)]] tex_coords: vec2<f32>;
+};
+
+struct VertexOutput {
+    [[builtin(position)]] clip_position: vec4<f32>;
+    [[location(0)]] tex_coords: vec2<f32>;
+};
+
+@vertex
+[[stage(vertex)]]
+fn vs_main(
+    model: VertexInput,
+    instance: InstanceInput,
+) -> VertexOutput {
+    let model_matrix = mat4x4<f32>(
+        instance.model_matrix_0,
+        instance.model_matrix_1,
+        instance.model_matrix_2,
+        instance.model_matrix_3,
+    );
+
+    bool mybool1 = true;
+    bool mybool2 = false;
+
+    var out: VertexOutput;
+    out.tex_coords = model.tex_coords;
+    out.clip_position = camera.view_proj * model_matrix * vec4<f32>(model.position, 1.0);
+    return out;
+}
+
+// Fragment shader
+
+[[group(0), binding(0)]]
+var t_diffuse: texture_2d<f32>;
+[[group(0), binding(1)]]
+var s_diffuse: sampler;
+
+@fragment
+[[stage(fragment)]]
+fn fs_main(in: VertexOutput) -> [[location(0)]] vec4<f32> {
+    return textureSample(t_diffuse, s_diffuse, in.tex_coords);
+}
+
\ No newline at end of file diff --git a/tests/languages/wgsl/comment_feature.test b/tests/languages/wgsl/comment_feature.test new file mode 100644 index 0000000000..55c2923e3d --- /dev/null +++ b/tests/languages/wgsl/comment_feature.test @@ -0,0 +1,15 @@ +//test +// test + +/* multi + line + comment */ + +---------------------------------------------------- + +[ + ["comment", "//test"], + ["comment", "// test"], + + ["comment", "/* multi\r\n line\r\n comment */"] +] diff --git a/tests/languages/wgsl/function_feature.test b/tests/languages/wgsl/function_feature.test new file mode 100644 index 0000000000..0b6ed8af74 --- /dev/null +++ b/tests/languages/wgsl/function_feature.test @@ -0,0 +1,21 @@ +fn my_function() -> bool { + return true; +} + +---------------------------------------------------- + +[ + ["keyword", "fn"], + ["functions", [" my_function"]], + ["punctuation", "("], + ["punctuation", ")"], + ["operator", "->"], + ["types", "bool"], + ["punctuation", "{"], + + ["keyword", "return"], + ["bool-literal", "true"], + ["punctuation", ";"], + + ["punctuation", "}"] +] diff --git a/tests/languages/wgsl/keyword_feature.test b/tests/languages/wgsl/keyword_feature.test new file mode 100644 index 0000000000..cb4f5fa884 --- /dev/null +++ b/tests/languages/wgsl/keyword_feature.test @@ -0,0 +1,71 @@ +bitcast +break +case +continue +continuing +default +discard +else +enable +fallthrough +for +function +if +loop +private +read +read_write +return +storage +switch +uniform +workgroup +write + +const +handle +mat +vec +void +while +let +var +fn + +---------------------------------------------------- + +[ + ["keyword", "bitcast"], + ["keyword", "break"], + ["keyword", "case"], + ["keyword", "continue"], + ["keyword", "continuing"], + ["keyword", "default"], + ["keyword", "discard"], + ["keyword", "else"], + ["keyword", "enable"], + ["keyword", "fallthrough"], + ["keyword", "for"], + ["keyword", "function"], + ["keyword", "if"], + ["keyword", "loop"], + ["keyword", "private"], + ["keyword", "read"], + ["keyword", "read_write"], + ["keyword", "return"], + ["keyword", "storage"], + ["keyword", "switch"], + ["keyword", "uniform"], + ["keyword", "workgroup"], + ["keyword", "write"], + + ["keyword", "const"], + ["keyword", "handle"], + ["keyword", "mat"], + ["keyword", "vec"], + ["keyword", "void"], + ["keyword", "while"], + ["keyword", "let"], + ["keyword", "var"], + ["keyword", "fn"] +] diff --git a/tests/languages/wgsl/literal_feature.test b/tests/languages/wgsl/literal_feature.test new file mode 100644 index 0000000000..d9043d3c3a --- /dev/null +++ b/tests/languages/wgsl/literal_feature.test @@ -0,0 +1,53 @@ +0x123 +0X123u +1u +123 +0 +0i +0x3f + +0.e+4f +01. +.01 +12.34 +.0f +0h +1e-3 +0xa.fp+2 +0x1P+4f +0X.3 +0x3p+2h +0X1.fp-4 +0x3.2p+2h + +true +false + +---------------------------------------------------- + +[ + ["hex-int-literal", "0x123"], + ["hex-int-literal", "0X123u"], + ["int-literal", "1u"], + ["int-literal", "123"], + ["int-literal", "0"], + ["int-literal", "0i"], + ["hex-int-literal", "0x3f"], + + ["decimal-float-literal-a", "0.e+4f"], + ["decimal-float-literal-a", "01."], + ["decimal-float-literal-a", ".01"], + ["decimal-float-literal-a", "12.34"], + ["decimal-float-literal-a", ".0f"], + ["decimal-float-literal-b", "0h"], + ["decimal-float-literal-a", "1e-3"], + ["hex-float-literal", "0xa.fp+2"], + ["hex-float-literal", "0x1P+4f"], + ["hex-float-literal", "0X.3"], + ["hex-float-literal", "0x3p+2h"], + ["hex-float-literal", "0X1.fp-4"], + ["hex-float-literal", "0x3.2p+2h"], + + ["bool-literal", "true"], + ["bool-literal", "false"] +] diff --git a/tests/languages/wgsl/type_feature.test b/tests/languages/wgsl/type_feature.test new file mode 100644 index 0000000000..0ff4fc7aa2 --- /dev/null +++ b/tests/languages/wgsl/type_feature.test @@ -0,0 +1,99 @@ +bool +i32 +u32 +f32 +i64 +u64 +f64 +vec2 +vec3 +vec4 +mat2x2 +mat2x3 +mat2x4 +mat3x2 +mat3x3 +mat3x4 +mat4x2 +mat4x3 +mat4x4 + +atomic +array + +override +ptr + +sampler +sampler_comparison +staticAssert +struct + +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 +texture_depth_2d +texture_depth_2d_array +texture_depth_cube +texture_depth_cube_array +texture_depth_multisampled_2d + +---------------------------------------------------- + +[ + ["types", "bool"], + ["types", "i32"], + ["types", "u32"], + ["types", "f32"], + ["types", "i64"], + ["types", "u64"], + ["types", "f64"], + ["types", "vec2"], + ["types", "vec3"], + ["types", "vec4"], + ["types", "mat2x2"], + ["types", "mat2x3"], + ["types", "mat2x4"], + ["types", "mat3x2"], + ["types", "mat3x3"], + ["types", "mat3x4"], + ["types", "mat4x2"], + ["types", "mat4x3"], + ["types", "mat4x4"], + + ["types", "atomic"], + ["types", "array"], + + ["types", "override"], + ["types", "ptr"], + + ["types", "sampler"], + ["types", "sampler_comparison"], + ["types", "staticAssert"], + ["types", "struct"], + + ["types", "texture_1d"], + ["types", "texture_2d"], + ["types", "texture_2d_array"], + ["types", "texture_3d"], + ["types", "texture_cube"], + ["types", "texture_cube_array"], + ["types", "texture_multisampled_2d"], + ["types", "texture_storage_1d"], + ["types", "texture_storage_2d"], + ["types", "texture_storage_2d_array"], + ["types", "texture_storage_3d"], + ["types", "texture_depth_2d"], + ["types", "texture_depth_2d_array"], + ["types", "texture_depth_cube"], + ["types", "texture_depth_cube_array"], + ["types", "texture_depth_multisampled_2d"] +] From 215cc01d908f78bd59b422c7356c22fc9a70828c Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Sun, 15 May 2022 21:07:53 +0200 Subject: [PATCH 02/31] Rebuild for WGSL --- components.js | 2 +- components/prism-wgsl.min.js | 1 + plugins/show-language/prism-show-language.js | 1 + plugins/show-language/prism-show-language.min.js | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 components/prism-wgsl.min.js diff --git a/components.js b/components.js index afe2c44dc2..437197ab30 100644 --- a/components.js +++ b/components.js @@ -1,2 +1,2 @@ -var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","optional":"regex","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"ABNF","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"agda":{"title":"Agda","owner":"xy-ren"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apex":{"title":"Apex","require":["clike","sql"],"owner":"RunDevelopment"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","alias":"ino","owner":"dkern"},"arff":{"title":"ARFF","owner":"Golmote"},"armasm":{"title":"ARM Assembly","alias":"arm-asm","owner":"RunDevelopment"},"arturo":{"title":"Arturo","alias":"art","optional":["bash","css","javascript","markup","markdown","sql"],"owner":"drkameleon"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"asmatmel":{"title":"Atmel AVR Assembly","owner":"cerkit"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"avisynth":{"title":"AviSynth","alias":"avs","owner":"Zinfidel"},"avro-idl":{"title":"Avro IDL","alias":"avdl","owner":"RunDevelopment"},"awk":{"title":"AWK","alias":"gawk","aliasTitles":{"gawk":"GAWK"},"owner":"RunDevelopment"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bicep":{"title":"Bicep","owner":"johnnyreilly"},"birb":{"title":"Birb","require":"clike","owner":"Calamity210"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"BNF","alias":"rbnf","aliasTitles":{"rbnf":"RBNF"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"bsl":{"title":"BSL (1C:Enterprise)","alias":"oscript","aliasTitles":{"oscript":"OneScript"},"owner":"Diversus23"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cfscript":{"title":"CFScript","require":"clike","alias":"cfc","owner":"mjclemente"},"chaiscript":{"title":"ChaiScript","require":["clike","cpp"],"owner":"RunDevelopment"},"cil":{"title":"CIL","owner":"sbrl"},"clojure":{"title":"Clojure","owner":"troglotit"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"cobol":{"title":"COBOL","owner":"RunDevelopment"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"cooklang":{"title":"Cooklang","owner":"ahue"},"coq":{"title":"Coq","owner":"RunDevelopment"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"csv":{"title":"CSV","owner":"RunDevelopment"},"cue":{"title":"CUE","owner":"RunDevelopment"},"cypher":{"title":"Cypher","owner":"RunDevelopment"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dataweave":{"title":"DataWeave","owner":"machaval"},"dax":{"title":"DAX","owner":"peterbud"},"dhall":{"title":"Dhall","owner":"RunDevelopment"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"dot":{"title":"DOT (Graphviz)","alias":"gv","optional":"markup","owner":"RunDevelopment"},"ebnf":{"title":"EBNF","owner":"RunDevelopment"},"editorconfig":{"title":"EditorConfig","owner":"osipxd"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"false":{"title":"False","owner":"edukisto"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"gap":{"title":"GAP (CAS)","owner":"RunDevelopment"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gettext":{"title":"gettext","alias":"po","owner":"RunDevelopment"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gn":{"title":"GN","alias":"gni","owner":"RunDevelopment"},"linker-script":{"title":"GNU Linker Script","alias":"ld","owner":"RunDevelopment"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"go-module":{"title":"Go module","alias":"go-mod","owner":"RunDevelopment"},"gradle":{"title":"Gradle","require":"clike","owner":"zeabdelkhalek-badido18"},"graphql":{"title":"GraphQL","optional":"markdown","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","alias":["hbs","mustache"],"aliasTitles":{"mustache":"Mustache"},"owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","optional":"regex","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"hoon":{"title":"Hoon","owner":"matildepark"},"http":{"title":"HTTP","optional":["csp","css","hpkp","hsts","javascript","json","markup","uri"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"icu-message-format":{"title":"ICU Message Format","owner":"RunDevelopment"},"idris":{"title":"Idris","alias":"idr","owner":"KeenS","require":"haskell"},"ignore":{"title":".ignore","owner":"osipxd","alias":["gitignore","hgignore","npmignore"],"aliasTitles":{"gitignore":".gitignore","hgignore":".hgignore","npmignore":".npmignore"}},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jexl":{"title":"Jexl","owner":"czosel"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike","typescript"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"jsstacktrace":{"title":"JS stack trace","owner":"sbrl"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup","sql"],"owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keepalived":{"title":"Keepalived Configure","owner":"dev-itsheng"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","alias":["kt","kts"],"aliasTitles":{"kts":"Kotlin Script"},"require":"clike","owner":"Golmote"},"kumir":{"title":"KuMir (КуМир)","alias":"kum","owner":"edukisto"},"kusto":{"title":"Kusto","owner":"RunDevelopment"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","require":"markup-templating","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"log":{"title":"Log file","optional":"javastacktrace","owner":"RunDevelopment"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"magma":{"title":"Magma (CAS)","owner":"RunDevelopment"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","optional":"yaml","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"mata":{"title":"Mata","owner":"RunDevelopment"},"matlab":{"title":"MATLAB","owner":"Golmote"},"maxscript":{"title":"MAXScript","owner":"RunDevelopment"},"mel":{"title":"MEL","owner":"Golmote"},"mermaid":{"title":"Mermaid","owner":"RunDevelopment"},"mizar":{"title":"Mizar","owner":"Golmote"},"mongodb":{"title":"MongoDB","owner":"airs0urce","require":"javascript"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"naniscript":{"title":"Naninovel Script","owner":"Elringus","alias":"nani"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nevod":{"title":"Nevod","owner":"nezaboodka"},"nginx":{"title":"nginx","owner":"volado"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"odin":{"title":"Odin","owner":"edukisto"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"openqasm":{"title":"OpenQasm","alias":"qasm","owner":"RunDevelopment"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"psl":{"title":"PATROL Scripting Language","owner":"bertysentry"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":"markup-templating","owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plant-uml":{"title":"PlantUML","alias":"plantuml","owner":"RunDevelopment"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"promql":{"title":"PromQL","owner":"arendjr"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"purescript":{"title":"PureScript","require":"haskell","alias":"purs","owner":"sriharshachilakapati"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"qsharp":{"title":"Q#","require":"clike","alias":"qs","owner":"fedonman"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"cshtml":{"title":"Razor C#","alias":"razor","require":["markup","csharp"],"optional":["css","css-extras","javascript","js-extras"],"owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","owner":"RunDevelopment"},"rego":{"title":"Rego","owner":"JordanSh"},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"rescript":{"title":"ReScript","alias":"res","owner":"vmarcosp"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","optional":"css-extras","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","alias":["sh-session","shellsession"],"owner":"RunDevelopment"},"smali":{"title":"Smali","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","optional":"php","owner":"Golmote"},"sml":{"title":"SML","alias":"smlnj","aliasTitles":{"smlnj":"SML/NJ"},"owner":"RunDevelopment"},"solidity":{"title":"Solidity (Ethereum)","alias":"sol","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"squirrel":{"title":"Squirrel","require":"clike","owner":"RunDevelopment"},"stan":{"title":"Stan","owner":"RunDevelopment"},"stata":{"title":"Stata Ado","require":["mata","java","python"],"owner":"RunDevelopment"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"stylus":{"title":"Stylus","owner":"vkbansal"},"supercollider":{"title":"SuperCollider","alias":"sclang","owner":"RunDevelopment"},"swift":{"title":"Swift","owner":"chrischares"},"systemd":{"title":"Systemd configuration file","owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tremor":{"title":"Tremor","alias":["trickle","troy"],"owner":"darach","aliasTitles":{"trickle":"trickle","troy":"troy"}},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup-templating","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"typoscript":{"title":"TypoScript","alias":"tsconfig","aliasTitles":{"tsconfig":"TSConfig"},"owner":"dkern"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"uorazor":{"title":"UO Razor Script","owner":"jaseowns"},"uri":{"title":"URI","alias":"url","aliasTitles":{"url":"URL"},"owner":"RunDevelopment"},"v":{"title":"V","require":"clike","owner":"taggon"},"vala":{"title":"Vala","require":"clike","optional":"regex","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":["vb","vba"],"aliasTitles":{"vba":"VBA"},"owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"web-idl":{"title":"Web IDL","alias":"webidl","owner":"RunDevelopment"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"wolfram":{"title":"Wolfram language","alias":["mathematica","nb","wl"],"aliasTitles":{"mathematica":"Mathematica","nb":"Mathematica Notebook"},"owner":"msollami"},"wren":{"title":"Wren","owner":"clsource"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"yang":{"title":"YANG","owner":"RunDevelopment"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword for fine-grained highlighting.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}}; +var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","optional":"regex","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"ABNF","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"agda":{"title":"Agda","owner":"xy-ren"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apex":{"title":"Apex","require":["clike","sql"],"owner":"RunDevelopment"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","alias":"ino","owner":"dkern"},"arff":{"title":"ARFF","owner":"Golmote"},"armasm":{"title":"ARM Assembly","alias":"arm-asm","owner":"RunDevelopment"},"arturo":{"title":"Arturo","alias":"art","optional":["bash","css","javascript","markup","markdown","sql"],"owner":"drkameleon"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"asmatmel":{"title":"Atmel AVR Assembly","owner":"cerkit"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"avisynth":{"title":"AviSynth","alias":"avs","owner":"Zinfidel"},"avro-idl":{"title":"Avro IDL","alias":"avdl","owner":"RunDevelopment"},"awk":{"title":"AWK","alias":"gawk","aliasTitles":{"gawk":"GAWK"},"owner":"RunDevelopment"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bicep":{"title":"Bicep","owner":"johnnyreilly"},"birb":{"title":"Birb","require":"clike","owner":"Calamity210"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"BNF","alias":"rbnf","aliasTitles":{"rbnf":"RBNF"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"bsl":{"title":"BSL (1C:Enterprise)","alias":"oscript","aliasTitles":{"oscript":"OneScript"},"owner":"Diversus23"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cfscript":{"title":"CFScript","require":"clike","alias":"cfc","owner":"mjclemente"},"chaiscript":{"title":"ChaiScript","require":["clike","cpp"],"owner":"RunDevelopment"},"cil":{"title":"CIL","owner":"sbrl"},"clojure":{"title":"Clojure","owner":"troglotit"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"cobol":{"title":"COBOL","owner":"RunDevelopment"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"cooklang":{"title":"Cooklang","owner":"ahue"},"coq":{"title":"Coq","owner":"RunDevelopment"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"csv":{"title":"CSV","owner":"RunDevelopment"},"cue":{"title":"CUE","owner":"RunDevelopment"},"cypher":{"title":"Cypher","owner":"RunDevelopment"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dataweave":{"title":"DataWeave","owner":"machaval"},"dax":{"title":"DAX","owner":"peterbud"},"dhall":{"title":"Dhall","owner":"RunDevelopment"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"dot":{"title":"DOT (Graphviz)","alias":"gv","optional":"markup","owner":"RunDevelopment"},"ebnf":{"title":"EBNF","owner":"RunDevelopment"},"editorconfig":{"title":"EditorConfig","owner":"osipxd"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"false":{"title":"False","owner":"edukisto"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"gap":{"title":"GAP (CAS)","owner":"RunDevelopment"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gettext":{"title":"gettext","alias":"po","owner":"RunDevelopment"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gn":{"title":"GN","alias":"gni","owner":"RunDevelopment"},"linker-script":{"title":"GNU Linker Script","alias":"ld","owner":"RunDevelopment"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"go-module":{"title":"Go module","alias":"go-mod","owner":"RunDevelopment"},"gradle":{"title":"Gradle","require":"clike","owner":"zeabdelkhalek-badido18"},"graphql":{"title":"GraphQL","optional":"markdown","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","alias":["hbs","mustache"],"aliasTitles":{"mustache":"Mustache"},"owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","optional":"regex","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"hoon":{"title":"Hoon","owner":"matildepark"},"http":{"title":"HTTP","optional":["csp","css","hpkp","hsts","javascript","json","markup","uri"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"icu-message-format":{"title":"ICU Message Format","owner":"RunDevelopment"},"idris":{"title":"Idris","alias":"idr","owner":"KeenS","require":"haskell"},"ignore":{"title":".ignore","owner":"osipxd","alias":["gitignore","hgignore","npmignore"],"aliasTitles":{"gitignore":".gitignore","hgignore":".hgignore","npmignore":".npmignore"}},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jexl":{"title":"Jexl","owner":"czosel"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike","typescript"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"jsstacktrace":{"title":"JS stack trace","owner":"sbrl"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup","sql"],"owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keepalived":{"title":"Keepalived Configure","owner":"dev-itsheng"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","alias":["kt","kts"],"aliasTitles":{"kts":"Kotlin Script"},"require":"clike","owner":"Golmote"},"kumir":{"title":"KuMir (КуМир)","alias":"kum","owner":"edukisto"},"kusto":{"title":"Kusto","owner":"RunDevelopment"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","require":"markup-templating","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"log":{"title":"Log file","optional":"javastacktrace","owner":"RunDevelopment"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"magma":{"title":"Magma (CAS)","owner":"RunDevelopment"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","optional":"yaml","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"mata":{"title":"Mata","owner":"RunDevelopment"},"matlab":{"title":"MATLAB","owner":"Golmote"},"maxscript":{"title":"MAXScript","owner":"RunDevelopment"},"mel":{"title":"MEL","owner":"Golmote"},"mermaid":{"title":"Mermaid","owner":"RunDevelopment"},"mizar":{"title":"Mizar","owner":"Golmote"},"mongodb":{"title":"MongoDB","owner":"airs0urce","require":"javascript"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"naniscript":{"title":"Naninovel Script","owner":"Elringus","alias":"nani"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nevod":{"title":"Nevod","owner":"nezaboodka"},"nginx":{"title":"nginx","owner":"volado"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"odin":{"title":"Odin","owner":"edukisto"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"openqasm":{"title":"OpenQasm","alias":"qasm","owner":"RunDevelopment"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"psl":{"title":"PATROL Scripting Language","owner":"bertysentry"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":"markup-templating","owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plant-uml":{"title":"PlantUML","alias":"plantuml","owner":"RunDevelopment"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"promql":{"title":"PromQL","owner":"arendjr"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"purescript":{"title":"PureScript","require":"haskell","alias":"purs","owner":"sriharshachilakapati"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"qsharp":{"title":"Q#","require":"clike","alias":"qs","owner":"fedonman"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"cshtml":{"title":"Razor C#","alias":"razor","require":["markup","csharp"],"optional":["css","css-extras","javascript","js-extras"],"owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","owner":"RunDevelopment"},"rego":{"title":"Rego","owner":"JordanSh"},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"rescript":{"title":"ReScript","alias":"res","owner":"vmarcosp"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","optional":"css-extras","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","alias":["sh-session","shellsession"],"owner":"RunDevelopment"},"smali":{"title":"Smali","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","optional":"php","owner":"Golmote"},"sml":{"title":"SML","alias":"smlnj","aliasTitles":{"smlnj":"SML/NJ"},"owner":"RunDevelopment"},"solidity":{"title":"Solidity (Ethereum)","alias":"sol","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"squirrel":{"title":"Squirrel","require":"clike","owner":"RunDevelopment"},"stan":{"title":"Stan","owner":"RunDevelopment"},"stata":{"title":"Stata Ado","require":["mata","java","python"],"owner":"RunDevelopment"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"stylus":{"title":"Stylus","owner":"vkbansal"},"supercollider":{"title":"SuperCollider","alias":"sclang","owner":"RunDevelopment"},"swift":{"title":"Swift","owner":"chrischares"},"systemd":{"title":"Systemd configuration file","owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tremor":{"title":"Tremor","alias":["trickle","troy"],"owner":"darach","aliasTitles":{"trickle":"trickle","troy":"troy"}},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup-templating","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"typoscript":{"title":"TypoScript","alias":"tsconfig","aliasTitles":{"tsconfig":"TSConfig"},"owner":"dkern"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"uorazor":{"title":"UO Razor Script","owner":"jaseowns"},"uri":{"title":"URI","alias":"url","aliasTitles":{"url":"URL"},"owner":"RunDevelopment"},"v":{"title":"V","require":"clike","owner":"taggon"},"vala":{"title":"Vala","require":"clike","optional":"regex","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":["vb","vba"],"aliasTitles":{"vba":"VBA"},"owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"web-idl":{"title":"Web IDL","alias":"webidl","owner":"RunDevelopment"},"wgsl":{"title":"WGSL","owner":"Dr4gonthree"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"wolfram":{"title":"Wolfram language","alias":["mathematica","nb","wl"],"aliasTitles":{"mathematica":"Mathematica","nb":"Mathematica Notebook"},"owner":"msollami"},"wren":{"title":"Wren","owner":"clsource"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"yang":{"title":"YANG","owner":"RunDevelopment"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword for fine-grained highlighting.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}}; if (typeof module !== 'undefined' && module.exports) { module.exports = components; } \ No newline at end of file diff --git a/components/prism-wgsl.min.js b/components/prism-wgsl.min.js new file mode 100644 index 0000000000..b1cf94a2d4 --- /dev/null +++ b/components/prism-wgsl.min.js @@ -0,0 +1 @@ +Prism.languages.wgsl={comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},attributes:{pattern:/(@)(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))/u,lookbehind:!0,alias:"symbol"},functions:{pattern:/\b(fn)\s+(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))(?=(?:\()|(?:<))/u,lookbehind:!0,alias:"function",inside:{}},keyword:[{pattern:/\b(?:bitcast|block|break|case|continue|continuing|default|discard|else|elseif|enable|fallthrough|for|function|if|loop|private|read|read_write|return|storage|switch|uniform|workgroup|write)\b/},{pattern:/\b(?:asm|const|do|enum|handle|mat|premerge|regardless|typedef|unless|using|vec|void|while)\b/},{pattern:/\b(?:let|var)\b/},{pattern:/\b(?:type)\b/},{pattern:/\b(?:enum)\b/},{pattern:/\bfn\b/}],"function-calls":{pattern:/(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))(?=\()/u,alias:"function",inside:{}},types:[{pattern:/\b(?:bool|i32|u32|f32)\b/,alias:"builtin"},{pattern:/\b(?:i64|u64|f64)\b/,alias:"builtin"},{pattern:/\b(?:vec[2-4]|mat[2-4]x[2-4])\b/,alias:"builtin"},{pattern:/\b(?:atomic)\b/,alias:"builtin"},{pattern:/\b(?:array)\b/,alias:"builtin"},{pattern:/\b(?:override|ptr|sampler|sampler_comparison|staticAssert|struct)\b/,alias:"builtin"},{pattern:/\b(?:texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array|texture_multisampled_2d)\b/,alias:"builtin"},{pattern:/\b(?:texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d|texture_depth_2d)\b/,alias:"builtin"},{pattern:/\b(?:texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/,alias:"builtin"},{pattern:/\b(?:[A-Z][A-Za-z0-9]*)\b/,alias:"class-name"}],"built-in-values":[{pattern:/\b(?:vertex_index|instance_index|position)\b/,alias:"namespace"},{pattern:/\b(?:front_facing|frag_depth|sample_index|sample_mask)\b/,alias:"namespace"},{pattern:/\b(?:local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/,alias:"namespace"}],"bool-literal":{pattern:/\b(?:true|false)\b/,alias:"boolean"},"hex-int-literal":[{pattern:/\b0[xX][0-9a-fA-F]+[iu]?(?!(?:\.|p|P))\b/,alias:"number"}],"hex-float-literal":[{pattern:/0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+(?:[pP](?:\+|-)?[0-9]+[fh]?)?/,alias:"number"},{pattern:/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*(?:[pP](?:\+|-)?[0-9]+[fh]?)?/,alias:"number"},{pattern:/0[xX][0-9a-fA-F]+[pP](?:\+|-)?[0-9]+[fh]?/,alias:"number"}],"decimal-float-literal-a":[{pattern:/[0-9]*\.[0-9]+(?:[eE](?:\+|-)?[0-9]+)?[fh]?/,alias:"number"},{pattern:/[0-9]+\.[0-9]*(?:[eE](?:\+|-)?[0-9]+)?[fh]?/,alias:"number"},{pattern:/[0-9]+[eE](?:\+|-)?[0-9]+[fh]?/,alias:"number"}],variables:{pattern:/\b(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))\b/u,alias:"variable"},"decimal-float-literal-b":[{pattern:/0[fh]/,alias:"number"},{pattern:/[1-9][0-9]*[fh]/,alias:"number"}],"int-literal":[{pattern:/0[iu]?/,alias:"number"},{pattern:/[1-9][0-9]*[iu]?/,alias:"number"}],operator:[{pattern:/(?:\^|~|\||\|\||&&|<<|>>|!)(?!=)/},{pattern:/&(?![&=])/},{pattern:/(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/},{pattern:/(?])=(?!=|>)/},{pattern:/(?:=(?:=)?(?!>)|!=|<=|(?=)/},{pattern:/(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/},{pattern:/\.(?!\.)/},{pattern:/->/}],punctuation:[{pattern:/,/},{pattern:/[{}]/},{pattern:/[\(\)]/},{pattern:/;/},{pattern:/[\[\]]/},{pattern:/(?]/}]}; \ No newline at end of file diff --git a/plugins/show-language/prism-show-language.js b/plugins/show-language/prism-show-language.js index ad2a98acd3..839e6aad24 100644 --- a/plugins/show-language/prism-show-language.js +++ b/plugins/show-language/prism-show-language.js @@ -267,6 +267,7 @@ "wasm": "WebAssembly", "web-idl": "Web IDL", "webidl": "Web IDL", + "wgsl": "WGSL", "wiki": "Wiki markup", "wolfram": "Wolfram language", "nb": "Mathematica Notebook", diff --git a/plugins/show-language/prism-show-language.min.js b/plugins/show-language/prism-show-language.min.js index 9107432acb..a5e892fb88 100644 --- a/plugins/show-language/prism-show-language.min.js +++ b/plugins/show-language/prism-show-language.min.js @@ -1 +1 @@ -!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document)if(Prism.plugins.toolbar){var e={none:"Plain text",plain:"Plain text",plaintext:"Plain text",text:"Plain text",txt:"Plain text",html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",ino:"Arduino",arff:"ARFF",armasm:"ARM Assembly","arm-asm":"ARM Assembly",art:"Arturo",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",asmatmel:"Atmel AVR Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt",avisynth:"AviSynth",avs:"AviSynth","avro-idl":"Avro IDL",avdl:"Avro IDL",awk:"AWK",gawk:"GAWK",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cfscript:"CFScript",cfc:"CFScript",cil:"CIL",cmake:"CMake",cobol:"COBOL",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",csv:"CSV",cue:"CUE",dataweave:"DataWeave",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",dot:"DOT (Graphviz)",gv:"DOT (Graphviz)",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gap:"GAP (CAS)",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",gettext:"gettext",po:"gettext",glsl:"GLSL",gn:"GN",gni:"GN","linker-script":"GNU Linker Script",ld:"GNU Linker Script","go-module":"Go module","go-mod":"Go module",graphql:"GraphQL",hbs:"Handlebars",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam","icu-message-format":"ICU Message Format",idr:"Idris",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",keepalived:"Keepalived Configure",kts:"Kotlin Script",kt:"Kotlin",kumir:"KuMir (КуМир)",kum:"KuMir (КуМир)",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",log:"Log file",lolcode:"LOLCODE",magma:"Magma (CAS)",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",maxscript:"MAXScript",mel:"MEL",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",openqasm:"OpenQasm",qasm:"OpenQasm",parigp:"PARI/GP",objectpascal:"Object Pascal",psl:"PATROL Scripting Language",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras","plant-uml":"PlantUML",plantuml:"PlantUML",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",promql:"PromQL",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",qsharp:"Q#",qs:"Q#",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",cshtml:"Razor C#",razor:"Razor C#",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",res:"ReScript",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",sml:"SML",smlnj:"SML/NJ",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",stata:"Stata Ado",iecst:"Structured Text (IEC 61131-3)",supercollider:"SuperCollider",sclang:"SuperCollider",systemd:"Systemd configuration file","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trickle:"trickle",troy:"troy",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",uorazor:"UO Razor Script",uri:"URI",url:"URL",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly","web-idl":"Web IDL",webidl:"Web IDL",wiki:"Wiki markup",wolfram:"Wolfram language",nb:"Mathematica Notebook",wl:"Wolfram language",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML",yang:"YANG"};Prism.plugins.toolbar.registerButton("show-language",(function(a){var t=a.element.parentNode;if(t&&/pre/i.test(t.nodeName)){var o,s=t.getAttribute("data-language")||e[a.language]||((o=a.language)?(o.substring(0,1).toUpperCase()+o.substring(1)).replace(/s(?=cript)/,"S"):o);if(s){var r=document.createElement("span");return r.textContent=s,r}}}))}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}(); \ No newline at end of file +!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document)if(Prism.plugins.toolbar){var e={none:"Plain text",plain:"Plain text",plaintext:"Plain text",text:"Plain text",txt:"Plain text",html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",ino:"Arduino",arff:"ARFF",armasm:"ARM Assembly","arm-asm":"ARM Assembly",art:"Arturo",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",asmatmel:"Atmel AVR Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt",avisynth:"AviSynth",avs:"AviSynth","avro-idl":"Avro IDL",avdl:"Avro IDL",awk:"AWK",gawk:"GAWK",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cfscript:"CFScript",cfc:"CFScript",cil:"CIL",cmake:"CMake",cobol:"COBOL",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",csv:"CSV",cue:"CUE",dataweave:"DataWeave",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",dot:"DOT (Graphviz)",gv:"DOT (Graphviz)",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gap:"GAP (CAS)",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",gettext:"gettext",po:"gettext",glsl:"GLSL",gn:"GN",gni:"GN","linker-script":"GNU Linker Script",ld:"GNU Linker Script","go-module":"Go module","go-mod":"Go module",graphql:"GraphQL",hbs:"Handlebars",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam","icu-message-format":"ICU Message Format",idr:"Idris",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",keepalived:"Keepalived Configure",kts:"Kotlin Script",kt:"Kotlin",kumir:"KuMir (КуМир)",kum:"KuMir (КуМир)",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",log:"Log file",lolcode:"LOLCODE",magma:"Magma (CAS)",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",maxscript:"MAXScript",mel:"MEL",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",openqasm:"OpenQasm",qasm:"OpenQasm",parigp:"PARI/GP",objectpascal:"Object Pascal",psl:"PATROL Scripting Language",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras","plant-uml":"PlantUML",plantuml:"PlantUML",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",promql:"PromQL",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",qsharp:"Q#",qs:"Q#",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",cshtml:"Razor C#",razor:"Razor C#",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",res:"ReScript",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",sml:"SML",smlnj:"SML/NJ",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",stata:"Stata Ado",iecst:"Structured Text (IEC 61131-3)",supercollider:"SuperCollider",sclang:"SuperCollider",systemd:"Systemd configuration file","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trickle:"trickle",troy:"troy",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",uorazor:"UO Razor Script",uri:"URI",url:"URL",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly","web-idl":"Web IDL",webidl:"Web IDL",wgsl:"WGSL",wiki:"Wiki markup",wolfram:"Wolfram language",nb:"Mathematica Notebook",wl:"Wolfram language",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML",yang:"YANG"};Prism.plugins.toolbar.registerButton("show-language",(function(a){var t=a.element.parentNode;if(t&&/pre/i.test(t.nodeName)){var o,s=t.getAttribute("data-language")||e[a.language]||((o=a.language)?(o.substring(0,1).toUpperCase()+o.substring(1)).replace(/s(?=cript)/,"S"):o);if(s){var r=document.createElement("span");return r.textContent=s,r}}}))}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}(); \ No newline at end of file From c180f22040ebc315b245e1c90526390870a8b101 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Mon, 16 May 2022 20:13:15 +0200 Subject: [PATCH 03/31] Replaced Unicode patterns with ASCII versions --- components/prism-wgsl.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 9191dff9f3..b3f90a9f81 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -4,12 +4,12 @@ Prism.languages.wgsl = { greedy: true, }, 'attributes': { - pattern: /(@)(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))/u, + pattern: /(@)[_a-z]\w*/i, lookbehind: true, alias: 'symbol', }, 'functions': { - pattern: /\b(fn)\s+(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))(?=(?:\()|(?:<))/u, + pattern: /\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/, lookbehind: true, alias: 'function', inside: {}, @@ -23,7 +23,7 @@ Prism.languages.wgsl = { { pattern: /\bfn\b/ }, ], 'function-calls': { - pattern: /(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))(?=\()/u, + pattern: /\b[_a-z]\w*(?=\()/i, alias: 'function', inside: {}, }, @@ -62,7 +62,7 @@ Prism.languages.wgsl = { { pattern: /[0-9]+[eE](?:\+|-)?[0-9]+[fh]?/, alias:'number' }, ], 'variables': { - pattern: /\b(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))\b/u, + pattern: /\b[_a-z]\w*\b/i, alias: 'variable', }, 'decimal-float-literal-b': [ From f8784249e482acf2e717f3c3c641a32b6b0fc799 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Mon, 16 May 2022 20:14:50 +0200 Subject: [PATCH 04/31] Removed empty insides --- components/prism-wgsl.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index b3f90a9f81..9423243ba5 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -12,7 +12,6 @@ Prism.languages.wgsl = { pattern: /\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/, lookbehind: true, alias: 'function', - inside: {}, }, 'keyword': [ { pattern: /\b(?:bitcast|block|break|case|continue|continuing|default|discard|else|elseif|enable|fallthrough|for|function|if|loop|private|read|read_write|return|storage|switch|uniform|workgroup|write)\b/ }, @@ -25,7 +24,6 @@ Prism.languages.wgsl = { 'function-calls': { pattern: /\b[_a-z]\w*(?=\()/i, alias: 'function', - inside: {}, }, 'types': [ { pattern: /\b(?:bool|i32|u32|f32)\b/, alias: 'builtin' }, From 48e028b3d3ba65fe7b3b725aab6b9a4619b6861a Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Mon, 16 May 2022 20:23:42 +0200 Subject: [PATCH 05/31] Removed wrong use of variable token --- components/prism-wgsl.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 9423243ba5..bb47241630 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -59,10 +59,6 @@ Prism.languages.wgsl = { { pattern: /[0-9]+\.[0-9]*(?:[eE](?:\+|-)?[0-9]+)?[fh]?/, alias:'number' }, { pattern: /[0-9]+[eE](?:\+|-)?[0-9]+[fh]?/, alias:'number' }, ], - 'variables': { - pattern: /\b[_a-z]\w*\b/i, - alias: 'variable', - }, 'decimal-float-literal-b': [ { pattern: /0[fh]/, alias:'number' }, { pattern: /[1-9][0-9]*[fh]/, alias:'number' }, From 9d08847a45c15196631c3db0c282e73203c8d3ca Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Mon, 16 May 2022 20:27:36 +0200 Subject: [PATCH 06/31] Simplified the punctuation pattern --- components/prism-wgsl.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index bb47241630..69a4d7af47 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -77,12 +77,5 @@ Prism.languages.wgsl = { { pattern: /\.(?!\.)/ }, { pattern: /->/ }, ], - 'punctuation': [ - { pattern: /,/ }, - { pattern: /[{}]/ }, - { pattern: /[\(\)]/ }, - { pattern: /;/ }, - { pattern: /[\[\]]/ }, - { pattern: /(?]/ }, - ], + 'punctuation': /[(){}[\],;<>]/, }; From 6e88afaad253cfa62147323efca12253a5c34fa1 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Mon, 16 May 2022 20:36:52 +0200 Subject: [PATCH 07/31] Changed attribute alias from symbol to important --- components/prism-wgsl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 69a4d7af47..ed0611ddb6 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -6,7 +6,7 @@ Prism.languages.wgsl = { 'attributes': { pattern: /(@)[_a-z]\w*/i, lookbehind: true, - alias: 'symbol', + alias: 'important', }, 'functions': { pattern: /\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/, From 0f2ad3ca1965419bc1d450465a83d68b2ae644fa Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Mon, 16 May 2022 20:46:09 +0200 Subject: [PATCH 08/31] Replaced wrong usage of namespace token, and categorized built-in values --- components/prism-wgsl.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index ed0611ddb6..f80b29e924 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -37,10 +37,14 @@ Prism.languages.wgsl = { { pattern: /\b(?:texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/, alias: 'builtin' }, { pattern: /\b(?:[A-Z][A-Za-z0-9]*)\b/, alias: 'class-name' }, ], - 'built-in-values': [ - { pattern: /\b(?:vertex_index|instance_index|position)\b/, alias: 'namespace' }, - { pattern: /\b(?:front_facing|frag_depth|sample_index|sample_mask)\b/, alias: 'namespace' }, - { pattern: /\b(?:local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/, alias: 'namespace' }, + 'built-in-values-vertex': [ + { pattern: /\b(?:vertex_index|instance_index|position)\b/, alias: 'keyword' }, + ], + 'built-in-values-fragment': [ + { pattern: /\b(?:front_facing|frag_depth|sample_index|sample_mask)\b/, alias: 'keyword' }, + ], + 'built-in-values-compute': [ + { pattern: /\b(?:local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/, alias: 'keyword' }, ], 'bool-literal': { pattern: /\b(?:true|false)\b/, From b5ea50fdd309f563113963346f1877aeeb717f61 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Mon, 16 May 2022 20:55:44 +0200 Subject: [PATCH 09/31] Combined and updated keyword patterns --- components/prism-wgsl.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index f80b29e924..cf60a0cfa0 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -14,12 +14,7 @@ Prism.languages.wgsl = { alias: 'function', }, 'keyword': [ - { pattern: /\b(?:bitcast|block|break|case|continue|continuing|default|discard|else|elseif|enable|fallthrough|for|function|if|loop|private|read|read_write|return|storage|switch|uniform|workgroup|write)\b/ }, - { pattern: /\b(?:asm|const|do|enum|handle|mat|premerge|regardless|typedef|unless|using|vec|void|while)\b/ }, - { pattern: /\b(?:let|var)\b/ }, - { pattern: /\b(?:type)\b/ }, - { pattern: /\b(?:enum)\b/ }, - { pattern: /\bfn\b/ }, + { pattern: /\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|switch|type|uniform|var|while|workgroup)\b/ }, ], 'function-calls': { pattern: /\b[_a-z]\w*(?=\()/i, From 27dd0deae4f8c34b92c1400936521f94b0d83263 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Mon, 16 May 2022 21:07:25 +0200 Subject: [PATCH 10/31] Combined builtin types and seperated class-names --- components/prism-wgsl.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index cf60a0cfa0..1c39e8a6fc 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -20,18 +20,8 @@ Prism.languages.wgsl = { pattern: /\b[_a-z]\w*(?=\()/i, alias: 'function', }, - 'types': [ - { pattern: /\b(?:bool|i32|u32|f32)\b/, alias: 'builtin' }, - { pattern: /\b(?:i64|u64|f64)\b/, alias: 'builtin' }, - { pattern: /\b(?:vec[2-4]|mat[2-4]x[2-4])\b/, alias: 'builtin' }, - { pattern: /\b(?:atomic)\b/, alias: 'builtin' }, - { pattern: /\b(?:array)\b/, alias: 'builtin' }, - { pattern: /\b(?:override|ptr|sampler|sampler_comparison|staticAssert|struct)\b/, alias: 'builtin' }, - { pattern: /\b(?:texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array|texture_multisampled_2d)\b/, alias: 'builtin' }, - { pattern: /\b(?:texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d|texture_depth_2d)\b/, alias: 'builtin' }, - { pattern: /\b(?:texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/, alias: 'builtin' }, - { pattern: /\b(?:[A-Z][A-Za-z0-9]*)\b/, alias: 'class-name' }, - ], + 'builtin': /\b(?:array|atomic|bool|i32|u32|f32|i64|u64|f64|vec[2-4]|mat[2-4]x[2-4]|override|ptr|sampler|sampler_comparison|staticAssert|struct|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|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/, + 'class-name': /\b(?:[A-Z][A-Za-z0-9]*)\b/, 'built-in-values-vertex': [ { pattern: /\b(?:vertex_index|instance_index|position)\b/, alias: 'keyword' }, ], From 97626d1e403e39e3679722cd21cbff69a51abe4d Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Mon, 16 May 2022 21:11:04 +0200 Subject: [PATCH 11/31] Collapsed keywords and built-in-values --- components/prism-wgsl.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 1c39e8a6fc..f3ac0fe0aa 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -13,24 +13,25 @@ Prism.languages.wgsl = { lookbehind: true, alias: 'function', }, - 'keyword': [ - { pattern: /\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|switch|type|uniform|var|while|workgroup)\b/ }, - ], + 'keyword': /\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|switch|type|uniform|var|while|workgroup)\b/, 'function-calls': { pattern: /\b[_a-z]\w*(?=\()/i, alias: 'function', }, 'builtin': /\b(?:array|atomic|bool|i32|u32|f32|i64|u64|f64|vec[2-4]|mat[2-4]x[2-4]|override|ptr|sampler|sampler_comparison|staticAssert|struct|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|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/, 'class-name': /\b(?:[A-Z][A-Za-z0-9]*)\b/, - 'built-in-values-vertex': [ - { pattern: /\b(?:vertex_index|instance_index|position)\b/, alias: 'keyword' }, - ], - 'built-in-values-fragment': [ - { pattern: /\b(?:front_facing|frag_depth|sample_index|sample_mask)\b/, alias: 'keyword' }, - ], - 'built-in-values-compute': [ - { pattern: /\b(?:local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/, alias: 'keyword' }, - ], + 'built-in-values-vertex': { + pattern: /\b(?:vertex_index|instance_index|position)\b/, + alias: 'keyword', + }, + 'built-in-values-fragment': { + pattern: /\b(?:front_facing|frag_depth|sample_index|sample_mask)\b/, + alias: 'keyword' + }, + 'built-in-values-compute': { + pattern: /\b(?:local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/, + alias: 'keyword', + }, 'bool-literal': { pattern: /\b(?:true|false)\b/, alias: 'boolean', From 3a3a5b62fdf1e4e4ffb3088ae423489662024b2d Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Mon, 16 May 2022 21:26:20 +0200 Subject: [PATCH 12/31] Simplified number literals --- components/prism-wgsl.js | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index f3ac0fe0aa..e09e7a4d26 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -37,26 +37,19 @@ Prism.languages.wgsl = { alias: 'boolean', }, 'hex-int-literal': [ - { pattern: /\b0[xX][0-9a-fA-F]+[iu]?(?!(?:\.|p|P))\b/, alias:'number' }, + { pattern: /\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/, alias:'number' }, ], - 'hex-float-literal': [ - { pattern: /0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+(?:[pP](?:\+|-)?[0-9]+[fh]?)?/, alias:'number' }, - { pattern: /0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*(?:[pP](?:\+|-)?[0-9]+[fh]?)?/, alias:'number' }, - { pattern: /0[xX][0-9a-fA-F]+[pP](?:\+|-)?[0-9]+[fh]?/, alias:'number' }, - ], - 'decimal-float-literal-a': [ - { pattern: /[0-9]*\.[0-9]+(?:[eE](?:\+|-)?[0-9]+)?[fh]?/, alias:'number' }, - { pattern: /[0-9]+\.[0-9]*(?:[eE](?:\+|-)?[0-9]+)?[fh]?/, alias:'number' }, - { pattern: /[0-9]+[eE](?:\+|-)?[0-9]+[fh]?/, alias:'number' }, - ], - 'decimal-float-literal-b': [ - { pattern: /0[fh]/, alias:'number' }, - { pattern: /[1-9][0-9]*[fh]/, alias:'number' }, - ], - 'int-literal': [ - { pattern: /0[iu]?/, alias:'number' }, - { pattern: /[1-9][0-9]*[iu]?/, alias:'number' }, + 'hex-float-literal': { + pattern: /0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/, alias:'number' + }, + 'decimal-float-literal': [ + { pattern: /[0-9]*(?:\.[0-9]*)?(?:[eE](?:\+|-)?[0-9]+)?[fh]?/, alias:'number' }, + { pattern: /\b\d+[fh]\b/, alias:'number' }, ], + 'int-literal': { + pattern: /\b\d+[iu]?\b/, + alias:'number' + }, 'operator': [ { pattern: /(?:\^|~|\||\|\||&&|<<|>>|!)(?!=)/ }, { pattern: /&(?![&=])/ }, From e2994e27c20e064a79246e003b41ebec96590d18 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Mon, 16 May 2022 21:30:30 +0200 Subject: [PATCH 13/31] Collapsed hex-int-literal --- components/prism-wgsl.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index e09e7a4d26..e8e541ee04 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -26,7 +26,7 @@ Prism.languages.wgsl = { }, 'built-in-values-fragment': { pattern: /\b(?:front_facing|frag_depth|sample_index|sample_mask)\b/, - alias: 'keyword' + alias: 'keyword', }, 'built-in-values-compute': { pattern: /\b(?:local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/, @@ -36,9 +36,10 @@ Prism.languages.wgsl = { pattern: /\b(?:true|false)\b/, alias: 'boolean', }, - 'hex-int-literal': [ - { pattern: /\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/, alias:'number' }, - ], + 'hex-int-literal': { + pattern: /\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/, + alias:'number', + }, 'hex-float-literal': { pattern: /0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/, alias:'number' }, @@ -48,7 +49,7 @@ Prism.languages.wgsl = { ], 'int-literal': { pattern: /\b\d+[iu]?\b/, - alias:'number' + alias:'number', }, 'operator': [ { pattern: /(?:\^|~|\||\|\||&&|<<|>>|!)(?!=)/ }, From 7ee4e6a94729ce98663be99b85686b4eed42f5f4 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Mon, 16 May 2022 21:35:07 +0200 Subject: [PATCH 14/31] Replaced [0-9] with \d --- components/prism-wgsl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index e8e541ee04..5b4230c217 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -44,7 +44,7 @@ Prism.languages.wgsl = { pattern: /0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/, alias:'number' }, 'decimal-float-literal': [ - { pattern: /[0-9]*(?:\.[0-9]*)?(?:[eE](?:\+|-)?[0-9]+)?[fh]?/, alias:'number' }, + { pattern: /\d*(?:\.\d*)?(?:[eE](?:\+|-)?\d+)?[fh]?/, alias:'number' }, { pattern: /\b\d+[fh]\b/, alias:'number' }, ], 'int-literal': { From 1a740f2fdeed7e6a5999c859c265d46d05e2ed20 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 02:02:36 +0200 Subject: [PATCH 15/31] Fixed: hex-float-literal matching in words, decimal-float-literal matching empty string and '||', '==' and '!=' operator matching --- components/prism-wgsl.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 5b4230c217..d1483930b3 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -41,10 +41,12 @@ Prism.languages.wgsl = { alias:'number', }, 'hex-float-literal': { - pattern: /0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/, alias:'number' + pattern: /\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/, alias:'number' }, 'decimal-float-literal': [ - { pattern: /\d*(?:\.\d*)?(?:[eE](?:\+|-)?\d+)?[fh]?/, alias:'number' }, + { pattern: /[0-9]*\.[0-9]+(?:[eE](?:\+|-)?[0-9]+)?[fh]?/, alias:'number' }, + { pattern: /[0-9]+\.[0-9]*(?:[eE](?:\+|-)?[0-9]+)?[fh]?/, alias:'number' }, + { pattern: /[0-9]+[eE](?:\+|-)?[0-9]+[fh]?/, alias:'number' }, { pattern: /\b\d+[fh]\b/, alias:'number' }, ], 'int-literal': { @@ -52,11 +54,11 @@ Prism.languages.wgsl = { alias:'number', }, 'operator': [ - { pattern: /(?:\^|~|\||\|\||&&|<<|>>|!)(?!=)/ }, + { pattern: /(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/ }, { pattern: /&(?![&=])/ }, { pattern: /(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/}, - { pattern: /(?])=(?!=|>)/ }, - { pattern: /(?:=(?:=)?(?!>)|!=|<=|(?=)/ }, + { pattern: /(?=!])=(?![=>])/ }, + { pattern: /(?:==|!=|<=|(?=)/ }, { pattern: /(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/ }, { pattern: /\.(?!\.)/ }, { pattern: /->/ }, From c89f1024b087e557d0200a11fda31de2fb216b72 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 02:10:22 +0200 Subject: [PATCH 16/31] Attributes now match only defined attributes, and alias changed to attr-name. built-in-value alias changed to attr-value --- components/prism-wgsl.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index d1483930b3..0047737406 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -4,9 +4,9 @@ Prism.languages.wgsl = { greedy: true, }, 'attributes': { - pattern: /(@)[_a-z]\w*/i, + pattern: /(@)(?:align|binding|builtin|const|group|id|interpolate|invariant|location|size|workgroup_size|vertex|fragment|compute)/i, lookbehind: true, - alias: 'important', + alias: 'attr-name', }, 'functions': { pattern: /\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/, @@ -22,15 +22,15 @@ Prism.languages.wgsl = { 'class-name': /\b(?:[A-Z][A-Za-z0-9]*)\b/, 'built-in-values-vertex': { pattern: /\b(?:vertex_index|instance_index|position)\b/, - alias: 'keyword', + alias: 'attr-value', }, 'built-in-values-fragment': { pattern: /\b(?:front_facing|frag_depth|sample_index|sample_mask)\b/, - alias: 'keyword', + alias: 'attr-value', }, 'built-in-values-compute': { pattern: /\b(?:local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/, - alias: 'keyword', + alias: 'attr-value', }, 'bool-literal': { pattern: /\b(?:true|false)\b/, From 8b5413511f10c3034a6dfdb4f467b8eabaec89b2 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 02:17:38 +0200 Subject: [PATCH 17/31] Updated test cases --- tests/languages/wgsl/attributes_feature.test | 75 ++++++++++++++ .../languages/wgsl/builtin_types_feature.test | 99 +++++++++++++++++++ .../wgsl/builtin_values_feature.test | 33 +++++++ tests/languages/wgsl/class_name_feature.test | 9 ++ tests/languages/wgsl/function_feature.test | 4 +- tests/languages/wgsl/keyword_feature.test | 38 +++---- tests/languages/wgsl/literal_feature.test | 20 ++-- tests/languages/wgsl/operator_feature.test | 67 +++++++++++++ tests/languages/wgsl/punctuation_feature.test | 25 +++++ tests/languages/wgsl/type_feature.test | 99 ------------------- 10 files changed, 334 insertions(+), 135 deletions(-) create mode 100644 tests/languages/wgsl/attributes_feature.test create mode 100644 tests/languages/wgsl/builtin_types_feature.test create mode 100644 tests/languages/wgsl/builtin_values_feature.test create mode 100644 tests/languages/wgsl/class_name_feature.test create mode 100644 tests/languages/wgsl/operator_feature.test create mode 100644 tests/languages/wgsl/punctuation_feature.test delete mode 100644 tests/languages/wgsl/type_feature.test diff --git a/tests/languages/wgsl/attributes_feature.test b/tests/languages/wgsl/attributes_feature.test new file mode 100644 index 0000000000..c39ad00694 --- /dev/null +++ b/tests/languages/wgsl/attributes_feature.test @@ -0,0 +1,75 @@ +@notAnAttribute +@align() +@binding() +@builtin() +@const +@group() +@id() +@interpolate() +@invariant +@location() +@size() +@workgroup_size() + +@vertex +@fragment +@compute + +---------------------------------------------------- + +[ + "@notAnAttribute\r\n@", + ["attributes", "align"], + ["punctuation", "("], + ["punctuation", ")"], + + "\r\n@", + ["attributes", "binding"], + ["punctuation", "("], + ["punctuation", ")"], + + "\r\n@", + ["attributes", "builtin"], + ["punctuation", "("], + ["punctuation", ")"], + + "\r\n@", + ["attributes", "const"], + + "\r\n@", + ["attributes", "group"], + ["punctuation", "("], + ["punctuation", ")"], + + "\r\n@", + ["attributes", "id"], + ["punctuation", "("], + ["punctuation", ")"], + + "\r\n@", + ["attributes", "interpolate"], + ["punctuation", "("], + ["punctuation", ")"], + + "\r\n@", + ["attributes", "invariant"], + + "\r\n@", + ["attributes", "location"], + ["punctuation", "("], + ["punctuation", ")"], + + "\r\n@", + ["attributes", "size"], + ["punctuation", "("], + ["punctuation", ")"], + + "\r\n@", + ["attributes", "workgroup_size"], + ["punctuation", "("], + ["punctuation", ")"], + + "\r\n\r\n@", ["attributes", "vertex"], + "\r\n@", ["attributes", "fragment"], + "\r\n@", ["attributes", "compute"] +] diff --git a/tests/languages/wgsl/builtin_types_feature.test b/tests/languages/wgsl/builtin_types_feature.test new file mode 100644 index 0000000000..21d173a109 --- /dev/null +++ b/tests/languages/wgsl/builtin_types_feature.test @@ -0,0 +1,99 @@ +bool +i32 +u32 +f32 +i64 +u64 +f64 +vec2 +vec3 +vec4 +mat2x2 +mat2x3 +mat2x4 +mat3x2 +mat3x3 +mat3x4 +mat4x2 +mat4x3 +mat4x4 + +atomic +array + +override +ptr + +sampler +sampler_comparison +staticAssert +struct + +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 +texture_depth_2d +texture_depth_2d_array +texture_depth_cube +texture_depth_cube_array +texture_depth_multisampled_2d + +---------------------------------------------------- + +[ + ["builtin", "bool"], + ["builtin", "i32"], + ["builtin", "u32"], + ["builtin", "f32"], + ["builtin", "i64"], + ["builtin", "u64"], + ["builtin", "f64"], + ["builtin", "vec2"], + ["builtin", "vec3"], + ["builtin", "vec4"], + ["builtin", "mat2x2"], + ["builtin", "mat2x3"], + ["builtin", "mat2x4"], + ["builtin", "mat3x2"], + ["builtin", "mat3x3"], + ["builtin", "mat3x4"], + ["builtin", "mat4x2"], + ["builtin", "mat4x3"], + ["builtin", "mat4x4"], + + ["builtin", "atomic"], + ["builtin", "array"], + + ["builtin", "override"], + ["builtin", "ptr"], + + ["builtin", "sampler"], + ["builtin", "sampler_comparison"], + ["builtin", "staticAssert"], + ["builtin", "struct"], + + ["builtin", "texture_1d"], + ["builtin", "texture_2d"], + ["builtin", "texture_2d_array"], + ["builtin", "texture_3d"], + ["builtin", "texture_cube"], + ["builtin", "texture_cube_array"], + ["builtin", "texture_multisampled_2d"], + ["builtin", "texture_storage_1d"], + ["builtin", "texture_storage_2d"], + ["builtin", "texture_storage_2d_array"], + ["builtin", "texture_storage_3d"], + ["builtin", "texture_depth_2d"], + ["builtin", "texture_depth_2d_array"], + ["builtin", "texture_depth_cube"], + ["builtin", "texture_depth_cube_array"], + ["builtin", "texture_depth_multisampled_2d"] +] diff --git a/tests/languages/wgsl/builtin_values_feature.test b/tests/languages/wgsl/builtin_values_feature.test new file mode 100644 index 0000000000..b038450b3e --- /dev/null +++ b/tests/languages/wgsl/builtin_values_feature.test @@ -0,0 +1,33 @@ +vertex_index +instance_index +position + +front_facing +frag_depth +sample_index +sample_mask + +local_invocation_id +local_invocation_index +global_invocation_id +workgroup_id +num_workgroups + +---------------------------------------------------- + +[ + ["built-in-values-vertex", "vertex_index"], + ["built-in-values-vertex", "instance_index"], + ["built-in-values-vertex", "position"], + + ["built-in-values-fragment", "front_facing"], + ["built-in-values-fragment", "frag_depth"], + ["built-in-values-fragment", "sample_index"], + ["built-in-values-fragment", "sample_mask"], + + ["built-in-values-compute", "local_invocation_id"], + ["built-in-values-compute", "local_invocation_index"], + ["built-in-values-compute", "global_invocation_id"], + ["built-in-values-compute", "workgroup_id"], + ["built-in-values-compute", "num_workgroups"] +] diff --git a/tests/languages/wgsl/class_name_feature.test b/tests/languages/wgsl/class_name_feature.test new file mode 100644 index 0000000000..ed13952abd --- /dev/null +++ b/tests/languages/wgsl/class_name_feature.test @@ -0,0 +1,9 @@ +ClassName +notAClassName + +---------------------------------------------------- + +[ + ["class-name", "ClassName"], + "\r\nnotAClassName" +] diff --git a/tests/languages/wgsl/function_feature.test b/tests/languages/wgsl/function_feature.test index 0b6ed8af74..fbefb16bff 100644 --- a/tests/languages/wgsl/function_feature.test +++ b/tests/languages/wgsl/function_feature.test @@ -6,11 +6,11 @@ fn my_function() -> bool { [ ["keyword", "fn"], - ["functions", [" my_function"]], + ["functions", "my_function"], ["punctuation", "("], ["punctuation", ")"], ["operator", "->"], - ["types", "bool"], + ["builtin", "bool"], ["punctuation", "{"], ["keyword", "return"], diff --git a/tests/languages/wgsl/keyword_feature.test b/tests/languages/wgsl/keyword_feature.test index cb4f5fa884..c0e2b162f6 100644 --- a/tests/languages/wgsl/keyword_feature.test +++ b/tests/languages/wgsl/keyword_feature.test @@ -1,6 +1,7 @@ bitcast break case +const continue continuing default @@ -8,29 +9,21 @@ discard else enable fallthrough +fn for function if +let loop private -read -read_write return storage switch +type uniform -workgroup -write - -const -handle -mat -vec -void -while -let var -fn +while +workgroup ---------------------------------------------------- @@ -38,6 +31,7 @@ fn ["keyword", "bitcast"], ["keyword", "break"], ["keyword", "case"], + ["keyword", "const"], ["keyword", "continue"], ["keyword", "continuing"], ["keyword", "default"], @@ -45,27 +39,19 @@ fn ["keyword", "else"], ["keyword", "enable"], ["keyword", "fallthrough"], + ["keyword", "fn"], ["keyword", "for"], ["keyword", "function"], ["keyword", "if"], + ["keyword", "let"], ["keyword", "loop"], ["keyword", "private"], - ["keyword", "read"], - ["keyword", "read_write"], ["keyword", "return"], ["keyword", "storage"], ["keyword", "switch"], + ["keyword", "type"], ["keyword", "uniform"], - ["keyword", "workgroup"], - ["keyword", "write"], - - ["keyword", "const"], - ["keyword", "handle"], - ["keyword", "mat"], - ["keyword", "vec"], - ["keyword", "void"], - ["keyword", "while"], - ["keyword", "let"], ["keyword", "var"], - ["keyword", "fn"] + ["keyword", "while"], + ["keyword", "workgroup"] ] diff --git a/tests/languages/wgsl/literal_feature.test b/tests/languages/wgsl/literal_feature.test index d9043d3c3a..de51e32cba 100644 --- a/tests/languages/wgsl/literal_feature.test +++ b/tests/languages/wgsl/literal_feature.test @@ -23,6 +23,8 @@ true false +notALiteral20x3f + ---------------------------------------------------- [ @@ -34,13 +36,13 @@ false ["int-literal", "0i"], ["hex-int-literal", "0x3f"], - ["decimal-float-literal-a", "0.e+4f"], - ["decimal-float-literal-a", "01."], - ["decimal-float-literal-a", ".01"], - ["decimal-float-literal-a", "12.34"], - ["decimal-float-literal-a", ".0f"], - ["decimal-float-literal-b", "0h"], - ["decimal-float-literal-a", "1e-3"], + ["decimal-float-literal", "0.e+4f"], + ["decimal-float-literal", "01."], + ["decimal-float-literal", ".01"], + ["decimal-float-literal", "12.34"], + ["decimal-float-literal", ".0f"], + ["decimal-float-literal", "0h"], + ["decimal-float-literal", "1e-3"], ["hex-float-literal", "0xa.fp+2"], ["hex-float-literal", "0x1P+4f"], ["hex-float-literal", "0X.3"], @@ -49,5 +51,7 @@ false ["hex-float-literal", "0x3.2p+2h"], ["bool-literal", "true"], - ["bool-literal", "false"] + ["bool-literal", "false"], + + "\r\n\r\nnotALiteral20x3f" ] diff --git a/tests/languages/wgsl/operator_feature.test b/tests/languages/wgsl/operator_feature.test new file mode 100644 index 0000000000..69fea246a9 --- /dev/null +++ b/tests/languages/wgsl/operator_feature.test @@ -0,0 +1,67 @@ +^ +~ +| +|| +&& +<< +>> +! +& ++= +-= +*= +/= +%= +^= +&= +|= +<<= +>>= += +== +!= +<= +>= ++ +% +* +- +/ +. +-> + +---------------------------------------------------- + +[ + ["operator", "^"], + ["operator", "~"], + ["operator", "|"], + ["operator", "||"], + ["operator", "&&"], + ["operator", "<<"], + ["operator", ">>"], + ["operator", "!"], + ["operator", "&"], + ["operator", "+="], + ["operator", "-="], + ["operator", "*="], + ["operator", "/="], + ["operator", "%="], + ["operator", "^="], + ["operator", "&="], + ["operator", "|="], + ["operator", "<<="], + ["operator", ">>="], + ["operator", "="], + ["operator", "=="], + ["operator", "!="], + ["operator", "<="], + ["operator", ">="], + ["operator", "+"], + ["operator", "%"], + ["operator", "*"], + ["operator", "-"], + ["operator", "/"], + ["operator", "."], + ["operator", "->"] +] diff --git a/tests/languages/wgsl/punctuation_feature.test b/tests/languages/wgsl/punctuation_feature.test new file mode 100644 index 0000000000..97316c30ba --- /dev/null +++ b/tests/languages/wgsl/punctuation_feature.test @@ -0,0 +1,25 @@ +( +) +{ +} +[ +] +, +; +< +> + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", ","], + ["punctuation", ";"], + ["punctuation", "<"], + ["punctuation", ">"] +] diff --git a/tests/languages/wgsl/type_feature.test b/tests/languages/wgsl/type_feature.test deleted file mode 100644 index 0ff4fc7aa2..0000000000 --- a/tests/languages/wgsl/type_feature.test +++ /dev/null @@ -1,99 +0,0 @@ -bool -i32 -u32 -f32 -i64 -u64 -f64 -vec2 -vec3 -vec4 -mat2x2 -mat2x3 -mat2x4 -mat3x2 -mat3x3 -mat3x4 -mat4x2 -mat4x3 -mat4x4 - -atomic -array - -override -ptr - -sampler -sampler_comparison -staticAssert -struct - -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 -texture_depth_2d -texture_depth_2d_array -texture_depth_cube -texture_depth_cube_array -texture_depth_multisampled_2d - ----------------------------------------------------- - -[ - ["types", "bool"], - ["types", "i32"], - ["types", "u32"], - ["types", "f32"], - ["types", "i64"], - ["types", "u64"], - ["types", "f64"], - ["types", "vec2"], - ["types", "vec3"], - ["types", "vec4"], - ["types", "mat2x2"], - ["types", "mat2x3"], - ["types", "mat2x4"], - ["types", "mat3x2"], - ["types", "mat3x3"], - ["types", "mat3x4"], - ["types", "mat4x2"], - ["types", "mat4x3"], - ["types", "mat4x4"], - - ["types", "atomic"], - ["types", "array"], - - ["types", "override"], - ["types", "ptr"], - - ["types", "sampler"], - ["types", "sampler_comparison"], - ["types", "staticAssert"], - ["types", "struct"], - - ["types", "texture_1d"], - ["types", "texture_2d"], - ["types", "texture_2d_array"], - ["types", "texture_3d"], - ["types", "texture_cube"], - ["types", "texture_cube_array"], - ["types", "texture_multisampled_2d"], - ["types", "texture_storage_1d"], - ["types", "texture_storage_2d"], - ["types", "texture_storage_2d_array"], - ["types", "texture_storage_3d"], - ["types", "texture_depth_2d"], - ["types", "texture_depth_2d_array"], - ["types", "texture_depth_cube"], - ["types", "texture_depth_cube_array"], - ["types", "texture_depth_multisampled_2d"] -] From 3fec7095d2637def039564c9ad2f3e08684f3301 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 02:22:24 +0200 Subject: [PATCH 18/31] Rebuild --- components/prism-wgsl.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-wgsl.min.js b/components/prism-wgsl.min.js index b1cf94a2d4..e7327a8b32 100644 --- a/components/prism-wgsl.min.js +++ b/components/prism-wgsl.min.js @@ -1 +1 @@ -Prism.languages.wgsl={comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},attributes:{pattern:/(@)(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))/u,lookbehind:!0,alias:"symbol"},functions:{pattern:/\b(fn)\s+(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))(?=(?:\()|(?:<))/u,lookbehind:!0,alias:"function",inside:{}},keyword:[{pattern:/\b(?:bitcast|block|break|case|continue|continuing|default|discard|else|elseif|enable|fallthrough|for|function|if|loop|private|read|read_write|return|storage|switch|uniform|workgroup|write)\b/},{pattern:/\b(?:asm|const|do|enum|handle|mat|premerge|regardless|typedef|unless|using|vec|void|while)\b/},{pattern:/\b(?:let|var)\b/},{pattern:/\b(?:type)\b/},{pattern:/\b(?:enum)\b/},{pattern:/\bfn\b/}],"function-calls":{pattern:/(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))(?=\()/u,alias:"function",inside:{}},types:[{pattern:/\b(?:bool|i32|u32|f32)\b/,alias:"builtin"},{pattern:/\b(?:i64|u64|f64)\b/,alias:"builtin"},{pattern:/\b(?:vec[2-4]|mat[2-4]x[2-4])\b/,alias:"builtin"},{pattern:/\b(?:atomic)\b/,alias:"builtin"},{pattern:/\b(?:array)\b/,alias:"builtin"},{pattern:/\b(?:override|ptr|sampler|sampler_comparison|staticAssert|struct)\b/,alias:"builtin"},{pattern:/\b(?:texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array|texture_multisampled_2d)\b/,alias:"builtin"},{pattern:/\b(?:texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d|texture_depth_2d)\b/,alias:"builtin"},{pattern:/\b(?:texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/,alias:"builtin"},{pattern:/\b(?:[A-Z][A-Za-z0-9]*)\b/,alias:"class-name"}],"built-in-values":[{pattern:/\b(?:vertex_index|instance_index|position)\b/,alias:"namespace"},{pattern:/\b(?:front_facing|frag_depth|sample_index|sample_mask)\b/,alias:"namespace"},{pattern:/\b(?:local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/,alias:"namespace"}],"bool-literal":{pattern:/\b(?:true|false)\b/,alias:"boolean"},"hex-int-literal":[{pattern:/\b0[xX][0-9a-fA-F]+[iu]?(?!(?:\.|p|P))\b/,alias:"number"}],"hex-float-literal":[{pattern:/0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+(?:[pP](?:\+|-)?[0-9]+[fh]?)?/,alias:"number"},{pattern:/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*(?:[pP](?:\+|-)?[0-9]+[fh]?)?/,alias:"number"},{pattern:/0[xX][0-9a-fA-F]+[pP](?:\+|-)?[0-9]+[fh]?/,alias:"number"}],"decimal-float-literal-a":[{pattern:/[0-9]*\.[0-9]+(?:[eE](?:\+|-)?[0-9]+)?[fh]?/,alias:"number"},{pattern:/[0-9]+\.[0-9]*(?:[eE](?:\+|-)?[0-9]+)?[fh]?/,alias:"number"},{pattern:/[0-9]+[eE](?:\+|-)?[0-9]+[fh]?/,alias:"number"}],variables:{pattern:/\b(?:(?:[_\p{XID_Start}][\p{XID_Continue}]+)|(?:[\p{XID_Start}]))\b/u,alias:"variable"},"decimal-float-literal-b":[{pattern:/0[fh]/,alias:"number"},{pattern:/[1-9][0-9]*[fh]/,alias:"number"}],"int-literal":[{pattern:/0[iu]?/,alias:"number"},{pattern:/[1-9][0-9]*[iu]?/,alias:"number"}],operator:[{pattern:/(?:\^|~|\||\|\||&&|<<|>>|!)(?!=)/},{pattern:/&(?![&=])/},{pattern:/(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/},{pattern:/(?])=(?!=|>)/},{pattern:/(?:=(?:=)?(?!>)|!=|<=|(?=)/},{pattern:/(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/},{pattern:/\.(?!\.)/},{pattern:/->/}],punctuation:[{pattern:/,/},{pattern:/[{}]/},{pattern:/[\(\)]/},{pattern:/;/},{pattern:/[\[\]]/},{pattern:/(?]/}]}; \ No newline at end of file +Prism.languages.wgsl={comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},attributes:{pattern:/(@)(?:align|binding|builtin|const|group|id|interpolate|invariant|location|size|workgroup_size|vertex|fragment|compute)/i,lookbehind:!0,alias:"attr-name"},functions:{pattern:/\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/,lookbehind:!0,alias:"function"},keyword:/\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|switch|type|uniform|var|while|workgroup)\b/,"function-calls":{pattern:/\b[_a-z]\w*(?=\()/i,alias:"function"},builtin:/\b(?:array|atomic|bool|i32|u32|f32|i64|u64|f64|vec[2-4]|mat[2-4]x[2-4]|override|ptr|sampler|sampler_comparison|staticAssert|struct|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|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/,"class-name":/\b(?:[A-Z][A-Za-z0-9]*)\b/,"built-in-values-vertex":{pattern:/\b(?:vertex_index|instance_index|position)\b/,alias:"attr-value"},"built-in-values-fragment":{pattern:/\b(?:front_facing|frag_depth|sample_index|sample_mask)\b/,alias:"attr-value"},"built-in-values-compute":{pattern:/\b(?:local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/,alias:"attr-value"},"bool-literal":{pattern:/\b(?:true|false)\b/,alias:"boolean"},"hex-int-literal":{pattern:/\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/,alias:"number"},"hex-float-literal":{pattern:/\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/,alias:"number"},"decimal-float-literal":[{pattern:/[0-9]*\.[0-9]+(?:[eE](?:\+|-)?[0-9]+)?[fh]?/,alias:"number"},{pattern:/[0-9]+\.[0-9]*(?:[eE](?:\+|-)?[0-9]+)?[fh]?/,alias:"number"},{pattern:/[0-9]+[eE](?:\+|-)?[0-9]+[fh]?/,alias:"number"},{pattern:/\b\d+[fh]\b/,alias:"number"}],"int-literal":{pattern:/\b\d+[iu]?\b/,alias:"number"},operator:[{pattern:/(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/},{pattern:/&(?![&=])/},{pattern:/(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/},{pattern:/(?=!])=(?![=>])/},{pattern:/(?:==|!=|<=|(?=)/},{pattern:/(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/},{pattern:/\.(?!\.)/},{pattern:/->/}],punctuation:/[(){}[\],;<>]/}; \ No newline at end of file From bcb8f4f25d55ef861084915a933cff1531346316 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 14:17:11 +0200 Subject: [PATCH 19/31] Match built-ins before function calls --- components/prism-wgsl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 0047737406..15b2a8c0d7 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -14,11 +14,11 @@ Prism.languages.wgsl = { alias: 'function', }, 'keyword': /\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|switch|type|uniform|var|while|workgroup)\b/, + 'builtin': /\b(?:array|atomic|bool|i32|u32|f32|i64|u64|f64|vec[2-4]|mat[2-4]x[2-4]|override|ptr|sampler|sampler_comparison|staticAssert|struct|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|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/, 'function-calls': { pattern: /\b[_a-z]\w*(?=\()/i, alias: 'function', }, - 'builtin': /\b(?:array|atomic|bool|i32|u32|f32|i64|u64|f64|vec[2-4]|mat[2-4]x[2-4]|override|ptr|sampler|sampler_comparison|staticAssert|struct|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|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/, 'class-name': /\b(?:[A-Z][A-Za-z0-9]*)\b/, 'built-in-values-vertex': { pattern: /\b(?:vertex_index|instance_index|position)\b/, From 0832006c30ac50fcfa6dddb403d1066fbce97a8b Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 14:18:21 +0200 Subject: [PATCH 20/31] Add missing function-calls test in function feature test --- tests/languages/wgsl/function_feature.test | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/languages/wgsl/function_feature.test b/tests/languages/wgsl/function_feature.test index fbefb16bff..f60b075d15 100644 --- a/tests/languages/wgsl/function_feature.test +++ b/tests/languages/wgsl/function_feature.test @@ -1,4 +1,5 @@ fn my_function() -> bool { + my_function(); return true; } @@ -13,6 +14,10 @@ fn my_function() -> bool { ["builtin", "bool"], ["punctuation", "{"], + ["function-calls", "my_function"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], ["keyword", "return"], ["bool-literal", "true"], ["punctuation", ";"], From 47a34c544b30ba1a1085b45ff8edc577f787b133 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 14:28:41 +0200 Subject: [PATCH 21/31] Move struct from builtins to keywords --- components/prism-wgsl.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 15b2a8c0d7..985935d1f4 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -13,8 +13,9 @@ Prism.languages.wgsl = { lookbehind: true, alias: 'function', }, - 'keyword': /\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|switch|type|uniform|var|while|workgroup)\b/, - 'builtin': /\b(?:array|atomic|bool|i32|u32|f32|i64|u64|f64|vec[2-4]|mat[2-4]x[2-4]|override|ptr|sampler|sampler_comparison|staticAssert|struct|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|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/, + 'keyword': /\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|struct|switch|type|uniform|var|while|workgroup)\b/, + 'builtin': /\b(?:array|atomic|bool|i32|u32|f32|i64|u64|f64|vec[2-4]|mat[2-4]x[2-4]|override|ptr|sampler|sampler_comparison|staticAssert|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|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/, + 'builtin-functions': /./, 'function-calls': { pattern: /\b[_a-z]\w*(?=\()/i, alias: 'function', From 60e44682a7313208bd3c366f2fe26a891cb89cc1 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 14:51:22 +0200 Subject: [PATCH 22/31] Added missing built-in functions --- components/prism-wgsl.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 985935d1f4..48ec46db2c 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -14,8 +14,7 @@ Prism.languages.wgsl = { alias: 'function', }, 'keyword': /\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|struct|switch|type|uniform|var|while|workgroup)\b/, - 'builtin': /\b(?:array|atomic|bool|i32|u32|f32|i64|u64|f64|vec[2-4]|mat[2-4]x[2-4]|override|ptr|sampler|sampler_comparison|staticAssert|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|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/, - 'builtin-functions': /./, + 'builtin': /\b(?:array|atomic|bool|i32|u32|f32|i64|u64|f64|vec[2-4]|mat[2-4]x[2-4]|override|ptr|sampler|sampler_comparison|staticAssert|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|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d|all|any|select|abs|acos|acosh|asin|asinh|atan|atanh|atan2|ceil|clamp|cos|cosh|cross|degrees|distance|exp|exp2|faceForward|floor|fma|fract|frexp|inverseSqrt|ldexp|length|log|log2|max|min|mix|modf|normalize|pow|quantizeToF16|radians|reflect|refract|round|sign|sin|sinh|smoothstep|sqrt|step|tan|tanh|trunc|countLeadingZeros|countOneBits|countTrailingZeros|firstLeadingBit|extractBits|insertBits|reverseBits|shiftLeft|shiftRight|determinant|transpose|dot|dpdx|dpdxCoarse|dpdxFine|dpdy|dpdyCoarse|dpdyFine|fwidth|fwidthCoarse|fwidthFine|textureDimensions|textureGather|textureGatherCompare|textureLoad|textureNumLayers|textureNumLevels|textureNumSamples|textureSample|textureSampleBias|textureSampleCompare|textureSampleCompareLevel|textureSampleGrad|textureSampleLevel|textureStore|atomicLoad|atomicStore|atomicAdd|atomicSub|atomicMax|atomicMin|atomicAnd|atomicOr|atomicXor|atomicExchange|atomicCompareExchangeWeak|pack4x8snorm|pack4x8unorm|pack2x16snorm|pack2x16unorm|pack2x16float|unpack4x8snorm|unpack4x8unorm|unpack2x16snorm|unpack2x16unorm|unpack2x16float|storageBarrier|workgroupBarrier)\b/, 'function-calls': { pattern: /\b[_a-z]\w*(?=\()/i, alias: 'function', From 541976eda33acaec6bba70cbd1c2557ece5a09b2 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 19:58:22 +0200 Subject: [PATCH 23/31] Treat '@', ':' and '.' and punctuation --- components/prism-wgsl.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 48ec46db2c..76801a34af 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -60,8 +60,7 @@ Prism.languages.wgsl = { { pattern: /(?=!])=(?![=>])/ }, { pattern: /(?:==|!=|<=|(?=)/ }, { pattern: /(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/ }, - { pattern: /\.(?!\.)/ }, { pattern: /->/ }, ], - 'punctuation': /[(){}[\],;<>]/, + 'punctuation': /[@(){}[\],;<>:.]/, }; From 5fc8a408e860513ba783248dcfcbbcb7b7e9f923 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 20:10:48 +0200 Subject: [PATCH 24/31] Add '++' and '--' operators --- components/prism-wgsl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 76801a34af..51fd0f9852 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -58,7 +58,7 @@ Prism.languages.wgsl = { { pattern: /&(?![&=])/ }, { pattern: /(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/}, { pattern: /(?=!])=(?![=>])/ }, - { pattern: /(?:==|!=|<=|(?=)/ }, + { pattern: /(?:==|!=|<=|\+\+|--|(?=)/ }, { pattern: /(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/ }, { pattern: /->/ }, ], From f804f5b03b6f48a475566df1dad533ca27941650 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 20:30:50 +0200 Subject: [PATCH 25/31] Updated test cases --- tests/languages/wgsl/attributes_feature.test | 33 +-- .../languages/wgsl/builtin_types_feature.test | 228 +++++++++++++++++- tests/languages/wgsl/keyword_feature.test | 2 + tests/languages/wgsl/operator_feature.test | 6 +- tests/languages/wgsl/punctuation_feature.test | 8 +- 5 files changed, 257 insertions(+), 20 deletions(-) diff --git a/tests/languages/wgsl/attributes_feature.test b/tests/languages/wgsl/attributes_feature.test index c39ad00694..15c9a86b1f 100644 --- a/tests/languages/wgsl/attributes_feature.test +++ b/tests/languages/wgsl/attributes_feature.test @@ -18,58 +18,63 @@ ---------------------------------------------------- [ - "@notAnAttribute\r\n@", + ["punctuation", "@"], + "notAnAttribute\r\n", + ["punctuation", "@"], ["attributes", "align"], ["punctuation", "("], ["punctuation", ")"], - "\r\n@", + ["punctuation", "@"], ["attributes", "binding"], ["punctuation", "("], ["punctuation", ")"], - "\r\n@", + ["punctuation", "@"], ["attributes", "builtin"], ["punctuation", "("], ["punctuation", ")"], - "\r\n@", + ["punctuation", "@"], ["attributes", "const"], - "\r\n@", + ["punctuation", "@"], ["attributes", "group"], ["punctuation", "("], ["punctuation", ")"], - "\r\n@", + ["punctuation", "@"], ["attributes", "id"], ["punctuation", "("], ["punctuation", ")"], - "\r\n@", + ["punctuation", "@"], ["attributes", "interpolate"], ["punctuation", "("], ["punctuation", ")"], - "\r\n@", + ["punctuation", "@"], ["attributes", "invariant"], - "\r\n@", + ["punctuation", "@"], ["attributes", "location"], ["punctuation", "("], ["punctuation", ")"], - "\r\n@", + ["punctuation", "@"], ["attributes", "size"], ["punctuation", "("], ["punctuation", ")"], - "\r\n@", + ["punctuation", "@"], ["attributes", "workgroup_size"], ["punctuation", "("], ["punctuation", ")"], - "\r\n\r\n@", ["attributes", "vertex"], - "\r\n@", ["attributes", "fragment"], - "\r\n@", ["attributes", "compute"] + ["punctuation", "@"], + ["attributes", "vertex"], + ["punctuation", "@"], + ["attributes", "fragment"], + ["punctuation", "@"], + ["attributes", "compute"] ] diff --git a/tests/languages/wgsl/builtin_types_feature.test b/tests/languages/wgsl/builtin_types_feature.test index 21d173a109..ac8d2733e9 100644 --- a/tests/languages/wgsl/builtin_types_feature.test +++ b/tests/languages/wgsl/builtin_types_feature.test @@ -27,7 +27,6 @@ ptr sampler sampler_comparison staticAssert -struct texture_1d texture_2d @@ -46,6 +45,117 @@ texture_depth_cube texture_depth_cube_array texture_depth_multisampled_2d +staticAssert() + +all +any +select +abs +acos +acosh +asin +asinh +atan +atanh +atan2 +ceil +clamp +cos +cosh +cross +degrees +distance +exp +exp2 +faceForward +floor +fma +fract +frexp +inverseSqrt +ldexp +length +log +log2 +max +min +mix +modf +normalize +pow +quantizeToF16 +radians +reflect +refract +round +sign +sin +sinh +smoothstep +sqrt +step +tan +tanh +trunc +countLeadingZeros +countOneBits +countTrailingZeros +firstLeadingBit +extractBits +insertBits +reverseBits +shiftLeft +shiftRight +determinant +transpose +dot +dpdx +dpdxCoarse +dpdxFine +dpdy +dpdyCoarse +dpdyFine +fwidth +fwidthCoarse +fwidthFine +textureDimensions +textureGather +textureGatherCompare +textureLoad +textureNumLayers +textureNumLevels +textureNumSamples +textureSample +textureSampleBias +textureSampleCompare +textureSampleCompareLevel +textureSampleGrad +textureSampleLevel +textureStore +atomicLoad +atomicStore +atomicAdd +atomicSub +atomicMax +atomicMin +atomicAnd +atomicOr +atomicXor +atomicExchange +atomicCompareExchangeWeak +pack4x8snorm +pack4x8unorm +pack2x16snorm +pack2x16unorm +pack2x16float +unpack4x8snorm +unpack4x8unorm +unpack2x16snorm +unpack2x16unorm +unpack2x16float +storageBarrier +workgroupBarrier + ---------------------------------------------------- [ @@ -78,7 +188,6 @@ texture_depth_multisampled_2d ["builtin", "sampler"], ["builtin", "sampler_comparison"], ["builtin", "staticAssert"], - ["builtin", "struct"], ["builtin", "texture_1d"], ["builtin", "texture_2d"], @@ -95,5 +204,118 @@ texture_depth_multisampled_2d ["builtin", "texture_depth_2d_array"], ["builtin", "texture_depth_cube"], ["builtin", "texture_depth_cube_array"], - ["builtin", "texture_depth_multisampled_2d"] + ["builtin", "texture_depth_multisampled_2d"], + + ["builtin", "staticAssert"], + ["punctuation", "("], + ["punctuation", ")"], + + ["builtin", "all"], + ["builtin", "any"], + ["builtin", "select"], + ["builtin", "abs"], + ["builtin", "acos"], + ["builtin", "acosh"], + ["builtin", "asin"], + ["builtin", "asinh"], + ["builtin", "atan"], + ["builtin", "atanh"], + ["builtin", "atan2"], + ["builtin", "ceil"], + ["builtin", "clamp"], + ["builtin", "cos"], + ["builtin", "cosh"], + ["builtin", "cross"], + ["builtin", "degrees"], + ["builtin", "distance"], + ["builtin", "exp"], + ["builtin", "exp2"], + ["builtin", "faceForward"], + ["builtin", "floor"], + ["builtin", "fma"], + ["builtin", "fract"], + ["builtin", "frexp"], + ["builtin", "inverseSqrt"], + ["builtin", "ldexp"], + ["builtin", "length"], + ["builtin", "log"], + ["builtin", "log2"], + ["builtin", "max"], + ["builtin", "min"], + ["builtin", "mix"], + ["builtin", "modf"], + ["builtin", "normalize"], + ["builtin", "pow"], + ["builtin", "quantizeToF16"], + ["builtin", "radians"], + ["builtin", "reflect"], + ["builtin", "refract"], + ["builtin", "round"], + ["builtin", "sign"], + ["builtin", "sin"], + ["builtin", "sinh"], + ["builtin", "smoothstep"], + ["builtin", "sqrt"], + ["builtin", "step"], + ["builtin", "tan"], + ["builtin", "tanh"], + ["builtin", "trunc"], + ["builtin", "countLeadingZeros"], + ["builtin", "countOneBits"], + ["builtin", "countTrailingZeros"], + ["builtin", "firstLeadingBit"], + ["builtin", "extractBits"], + ["builtin", "insertBits"], + ["builtin", "reverseBits"], + ["builtin", "shiftLeft"], + ["builtin", "shiftRight"], + ["builtin", "determinant"], + ["builtin", "transpose"], + ["builtin", "dot"], + ["builtin", "dpdx"], + ["builtin", "dpdxCoarse"], + ["builtin", "dpdxFine"], + ["builtin", "dpdy"], + ["builtin", "dpdyCoarse"], + ["builtin", "dpdyFine"], + ["builtin", "fwidth"], + ["builtin", "fwidthCoarse"], + ["builtin", "fwidthFine"], + ["builtin", "textureDimensions"], + ["builtin", "textureGather"], + ["builtin", "textureGatherCompare"], + ["builtin", "textureLoad"], + ["builtin", "textureNumLayers"], + ["builtin", "textureNumLevels"], + ["builtin", "textureNumSamples"], + ["builtin", "textureSample"], + ["builtin", "textureSampleBias"], + ["builtin", "textureSampleCompare"], + ["builtin", "textureSampleCompareLevel"], + ["builtin", "textureSampleGrad"], + ["builtin", "textureSampleLevel"], + ["builtin", "textureStore"], + ["builtin", "atomicLoad"], + ["builtin", "atomicStore"], + ["builtin", "atomicAdd"], + ["builtin", "atomicSub"], + ["builtin", "atomicMax"], + ["builtin", "atomicMin"], + ["builtin", "atomicAnd"], + ["builtin", "atomicOr"], + ["builtin", "atomicXor"], + ["builtin", "atomicExchange"], + ["builtin", "atomicCompareExchangeWeak"], + ["builtin", "pack4x8snorm"], + ["builtin", "pack4x8unorm"], + ["builtin", "pack2x16snorm"], + ["builtin", "pack2x16unorm"], + ["builtin", "pack2x16float"], + ["builtin", "unpack4x8snorm"], + ["builtin", "unpack4x8unorm"], + ["builtin", "unpack2x16snorm"], + ["builtin", "unpack2x16unorm"], + ["builtin", "unpack2x16float"], + ["builtin", "storageBarrier"], + ["builtin", "workgroupBarrier"] ] diff --git a/tests/languages/wgsl/keyword_feature.test b/tests/languages/wgsl/keyword_feature.test index c0e2b162f6..f42ea39df6 100644 --- a/tests/languages/wgsl/keyword_feature.test +++ b/tests/languages/wgsl/keyword_feature.test @@ -18,6 +18,7 @@ loop private return storage +struct switch type uniform @@ -48,6 +49,7 @@ workgroup ["keyword", "private"], ["keyword", "return"], ["keyword", "storage"], + ["keyword", "struct"], ["keyword", "switch"], ["keyword", "type"], ["keyword", "uniform"], diff --git a/tests/languages/wgsl/operator_feature.test b/tests/languages/wgsl/operator_feature.test index 69fea246a9..c7f51e192c 100644 --- a/tests/languages/wgsl/operator_feature.test +++ b/tests/languages/wgsl/operator_feature.test @@ -23,11 +23,12 @@ <= >= + +++ % * - +-- / -. -> ---------------------------------------------------- @@ -58,10 +59,11 @@ ["operator", "<="], ["operator", ">="], ["operator", "+"], + ["operator", "++"], ["operator", "%"], ["operator", "*"], ["operator", "-"], + ["operator", "--"], ["operator", "/"], - ["operator", "."], ["operator", "->"] ] diff --git a/tests/languages/wgsl/punctuation_feature.test b/tests/languages/wgsl/punctuation_feature.test index 97316c30ba..d1a9746818 100644 --- a/tests/languages/wgsl/punctuation_feature.test +++ b/tests/languages/wgsl/punctuation_feature.test @@ -1,3 +1,4 @@ +@ ( ) { @@ -8,10 +9,13 @@ ; < > +: +. ---------------------------------------------------- [ + ["punctuation", "@"], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "{"], @@ -21,5 +25,7 @@ ["punctuation", ","], ["punctuation", ";"], ["punctuation", "<"], - ["punctuation", ">"] + ["punctuation", ">"], + ["punctuation", ":"], + ["punctuation", "."] ] From 732be46e65d923ebb13eb074c5fb6c95fe6116c7 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 20:40:34 +0200 Subject: [PATCH 26/31] Replace lookbehinds --- components/prism-wgsl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 51fd0f9852..5cebdecebc 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -57,8 +57,8 @@ Prism.languages.wgsl = { { pattern: /(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/ }, { pattern: /&(?![&=])/ }, { pattern: /(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/}, - { pattern: /(?=!])=(?![=>])/ }, - { pattern: /(?:==|!=|<=|\+\+|--|(?=)/ }, + { pattern: /(^|[^<>=!])=(?![=>])/, lookbehind: true }, + { pattern: /(?:==|!=|<=|\+\+|--|(^|[^=])>=)/, lookbehind: true }, { pattern: /(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/ }, { pattern: /->/ }, ], From 0252621932ca2f93cf94a8cf06fa71ce6b780ccb Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 21:37:59 +0200 Subject: [PATCH 27/31] Math built-in-values only in the 'builtin' attribute and update test cases --- components/prism-wgsl.js | 21 +-- tests/languages/wgsl/attributes_feature.test | 151 +++++++++++++++--- .../wgsl/builtin_values_feature.test | 33 ---- 3 files changed, 140 insertions(+), 65 deletions(-) delete mode 100644 tests/languages/wgsl/builtin_values_feature.test diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 5cebdecebc..5ea9a419eb 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -4,9 +4,16 @@ Prism.languages.wgsl = { greedy: true, }, 'attributes': { - pattern: /(@)(?:align|binding|builtin|const|group|id|interpolate|invariant|location|size|workgroup_size|vertex|fragment|compute)/i, + pattern: /(@)(?:align|binding|builtin\(.*\)|const|group|id|interpolate|invariant|location|size|workgroup_size|vertex|fragment|compute)/i, lookbehind: true, alias: 'attr-name', + inside: { + 'built-in-values': { + pattern: /\b(?:vertex_index|instance_index|position|front_facing|frag_depth|sample_index|sample_mask|local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/, + alias: 'attr-value' + }, + 'punctuation': /[()]/, + }, }, 'functions': { pattern: /\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/, @@ -20,18 +27,6 @@ Prism.languages.wgsl = { alias: 'function', }, 'class-name': /\b(?:[A-Z][A-Za-z0-9]*)\b/, - 'built-in-values-vertex': { - pattern: /\b(?:vertex_index|instance_index|position)\b/, - alias: 'attr-value', - }, - 'built-in-values-fragment': { - pattern: /\b(?:front_facing|frag_depth|sample_index|sample_mask)\b/, - alias: 'attr-value', - }, - 'built-in-values-compute': { - pattern: /\b(?:local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/, - alias: 'attr-value', - }, 'bool-literal': { pattern: /\b(?:true|false)\b/, alias: 'boolean', diff --git a/tests/languages/wgsl/attributes_feature.test b/tests/languages/wgsl/attributes_feature.test index 15c9a86b1f..f7ab5f1668 100644 --- a/tests/languages/wgsl/attributes_feature.test +++ b/tests/languages/wgsl/attributes_feature.test @@ -1,7 +1,24 @@ @notAnAttribute @align() @binding() + @builtin() + +@builtin(vertex_index) +@builtin(instance_index) +@builtin(position) + +@builtin(front_facing) +@builtin(frag_depth) +@builtin(sample_index) +@builtin(sample_mask) + +@builtin(local_invocation_id) +@builtin(local_invocation_index) +@builtin(global_invocation_id) +@builtin(workgroup_id) +@builtin(num_workgroups) + @const @group() @id() @@ -20,61 +37,157 @@ [ ["punctuation", "@"], "notAnAttribute\r\n", + ["punctuation", "@"], - ["attributes", "align"], + ["attributes", ["align"]], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", "binding"], + ["attributes", ["binding"]], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", "builtin"], - ["punctuation", "("], - ["punctuation", ")"], + ["attributes", [ + "builtin", + ["punctuation", "("], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["attributes", [ + "builtin", + ["punctuation", "("], + ["built-in-values", "vertex_index"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["attributes", [ + "builtin", + ["punctuation", "("], + ["built-in-values", "instance_index"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["attributes", [ + "builtin", + ["punctuation", "("], + ["built-in-values", "position"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["attributes", [ + "builtin", + ["punctuation", "("], + ["built-in-values", "front_facing"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["attributes", [ + "builtin", + ["punctuation", "("], + ["built-in-values", "frag_depth"], + ["punctuation", ")"] + ]], ["punctuation", "@"], - ["attributes", "const"], + ["attributes", [ + "builtin", + ["punctuation", "("], + ["built-in-values", "sample_index"], + ["punctuation", ")"] + ]], ["punctuation", "@"], - ["attributes", "group"], + ["attributes", [ + "builtin", + ["punctuation", "("], + ["built-in-values", "sample_mask"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["attributes", [ + "builtin", + ["punctuation", "("], + ["built-in-values", "local_invocation_id"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["attributes", [ + "builtin", + ["punctuation", "("], + ["built-in-values", "local_invocation_index"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["attributes", [ + "builtin", + ["punctuation", "("], + ["built-in-values", "global_invocation_id"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["attributes", [ + "builtin", + ["punctuation", "("], + ["built-in-values", "workgroup_id"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["attributes", [ + "builtin", + ["punctuation", "("], + ["built-in-values", "num_workgroups"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["attributes", ["const"]], + + ["punctuation", "@"], + ["attributes", ["group"]], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", "id"], + ["attributes", ["id"]], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", "interpolate"], + ["attributes", ["interpolate"]], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", "invariant"], + ["attributes", ["invariant"]], ["punctuation", "@"], - ["attributes", "location"], + ["attributes", ["location"]], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", "size"], + ["attributes", ["size"]], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", "workgroup_size"], + ["attributes", ["workgroup_size"]], ["punctuation", "("], ["punctuation", ")"], - ["punctuation", "@"], - ["attributes", "vertex"], - ["punctuation", "@"], - ["attributes", "fragment"], - ["punctuation", "@"], - ["attributes", "compute"] + ["punctuation", "@"], ["attributes", ["vertex"]], + ["punctuation", "@"], ["attributes", ["fragment"]], + ["punctuation", "@"], ["attributes", ["compute"]] ] diff --git a/tests/languages/wgsl/builtin_values_feature.test b/tests/languages/wgsl/builtin_values_feature.test deleted file mode 100644 index b038450b3e..0000000000 --- a/tests/languages/wgsl/builtin_values_feature.test +++ /dev/null @@ -1,33 +0,0 @@ -vertex_index -instance_index -position - -front_facing -frag_depth -sample_index -sample_mask - -local_invocation_id -local_invocation_index -global_invocation_id -workgroup_id -num_workgroups - ----------------------------------------------------- - -[ - ["built-in-values-vertex", "vertex_index"], - ["built-in-values-vertex", "instance_index"], - ["built-in-values-vertex", "position"], - - ["built-in-values-fragment", "front_facing"], - ["built-in-values-fragment", "frag_depth"], - ["built-in-values-fragment", "sample_index"], - ["built-in-values-fragment", "sample_mask"], - - ["built-in-values-compute", "local_invocation_id"], - ["built-in-values-compute", "local_invocation_index"], - ["built-in-values-compute", "global_invocation_id"], - ["built-in-values-compute", "workgroup_id"], - ["built-in-values-compute", "num_workgroups"] -] From e94b883d01a32c9d10dee7cd5b524c08c682c535 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 21:41:08 +0200 Subject: [PATCH 28/31] Renamed builtin_types_feature test to builtin_feature --- .../wgsl/{builtin_types_feature.test => builtin_feature.test} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/languages/wgsl/{builtin_types_feature.test => builtin_feature.test} (100%) diff --git a/tests/languages/wgsl/builtin_types_feature.test b/tests/languages/wgsl/builtin_feature.test similarity index 100% rename from tests/languages/wgsl/builtin_types_feature.test rename to tests/languages/wgsl/builtin_feature.test From e0739148db0ef4959720f3d3f6a64ddbeacc1823 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Tue, 17 May 2022 22:14:57 +0200 Subject: [PATCH 29/31] Updated tests and rebuild --- components/prism-wgsl.min.js | 2 +- tests/languages/wgsl/attributes_feature.test | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/components/prism-wgsl.min.js b/components/prism-wgsl.min.js index e7327a8b32..20d4d8490b 100644 --- a/components/prism-wgsl.min.js +++ b/components/prism-wgsl.min.js @@ -1 +1 @@ -Prism.languages.wgsl={comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},attributes:{pattern:/(@)(?:align|binding|builtin|const|group|id|interpolate|invariant|location|size|workgroup_size|vertex|fragment|compute)/i,lookbehind:!0,alias:"attr-name"},functions:{pattern:/\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/,lookbehind:!0,alias:"function"},keyword:/\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|switch|type|uniform|var|while|workgroup)\b/,"function-calls":{pattern:/\b[_a-z]\w*(?=\()/i,alias:"function"},builtin:/\b(?:array|atomic|bool|i32|u32|f32|i64|u64|f64|vec[2-4]|mat[2-4]x[2-4]|override|ptr|sampler|sampler_comparison|staticAssert|struct|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|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d)\b/,"class-name":/\b(?:[A-Z][A-Za-z0-9]*)\b/,"built-in-values-vertex":{pattern:/\b(?:vertex_index|instance_index|position)\b/,alias:"attr-value"},"built-in-values-fragment":{pattern:/\b(?:front_facing|frag_depth|sample_index|sample_mask)\b/,alias:"attr-value"},"built-in-values-compute":{pattern:/\b(?:local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/,alias:"attr-value"},"bool-literal":{pattern:/\b(?:true|false)\b/,alias:"boolean"},"hex-int-literal":{pattern:/\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/,alias:"number"},"hex-float-literal":{pattern:/\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/,alias:"number"},"decimal-float-literal":[{pattern:/[0-9]*\.[0-9]+(?:[eE](?:\+|-)?[0-9]+)?[fh]?/,alias:"number"},{pattern:/[0-9]+\.[0-9]*(?:[eE](?:\+|-)?[0-9]+)?[fh]?/,alias:"number"},{pattern:/[0-9]+[eE](?:\+|-)?[0-9]+[fh]?/,alias:"number"},{pattern:/\b\d+[fh]\b/,alias:"number"}],"int-literal":{pattern:/\b\d+[iu]?\b/,alias:"number"},operator:[{pattern:/(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/},{pattern:/&(?![&=])/},{pattern:/(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/},{pattern:/(?=!])=(?![=>])/},{pattern:/(?:==|!=|<=|(?=)/},{pattern:/(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/},{pattern:/\.(?!\.)/},{pattern:/->/}],punctuation:/[(){}[\],;<>]/}; \ No newline at end of file +Prism.languages.wgsl={comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},attributes:{pattern:/(@)(?:align|binding|builtin\(.*\)|const|group|id|interpolate|invariant|location|size|workgroup_size|vertex|fragment|compute)/i,lookbehind:!0,alias:"attr-name",inside:{"built-in-values":{pattern:/\b(?:vertex_index|instance_index|position|front_facing|frag_depth|sample_index|sample_mask|local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/,alias:"attr-value"},punctuation:/[()]/}},functions:{pattern:/\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/,lookbehind:!0,alias:"function"},keyword:/\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|struct|switch|type|uniform|var|while|workgroup)\b/,builtin:/\b(?:array|atomic|bool|i32|u32|f32|i64|u64|f64|vec[2-4]|mat[2-4]x[2-4]|override|ptr|sampler|sampler_comparison|staticAssert|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|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d|all|any|select|abs|acos|acosh|asin|asinh|atan|atanh|atan2|ceil|clamp|cos|cosh|cross|degrees|distance|exp|exp2|faceForward|floor|fma|fract|frexp|inverseSqrt|ldexp|length|log|log2|max|min|mix|modf|normalize|pow|quantizeToF16|radians|reflect|refract|round|sign|sin|sinh|smoothstep|sqrt|step|tan|tanh|trunc|countLeadingZeros|countOneBits|countTrailingZeros|firstLeadingBit|extractBits|insertBits|reverseBits|shiftLeft|shiftRight|determinant|transpose|dot|dpdx|dpdxCoarse|dpdxFine|dpdy|dpdyCoarse|dpdyFine|fwidth|fwidthCoarse|fwidthFine|textureDimensions|textureGather|textureGatherCompare|textureLoad|textureNumLayers|textureNumLevels|textureNumSamples|textureSample|textureSampleBias|textureSampleCompare|textureSampleCompareLevel|textureSampleGrad|textureSampleLevel|textureStore|atomicLoad|atomicStore|atomicAdd|atomicSub|atomicMax|atomicMin|atomicAnd|atomicOr|atomicXor|atomicExchange|atomicCompareExchangeWeak|pack4x8snorm|pack4x8unorm|pack2x16snorm|pack2x16unorm|pack2x16float|unpack4x8snorm|unpack4x8unorm|unpack2x16snorm|unpack2x16unorm|unpack2x16float|storageBarrier|workgroupBarrier)\b/,"function-calls":{pattern:/\b[_a-z]\w*(?=\()/i,alias:"function"},"class-name":/\b(?:[A-Z][A-Za-z0-9]*)\b/,"bool-literal":{pattern:/\b(?:true|false)\b/,alias:"boolean"},"hex-int-literal":{pattern:/\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/,alias:"number"},"hex-float-literal":{pattern:/\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/,alias:"number"},"decimal-float-literal":[{pattern:/[0-9]*\.[0-9]+(?:[eE](?:\+|-)?[0-9]+)?[fh]?/,alias:"number"},{pattern:/[0-9]+\.[0-9]*(?:[eE](?:\+|-)?[0-9]+)?[fh]?/,alias:"number"},{pattern:/[0-9]+[eE](?:\+|-)?[0-9]+[fh]?/,alias:"number"},{pattern:/\b\d+[fh]\b/,alias:"number"}],"int-literal":{pattern:/\b\d+[iu]?\b/,alias:"number"},operator:[{pattern:/(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/},{pattern:/&(?![&=])/},{pattern:/(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/},{pattern:/(^|[^<>=!])=(?![=>])/,lookbehind:!0},{pattern:/(?:==|!=|<=|\+\+|--|(^|[^=])>=)/,lookbehind:!0},{pattern:/(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/},{pattern:/->/}],punctuation:/[@(){}[\],;<>:.]/}; \ No newline at end of file diff --git a/tests/languages/wgsl/attributes_feature.test b/tests/languages/wgsl/attributes_feature.test index f7ab5f1668..1bcf5f6f2e 100644 --- a/tests/languages/wgsl/attributes_feature.test +++ b/tests/languages/wgsl/attributes_feature.test @@ -19,6 +19,8 @@ @builtin(workgroup_id) @builtin(num_workgroups) +something.vertex_index; + @const @group() @id() @@ -151,6 +153,11 @@ ["punctuation", ")"] ]], + "\r\n\r\nsomething", + ["punctuation", "."], + "vertex_index", + ["punctuation", ";"], + ["punctuation", "@"], ["attributes", ["const"]], From 37d2592abb0d78e32573699d6b862f2706275513 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Wed, 18 May 2022 16:06:34 +0200 Subject: [PATCH 30/31] Fix lint --- components/prism-wgsl.js | 118 +++++++++++++++++------------------ components/prism-wgsl.min.js | 2 +- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 5ea9a419eb..ef5a0a0bbb 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -1,61 +1,61 @@ Prism.languages.wgsl = { - 'comment': { - pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/, - greedy: true, - }, - 'attributes': { - pattern: /(@)(?:align|binding|builtin\(.*\)|const|group|id|interpolate|invariant|location|size|workgroup_size|vertex|fragment|compute)/i, - lookbehind: true, - alias: 'attr-name', - inside: { - 'built-in-values': { - pattern: /\b(?:vertex_index|instance_index|position|front_facing|frag_depth|sample_index|sample_mask|local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/, - alias: 'attr-value' - }, - 'punctuation': /[()]/, - }, - }, - 'functions': { - pattern: /\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/, - lookbehind: true, - alias: 'function', - }, - 'keyword': /\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|struct|switch|type|uniform|var|while|workgroup)\b/, - 'builtin': /\b(?:array|atomic|bool|i32|u32|f32|i64|u64|f64|vec[2-4]|mat[2-4]x[2-4]|override|ptr|sampler|sampler_comparison|staticAssert|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|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d|all|any|select|abs|acos|acosh|asin|asinh|atan|atanh|atan2|ceil|clamp|cos|cosh|cross|degrees|distance|exp|exp2|faceForward|floor|fma|fract|frexp|inverseSqrt|ldexp|length|log|log2|max|min|mix|modf|normalize|pow|quantizeToF16|radians|reflect|refract|round|sign|sin|sinh|smoothstep|sqrt|step|tan|tanh|trunc|countLeadingZeros|countOneBits|countTrailingZeros|firstLeadingBit|extractBits|insertBits|reverseBits|shiftLeft|shiftRight|determinant|transpose|dot|dpdx|dpdxCoarse|dpdxFine|dpdy|dpdyCoarse|dpdyFine|fwidth|fwidthCoarse|fwidthFine|textureDimensions|textureGather|textureGatherCompare|textureLoad|textureNumLayers|textureNumLevels|textureNumSamples|textureSample|textureSampleBias|textureSampleCompare|textureSampleCompareLevel|textureSampleGrad|textureSampleLevel|textureStore|atomicLoad|atomicStore|atomicAdd|atomicSub|atomicMax|atomicMin|atomicAnd|atomicOr|atomicXor|atomicExchange|atomicCompareExchangeWeak|pack4x8snorm|pack4x8unorm|pack2x16snorm|pack2x16unorm|pack2x16float|unpack4x8snorm|unpack4x8unorm|unpack2x16snorm|unpack2x16unorm|unpack2x16float|storageBarrier|workgroupBarrier)\b/, - 'function-calls': { - pattern: /\b[_a-z]\w*(?=\()/i, - alias: 'function', - }, - 'class-name': /\b(?:[A-Z][A-Za-z0-9]*)\b/, - 'bool-literal': { - pattern: /\b(?:true|false)\b/, - alias: 'boolean', - }, - 'hex-int-literal': { - pattern: /\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/, - alias:'number', - }, - 'hex-float-literal': { - pattern: /\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/, alias:'number' - }, - 'decimal-float-literal': [ - { pattern: /[0-9]*\.[0-9]+(?:[eE](?:\+|-)?[0-9]+)?[fh]?/, alias:'number' }, - { pattern: /[0-9]+\.[0-9]*(?:[eE](?:\+|-)?[0-9]+)?[fh]?/, alias:'number' }, - { pattern: /[0-9]+[eE](?:\+|-)?[0-9]+[fh]?/, alias:'number' }, - { pattern: /\b\d+[fh]\b/, alias:'number' }, - ], - 'int-literal': { - pattern: /\b\d+[iu]?\b/, - alias:'number', - }, - 'operator': [ - { pattern: /(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/ }, - { pattern: /&(?![&=])/ }, - { pattern: /(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/}, - { pattern: /(^|[^<>=!])=(?![=>])/, lookbehind: true }, - { pattern: /(?:==|!=|<=|\+\+|--|(^|[^=])>=)/, lookbehind: true }, - { pattern: /(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/ }, - { pattern: /->/ }, - ], - 'punctuation': /[@(){}[\],;<>:.]/, + 'comment': { + pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/, + greedy: true, + }, + 'attributes': { + pattern: /(@)(?:align|binding|builtin\(.*\)|compute|const|fragment|group|id|interpolate|invariant|location|size|vertex|workgroup_size)/i, + lookbehind: true, + alias: 'attr-name', + inside: { + 'built-in-values': { + pattern: /\b(?:frag_depth|front_facing|global_invocation_id|instance_index|local_invocation_id|local_invocation_index|num_workgroups|position|sample_index|sample_mask|vertex_index|workgroup_id)\b/, + alias: 'attr-value' + }, + 'punctuation': /[()]/, + }, + }, + 'functions': { + pattern: /\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/, + lookbehind: true, + alias: 'function', + }, + 'keyword': /\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|struct|switch|type|uniform|var|while|workgroup)\b/, + 'builtin': /\b(?:abs|acos|acosh|all|any|array|asin|asinh|atan|atan2|atanh|atomic|atomicAdd|atomicAnd|atomicCompareExchangeWeak|atomicExchange|atomicLoad|atomicMax|atomicMin|atomicOr|atomicStore|atomicSub|atomicXor|bool|ceil|clamp|cos|cosh|countLeadingZeros|countOneBits|countTrailingZeros|cross|degrees|determinant|distance|dot|dpdx|dpdxCoarse|dpdxFine|dpdy|dpdyCoarse|dpdyFine|exp|exp2|extractBits|f32|f64|faceForward|firstLeadingBit|floor|fma|fract|frexp|fwidth|fwidthCoarse|fwidthFine|i32|i64|insertBits|inverseSqrt|ldexp|length|log|log2|mat[2-4]x[2-4]|max|min|mix|modf|normalize|override|pack2x16float|pack2x16snorm|pack2x16unorm|pack4x8snorm|pack4x8unorm|pow|ptr|quantizeToF16|radians|reflect|refract|reverseBits|round|sampler|sampler_comparison|select|shiftLeft|shiftRight|sign|sin|sinh|smoothstep|sqrt|staticAssert|step|storageBarrier|tan|tanh|textureDimensions|textureGather|textureGatherCompare|textureLoad|textureNumLayers|textureNumLevels|textureNumSamples|textureSample|textureSampleBias|textureSampleCompare|textureSampleCompareLevel|textureSampleGrad|textureSampleLevel|textureStore|texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d|texture_multisampled_2d|texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d|transpose|trunc|u32|u64|unpack2x16float|unpack2x16snorm|unpack2x16unorm|unpack4x8snorm|unpack4x8unorm|vec[2-4]|workgroupBarrier)\b/, + 'function-calls': { + pattern: /\b[_a-z]\w*(?=\()/i, + alias: 'function', + }, + 'class-name': /\b(?:[A-Z][A-Za-z0-9]*)\b/, + 'bool-literal': { + pattern: /\b(?:false|true)\b/, + alias: 'boolean', + }, + 'hex-int-literal': { + pattern: /\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/, + alias: 'number', + }, + 'hex-float-literal': { + pattern: /\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/, alias: 'number' + }, + 'decimal-float-literal': [ + { pattern: /\d*\.\d+(?:[eE](?:\+|-)?\d+)?[fh]?/, alias: 'number' }, + { pattern: /\d+\.\d*(?:[eE](?:\+|-)?\d+)?[fh]?/, alias: 'number' }, + { pattern: /\d+[eE](?:\+|-)?\d+[fh]?/, alias: 'number' }, + { pattern: /\b\d+[fh]\b/, alias: 'number' }, + ], + 'int-literal': { + pattern: /\b\d+[iu]?\b/, + alias: 'number', + }, + 'operator': [ + { pattern: /(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/ }, + { pattern: /&(?![&=])/ }, + { pattern: /(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/ }, + { pattern: /(^|[^<>=!])=(?![=>])/, lookbehind: true }, + { pattern: /(?:==|!=|<=|\+\+|--|(^|[^=])>=)/, lookbehind: true }, + { pattern: /(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/ }, + { pattern: /->/ }, + ], + 'punctuation': /[@(){}[\],;<>:.]/, }; diff --git a/components/prism-wgsl.min.js b/components/prism-wgsl.min.js index 20d4d8490b..a5c3ed10e9 100644 --- a/components/prism-wgsl.min.js +++ b/components/prism-wgsl.min.js @@ -1 +1 @@ -Prism.languages.wgsl={comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},attributes:{pattern:/(@)(?:align|binding|builtin\(.*\)|const|group|id|interpolate|invariant|location|size|workgroup_size|vertex|fragment|compute)/i,lookbehind:!0,alias:"attr-name",inside:{"built-in-values":{pattern:/\b(?:vertex_index|instance_index|position|front_facing|frag_depth|sample_index|sample_mask|local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups)\b/,alias:"attr-value"},punctuation:/[()]/}},functions:{pattern:/\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/,lookbehind:!0,alias:"function"},keyword:/\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|struct|switch|type|uniform|var|while|workgroup)\b/,builtin:/\b(?:array|atomic|bool|i32|u32|f32|i64|u64|f64|vec[2-4]|mat[2-4]x[2-4]|override|ptr|sampler|sampler_comparison|staticAssert|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|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d|all|any|select|abs|acos|acosh|asin|asinh|atan|atanh|atan2|ceil|clamp|cos|cosh|cross|degrees|distance|exp|exp2|faceForward|floor|fma|fract|frexp|inverseSqrt|ldexp|length|log|log2|max|min|mix|modf|normalize|pow|quantizeToF16|radians|reflect|refract|round|sign|sin|sinh|smoothstep|sqrt|step|tan|tanh|trunc|countLeadingZeros|countOneBits|countTrailingZeros|firstLeadingBit|extractBits|insertBits|reverseBits|shiftLeft|shiftRight|determinant|transpose|dot|dpdx|dpdxCoarse|dpdxFine|dpdy|dpdyCoarse|dpdyFine|fwidth|fwidthCoarse|fwidthFine|textureDimensions|textureGather|textureGatherCompare|textureLoad|textureNumLayers|textureNumLevels|textureNumSamples|textureSample|textureSampleBias|textureSampleCompare|textureSampleCompareLevel|textureSampleGrad|textureSampleLevel|textureStore|atomicLoad|atomicStore|atomicAdd|atomicSub|atomicMax|atomicMin|atomicAnd|atomicOr|atomicXor|atomicExchange|atomicCompareExchangeWeak|pack4x8snorm|pack4x8unorm|pack2x16snorm|pack2x16unorm|pack2x16float|unpack4x8snorm|unpack4x8unorm|unpack2x16snorm|unpack2x16unorm|unpack2x16float|storageBarrier|workgroupBarrier)\b/,"function-calls":{pattern:/\b[_a-z]\w*(?=\()/i,alias:"function"},"class-name":/\b(?:[A-Z][A-Za-z0-9]*)\b/,"bool-literal":{pattern:/\b(?:true|false)\b/,alias:"boolean"},"hex-int-literal":{pattern:/\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/,alias:"number"},"hex-float-literal":{pattern:/\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/,alias:"number"},"decimal-float-literal":[{pattern:/[0-9]*\.[0-9]+(?:[eE](?:\+|-)?[0-9]+)?[fh]?/,alias:"number"},{pattern:/[0-9]+\.[0-9]*(?:[eE](?:\+|-)?[0-9]+)?[fh]?/,alias:"number"},{pattern:/[0-9]+[eE](?:\+|-)?[0-9]+[fh]?/,alias:"number"},{pattern:/\b\d+[fh]\b/,alias:"number"}],"int-literal":{pattern:/\b\d+[iu]?\b/,alias:"number"},operator:[{pattern:/(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/},{pattern:/&(?![&=])/},{pattern:/(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/},{pattern:/(^|[^<>=!])=(?![=>])/,lookbehind:!0},{pattern:/(?:==|!=|<=|\+\+|--|(^|[^=])>=)/,lookbehind:!0},{pattern:/(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/},{pattern:/->/}],punctuation:/[@(){}[\],;<>:.]/}; \ No newline at end of file +Prism.languages.wgsl={comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},attributes:{pattern:/(@)(?:align|binding|builtin\(.*\)|compute|const|fragment|group|id|interpolate|invariant|location|size|vertex|workgroup_size)/i,lookbehind:!0,alias:"attr-name",inside:{"built-in-values":{pattern:/\b(?:frag_depth|front_facing|global_invocation_id|instance_index|local_invocation_id|local_invocation_index|num_workgroups|position|sample_index|sample_mask|vertex_index|workgroup_id)\b/,alias:"attr-value"},punctuation:/[()]/}},functions:{pattern:/\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/,lookbehind:!0,alias:"function"},keyword:/\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|struct|switch|type|uniform|var|while|workgroup)\b/,builtin:/\b(?:abs|acos|acosh|all|any|array|asin|asinh|atan|atan2|atanh|atomic|atomicAdd|atomicAnd|atomicCompareExchangeWeak|atomicExchange|atomicLoad|atomicMax|atomicMin|atomicOr|atomicStore|atomicSub|atomicXor|bool|ceil|clamp|cos|cosh|countLeadingZeros|countOneBits|countTrailingZeros|cross|degrees|determinant|distance|dot|dpdx|dpdxCoarse|dpdxFine|dpdy|dpdyCoarse|dpdyFine|exp|exp2|extractBits|f32|f64|faceForward|firstLeadingBit|floor|fma|fract|frexp|fwidth|fwidthCoarse|fwidthFine|i32|i64|insertBits|inverseSqrt|ldexp|length|log|log2|mat[2-4]x[2-4]|max|min|mix|modf|normalize|override|pack2x16float|pack2x16snorm|pack2x16unorm|pack4x8snorm|pack4x8unorm|pow|ptr|quantizeToF16|radians|reflect|refract|reverseBits|round|sampler|sampler_comparison|select|shiftLeft|shiftRight|sign|sin|sinh|smoothstep|sqrt|staticAssert|step|storageBarrier|tan|tanh|textureDimensions|textureGather|textureGatherCompare|textureLoad|textureNumLayers|textureNumLevels|textureNumSamples|textureSample|textureSampleBias|textureSampleCompare|textureSampleCompareLevel|textureSampleGrad|textureSampleLevel|textureStore|texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d|texture_multisampled_2d|texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d|transpose|trunc|u32|u64|unpack2x16float|unpack2x16snorm|unpack2x16unorm|unpack4x8snorm|unpack4x8unorm|vec[2-4]|workgroupBarrier)\b/,"function-calls":{pattern:/\b[_a-z]\w*(?=\()/i,alias:"function"},"class-name":/\b(?:[A-Z][A-Za-z0-9]*)\b/,"bool-literal":{pattern:/\b(?:false|true)\b/,alias:"boolean"},"hex-int-literal":{pattern:/\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/,alias:"number"},"hex-float-literal":{pattern:/\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/,alias:"number"},"decimal-float-literal":[{pattern:/\d*\.\d+(?:[eE](?:\+|-)?\d+)?[fh]?/,alias:"number"},{pattern:/\d+\.\d*(?:[eE](?:\+|-)?\d+)?[fh]?/,alias:"number"},{pattern:/\d+[eE](?:\+|-)?\d+[fh]?/,alias:"number"},{pattern:/\b\d+[fh]\b/,alias:"number"}],"int-literal":{pattern:/\b\d+[iu]?\b/,alias:"number"},operator:[{pattern:/(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/},{pattern:/&(?![&=])/},{pattern:/(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/},{pattern:/(^|[^<>=!])=(?![=>])/,lookbehind:!0},{pattern:/(?:==|!=|<=|\+\+|--|(^|[^=])>=)/,lookbehind:!0},{pattern:/(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/},{pattern:/->/}],punctuation:/[@(){}[\],;<>:.]/}; \ No newline at end of file From 8bb57f76da08ab7f577ed0e25c96e7dce5505cb0 Mon Sep 17 00:00:00 2001 From: Dr4gonthree Date: Wed, 18 May 2022 16:29:20 +0200 Subject: [PATCH 31/31] Moved the builtin attribute and built-in-values to helper token. Updated test cases and rebuild. --- components/prism-wgsl.js | 18 ++-- components/prism-wgsl.min.js | 2 +- tests/languages/wgsl/attributes_feature.test | 89 +++++++++++--------- 3 files changed, 63 insertions(+), 46 deletions(-) diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index ef5a0a0bbb..68a5e0c371 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -3,18 +3,26 @@ Prism.languages.wgsl = { pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/, greedy: true, }, - 'attributes': { - pattern: /(@)(?:align|binding|builtin\(.*\)|compute|const|fragment|group|id|interpolate|invariant|location|size|vertex|workgroup_size)/i, + 'builtin-attribute': { + pattern: /(@)builtin\(.*?\)/, lookbehind: true, - alias: 'attr-name', inside: { + 'attribute': { + pattern: /^builtin/, + alias: 'attr-name', + }, + 'punctuation': /[(),]/, 'built-in-values': { pattern: /\b(?:frag_depth|front_facing|global_invocation_id|instance_index|local_invocation_id|local_invocation_index|num_workgroups|position|sample_index|sample_mask|vertex_index|workgroup_id)\b/, - alias: 'attr-value' + alias: 'attr-value', }, - 'punctuation': /[()]/, }, }, + 'attributes': { + pattern: /(@)(?:align|binding|compute|const|fragment|group|id|interpolate|invariant|location|size|vertex|workgroup_size)/i, + lookbehind: true, + alias: 'attr-name', + }, 'functions': { pattern: /\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/, lookbehind: true, diff --git a/components/prism-wgsl.min.js b/components/prism-wgsl.min.js index a5c3ed10e9..d3b7f3cdc5 100644 --- a/components/prism-wgsl.min.js +++ b/components/prism-wgsl.min.js @@ -1 +1 @@ -Prism.languages.wgsl={comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},attributes:{pattern:/(@)(?:align|binding|builtin\(.*\)|compute|const|fragment|group|id|interpolate|invariant|location|size|vertex|workgroup_size)/i,lookbehind:!0,alias:"attr-name",inside:{"built-in-values":{pattern:/\b(?:frag_depth|front_facing|global_invocation_id|instance_index|local_invocation_id|local_invocation_index|num_workgroups|position|sample_index|sample_mask|vertex_index|workgroup_id)\b/,alias:"attr-value"},punctuation:/[()]/}},functions:{pattern:/\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/,lookbehind:!0,alias:"function"},keyword:/\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|struct|switch|type|uniform|var|while|workgroup)\b/,builtin:/\b(?:abs|acos|acosh|all|any|array|asin|asinh|atan|atan2|atanh|atomic|atomicAdd|atomicAnd|atomicCompareExchangeWeak|atomicExchange|atomicLoad|atomicMax|atomicMin|atomicOr|atomicStore|atomicSub|atomicXor|bool|ceil|clamp|cos|cosh|countLeadingZeros|countOneBits|countTrailingZeros|cross|degrees|determinant|distance|dot|dpdx|dpdxCoarse|dpdxFine|dpdy|dpdyCoarse|dpdyFine|exp|exp2|extractBits|f32|f64|faceForward|firstLeadingBit|floor|fma|fract|frexp|fwidth|fwidthCoarse|fwidthFine|i32|i64|insertBits|inverseSqrt|ldexp|length|log|log2|mat[2-4]x[2-4]|max|min|mix|modf|normalize|override|pack2x16float|pack2x16snorm|pack2x16unorm|pack4x8snorm|pack4x8unorm|pow|ptr|quantizeToF16|radians|reflect|refract|reverseBits|round|sampler|sampler_comparison|select|shiftLeft|shiftRight|sign|sin|sinh|smoothstep|sqrt|staticAssert|step|storageBarrier|tan|tanh|textureDimensions|textureGather|textureGatherCompare|textureLoad|textureNumLayers|textureNumLevels|textureNumSamples|textureSample|textureSampleBias|textureSampleCompare|textureSampleCompareLevel|textureSampleGrad|textureSampleLevel|textureStore|texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d|texture_multisampled_2d|texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d|transpose|trunc|u32|u64|unpack2x16float|unpack2x16snorm|unpack2x16unorm|unpack4x8snorm|unpack4x8unorm|vec[2-4]|workgroupBarrier)\b/,"function-calls":{pattern:/\b[_a-z]\w*(?=\()/i,alias:"function"},"class-name":/\b(?:[A-Z][A-Za-z0-9]*)\b/,"bool-literal":{pattern:/\b(?:false|true)\b/,alias:"boolean"},"hex-int-literal":{pattern:/\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/,alias:"number"},"hex-float-literal":{pattern:/\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/,alias:"number"},"decimal-float-literal":[{pattern:/\d*\.\d+(?:[eE](?:\+|-)?\d+)?[fh]?/,alias:"number"},{pattern:/\d+\.\d*(?:[eE](?:\+|-)?\d+)?[fh]?/,alias:"number"},{pattern:/\d+[eE](?:\+|-)?\d+[fh]?/,alias:"number"},{pattern:/\b\d+[fh]\b/,alias:"number"}],"int-literal":{pattern:/\b\d+[iu]?\b/,alias:"number"},operator:[{pattern:/(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/},{pattern:/&(?![&=])/},{pattern:/(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/},{pattern:/(^|[^<>=!])=(?![=>])/,lookbehind:!0},{pattern:/(?:==|!=|<=|\+\+|--|(^|[^=])>=)/,lookbehind:!0},{pattern:/(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/},{pattern:/->/}],punctuation:/[@(){}[\],;<>:.]/}; \ No newline at end of file +Prism.languages.wgsl={comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},"builtin-attribute":{pattern:/(@)builtin\(.*?\)/,lookbehind:!0,inside:{attribute:{pattern:/^builtin/,alias:"attr-name"},punctuation:/[(),]/,"built-in-values":{pattern:/\b(?:frag_depth|front_facing|global_invocation_id|instance_index|local_invocation_id|local_invocation_index|num_workgroups|position|sample_index|sample_mask|vertex_index|workgroup_id)\b/,alias:"attr-value"}}},attributes:{pattern:/(@)(?:align|binding|compute|const|fragment|group|id|interpolate|invariant|location|size|vertex|workgroup_size)/i,lookbehind:!0,alias:"attr-name"},functions:{pattern:/\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/,lookbehind:!0,alias:"function"},keyword:/\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|struct|switch|type|uniform|var|while|workgroup)\b/,builtin:/\b(?:abs|acos|acosh|all|any|array|asin|asinh|atan|atan2|atanh|atomic|atomicAdd|atomicAnd|atomicCompareExchangeWeak|atomicExchange|atomicLoad|atomicMax|atomicMin|atomicOr|atomicStore|atomicSub|atomicXor|bool|ceil|clamp|cos|cosh|countLeadingZeros|countOneBits|countTrailingZeros|cross|degrees|determinant|distance|dot|dpdx|dpdxCoarse|dpdxFine|dpdy|dpdyCoarse|dpdyFine|exp|exp2|extractBits|f32|f64|faceForward|firstLeadingBit|floor|fma|fract|frexp|fwidth|fwidthCoarse|fwidthFine|i32|i64|insertBits|inverseSqrt|ldexp|length|log|log2|mat[2-4]x[2-4]|max|min|mix|modf|normalize|override|pack2x16float|pack2x16snorm|pack2x16unorm|pack4x8snorm|pack4x8unorm|pow|ptr|quantizeToF16|radians|reflect|refract|reverseBits|round|sampler|sampler_comparison|select|shiftLeft|shiftRight|sign|sin|sinh|smoothstep|sqrt|staticAssert|step|storageBarrier|tan|tanh|textureDimensions|textureGather|textureGatherCompare|textureLoad|textureNumLayers|textureNumLevels|textureNumSamples|textureSample|textureSampleBias|textureSampleCompare|textureSampleCompareLevel|textureSampleGrad|textureSampleLevel|textureStore|texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d|texture_multisampled_2d|texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d|transpose|trunc|u32|u64|unpack2x16float|unpack2x16snorm|unpack2x16unorm|unpack4x8snorm|unpack4x8unorm|vec[2-4]|workgroupBarrier)\b/,"function-calls":{pattern:/\b[_a-z]\w*(?=\()/i,alias:"function"},"class-name":/\b(?:[A-Z][A-Za-z0-9]*)\b/,"bool-literal":{pattern:/\b(?:false|true)\b/,alias:"boolean"},"hex-int-literal":{pattern:/\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/,alias:"number"},"hex-float-literal":{pattern:/\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/,alias:"number"},"decimal-float-literal":[{pattern:/\d*\.\d+(?:[eE](?:\+|-)?\d+)?[fh]?/,alias:"number"},{pattern:/\d+\.\d*(?:[eE](?:\+|-)?\d+)?[fh]?/,alias:"number"},{pattern:/\d+[eE](?:\+|-)?\d+[fh]?/,alias:"number"},{pattern:/\b\d+[fh]\b/,alias:"number"}],"int-literal":{pattern:/\b\d+[iu]?\b/,alias:"number"},operator:[{pattern:/(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/},{pattern:/&(?![&=])/},{pattern:/(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/},{pattern:/(^|[^<>=!])=(?![=>])/,lookbehind:!0},{pattern:/(?:==|!=|<=|\+\+|--|(^|[^=])>=)/,lookbehind:!0},{pattern:/(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/},{pattern:/->/}],punctuation:/[@(){}[\],;<>:.]/}; \ No newline at end of file diff --git a/tests/languages/wgsl/attributes_feature.test b/tests/languages/wgsl/attributes_feature.test index 1bcf5f6f2e..c45480330c 100644 --- a/tests/languages/wgsl/attributes_feature.test +++ b/tests/languages/wgsl/attributes_feature.test @@ -19,6 +19,7 @@ @builtin(workgroup_id) @builtin(num_workgroups) +@builtin(notABuiltInValue) something.vertex_index; @const @@ -41,160 +42,168 @@ something.vertex_index; "notAnAttribute\r\n", ["punctuation", "@"], - ["attributes", ["align"]], + ["attributes", "align"], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", ["binding"]], + ["attributes", "binding"], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", [ - "builtin", + ["builtin-attribute", [ + ["attribute", "builtin"], ["punctuation", "("], ["punctuation", ")"] ]], ["punctuation", "@"], - ["attributes", [ - "builtin", + ["builtin-attribute", [ + ["attribute", "builtin"], ["punctuation", "("], ["built-in-values", "vertex_index"], ["punctuation", ")"] ]], ["punctuation", "@"], - ["attributes", [ - "builtin", + ["builtin-attribute", [ + ["attribute", "builtin"], ["punctuation", "("], ["built-in-values", "instance_index"], ["punctuation", ")"] ]], ["punctuation", "@"], - ["attributes", [ - "builtin", + ["builtin-attribute", [ + ["attribute", "builtin"], ["punctuation", "("], ["built-in-values", "position"], ["punctuation", ")"] ]], ["punctuation", "@"], - ["attributes", [ - "builtin", + ["builtin-attribute", [ + ["attribute", "builtin"], ["punctuation", "("], ["built-in-values", "front_facing"], ["punctuation", ")"] ]], ["punctuation", "@"], - ["attributes", [ - "builtin", + ["builtin-attribute", [ + ["attribute", "builtin"], ["punctuation", "("], ["built-in-values", "frag_depth"], ["punctuation", ")"] ]], ["punctuation", "@"], - ["attributes", [ - "builtin", + ["builtin-attribute", [ + ["attribute", "builtin"], ["punctuation", "("], ["built-in-values", "sample_index"], ["punctuation", ")"] ]], ["punctuation", "@"], - ["attributes", [ - "builtin", + ["builtin-attribute", [ + ["attribute", "builtin"], ["punctuation", "("], ["built-in-values", "sample_mask"], ["punctuation", ")"] ]], ["punctuation", "@"], - ["attributes", [ - "builtin", + ["builtin-attribute", [ + ["attribute", "builtin"], ["punctuation", "("], ["built-in-values", "local_invocation_id"], ["punctuation", ")"] ]], ["punctuation", "@"], - ["attributes", [ - "builtin", + ["builtin-attribute", [ + ["attribute", "builtin"], ["punctuation", "("], ["built-in-values", "local_invocation_index"], ["punctuation", ")"] ]], ["punctuation", "@"], - ["attributes", [ - "builtin", + ["builtin-attribute", [ + ["attribute", "builtin"], ["punctuation", "("], ["built-in-values", "global_invocation_id"], ["punctuation", ")"] ]], ["punctuation", "@"], - ["attributes", [ - "builtin", + ["builtin-attribute", [ + ["attribute", "builtin"], ["punctuation", "("], ["built-in-values", "workgroup_id"], ["punctuation", ")"] ]], ["punctuation", "@"], - ["attributes", [ - "builtin", + ["builtin-attribute", [ + ["attribute", "builtin"], ["punctuation", "("], ["built-in-values", "num_workgroups"], ["punctuation", ")"] ]], - "\r\n\r\nsomething", + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + "notABuiltInValue", + ["punctuation", ")"] + ]], + + "\r\nsomething", ["punctuation", "."], "vertex_index", ["punctuation", ";"], ["punctuation", "@"], - ["attributes", ["const"]], + ["attributes", "const"], ["punctuation", "@"], - ["attributes", ["group"]], + ["attributes", "group"], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", ["id"]], + ["attributes", "id"], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", ["interpolate"]], + ["attributes", "interpolate"], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", ["invariant"]], + ["attributes", "invariant"], ["punctuation", "@"], - ["attributes", ["location"]], + ["attributes", "location"], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", ["size"]], + ["attributes", "size"], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "@"], - ["attributes", ["workgroup_size"]], + ["attributes", "workgroup_size"], ["punctuation", "("], ["punctuation", ")"], - ["punctuation", "@"], ["attributes", ["vertex"]], - ["punctuation", "@"], ["attributes", ["fragment"]], - ["punctuation", "@"], ["attributes", ["compute"]] + ["punctuation", "@"], ["attributes", "vertex"], + ["punctuation", "@"], ["attributes", "fragment"], + ["punctuation", "@"], ["attributes", "compute"] ]