From 4f6d1a2df979662f9ff966d25d35ab509a68002e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Y=C5=AB=20Kobayashi?= Date: Mon, 19 Sep 2022 09:42:54 +0900 Subject: [PATCH 1/5] Add support for HLSL (converted from Pygments) --- lexers/embedded/hlsl.xml | 107 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 lexers/embedded/hlsl.xml diff --git a/lexers/embedded/hlsl.xml b/lexers/embedded/hlsl.xml new file mode 100644 index 000000000..c00a4ab2b --- /dev/null +++ b/lexers/embedded/hlsl.xml @@ -0,0 +1,107 @@ + + + HLSL + hlsl + *.hlsl + *.hlsli + text/x-hlsl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From a96a669850a501ffa9c287ebffba72666efc6113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Y=C5=AB=20Kobayashi?= Date: Mon, 19 Sep 2022 09:54:12 +0900 Subject: [PATCH 2/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ffaccb653..88b9e285c 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ D | D, Dart, Diff, Django/Jinja, Docker, DTD, Dylan E | EBNF, Elixir, Elm, EmacsLisp, Erlang F | Factor, Fish, Forth, Fortran, FSharp G | GAS, GDScript, Genshi, Genshi HTML, Genshi Text, Gherkin, GLSL, Gnuplot, Go, Go HTML Template, Go Text Template, GraphQL, Groff, Groovy -H | Handlebars, Haskell, Haxe, HCL, Hexdump, HLB, HTML, HTTP, Hy +H | Handlebars, Haskell, Haxe, HCL, Hexdump, HLB, HLSL, HTML, HTTP, Hy I | Idris, Igor, INI, Io J | J, Java, JavaScript, JSON, Julia, Jungle K | Kotlin From dd6cd178f5e2a7080bef2a4ed5410af9ff326e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Y=C5=AB=20Kobayashi?= Date: Mon, 19 Sep 2022 10:15:33 +0900 Subject: [PATCH 3/5] Add testdata for HLSL --- lexers/testdata/hlsl.actual | 3 +++ lexers/testdata/hlsl.expected | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 lexers/testdata/hlsl.actual create mode 100644 lexers/testdata/hlsl.expected diff --git a/lexers/testdata/hlsl.actual b/lexers/testdata/hlsl.actual new file mode 100644 index 000000000..a84631c8a --- /dev/null +++ b/lexers/testdata/hlsl.actual @@ -0,0 +1,3 @@ +float4 vertex(float3 position) { + return mul(projection, mul(view, mul(model, float4(position, 1.0)))); +} diff --git a/lexers/testdata/hlsl.expected b/lexers/testdata/hlsl.expected new file mode 100644 index 000000000..e4da78ba6 --- /dev/null +++ b/lexers/testdata/hlsl.expected @@ -0,0 +1,44 @@ +[ + {"type":"KeywordType","value":"float4"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"vertex"}, + {"type":"Punctuation","value":"("}, + {"type":"KeywordType","value":"float3"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"position"}, + {"type":"Punctuation","value":")"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"return"}, + {"type":"Text","value":" "}, + {"type":"NameBuiltin","value":"mul"}, + {"type":"Punctuation","value":"("}, + {"type":"Name","value":"projection"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"NameBuiltin","value":"mul"}, + {"type":"Punctuation","value":"("}, + {"type":"Name","value":"view"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"NameBuiltin","value":"mul"}, + {"type":"Punctuation","value":"("}, + {"type":"Name","value":"model"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"KeywordType","value":"float4"}, + {"type":"Punctuation","value":"("}, + {"type":"Name","value":"position"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"1.0"}, + {"type":"Punctuation","value":")"}, + {"type":"Punctuation","value":")"}, + {"type":"Punctuation","value":")"}, + {"type":"Punctuation","value":")"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n"} +] \ No newline at end of file From eeb27d3778ba32e84ab67a7440f51880c243788f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Y=C5=AB=20Kobayashi?= Date: Mon, 19 Sep 2022 10:25:05 +0900 Subject: [PATCH 4/5] Replace TextWhitespace with Text (like as glsl.xml) --- lexers/embedded/hlsl.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lexers/embedded/hlsl.xml b/lexers/embedded/hlsl.xml index c00a4ab2b..774f53cf2 100644 --- a/lexers/embedded/hlsl.xml +++ b/lexers/embedded/hlsl.xml @@ -82,7 +82,7 @@ - + From 4abbb32a6fa813069312a158d839af676c51a00e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Y=C5=AB=20Kobayashi?= Date: Mon, 19 Sep 2022 10:25:12 +0900 Subject: [PATCH 5/5] Fix test --- lexers/testdata/hlsl.expected | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lexers/testdata/hlsl.expected b/lexers/testdata/hlsl.expected index e4da78ba6..dcd0491e5 100644 --- a/lexers/testdata/hlsl.expected +++ b/lexers/testdata/hlsl.expected @@ -33,11 +33,7 @@ {"type":"Punctuation","value":","}, {"type":"Text","value":" "}, {"type":"LiteralNumberFloat","value":"1.0"}, - {"type":"Punctuation","value":")"}, - {"type":"Punctuation","value":")"}, - {"type":"Punctuation","value":")"}, - {"type":"Punctuation","value":")"}, - {"type":"Punctuation","value":";"}, + {"type":"Punctuation","value":"))));"}, {"type":"Text","value":"\n"}, {"type":"Punctuation","value":"}"}, {"type":"Text","value":"\n"}