From 07d761e17ab92b881e2701a9b01db643560668c4 Mon Sep 17 00:00:00 2001 From: Alexandre Lhuillier Date: Tue, 26 May 2020 09:25:39 +0200 Subject: Removed the "mistake detector" feature and the style changes in glsl and hlsl syntax highlighters --- plugins/language_hlsl.lua | 190 ++++++++++++++++++++-------------------------- 1 file changed, 84 insertions(+), 106 deletions(-) (limited to 'plugins/language_hlsl.lua') diff --git a/plugins/language_hlsl.lua b/plugins/language_hlsl.lua index a7a4375..1444ef4 100644 --- a/plugins/language_hlsl.lua +++ b/plugins/language_hlsl.lua @@ -2,8 +2,6 @@ local style = require "core.style" local common = require "core.common" -style.syntax["forbiddenbuiltin"] = { common.color "#ee0000" } -style.syntax["builtin"] = { common.color "#77eecc" } local syntax = require "core.syntax" syntax.add { @@ -56,15 +54,6 @@ syntax.add { { pattern = "double1[0-6]x1[0-6]", type = "keyword2" }, { pattern = "double[1-4]", type = "keyword2" }, - { pattern = "ivec[2-4]", type = "forbiddenbuiltin" }, - { pattern = "bvec[2-4]", type = "forbiddenbuiltin" }, - { pattern = "uvec[2-4]", type = "forbiddenbuiltin" }, - { pattern = "vec[2-4]", type = "forbiddenbuiltin" }, - { pattern = "dmat[2-4]x[2-4]", type = "forbiddenbuiltin" }, - { pattern = "dmat[2-4]", type = "forbiddenbuiltin" }, - { pattern = "mat[2-4]x[2-4]", type = "forbiddenbuiltin" }, - { pattern = "mat[2-4]", type = "forbiddenbuiltin" }, - { pattern = "[%a_][%w_]*%f[(]", type = "function" }, { pattern = "[%a_][%w_]*", type = "symbol" }, }, @@ -153,7 +142,7 @@ syntax.add { ["RWTexture2D"] = "keyword2", ["RWTexture2DArray"] = "keyword2", ["RWTexture3D"] = "keyword2", - ["sample"] = "builtin", + ["sample"] = "keyword", ["sampler"] = "keyword2", ["SamplerState"] = "keyword2", ["SamplerComparisonState"]= "keyword2", @@ -198,100 +187,89 @@ syntax.add { --https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-intrinsic-functions --The symbols are added in the order they appear on this webpage, which is alphabetically - ["abort"] = "builtin", - ["abs"] = "builtin", - ["acos"] = "builtin", - ["all"] = "builtin", - ["any"] = "builtin", - ["asdouble"] = "builtin", - ["asfloat"] = "builtin", - ["asin"] = "builtin", - ["asint"] = "builtin", - ["asuint"] = "builtin", - ["atan"] = "builtin", - ["atan2"] = "builtin", - ["ceil"] = "builtin", - ["clamp"] = "builtin", - ["clip"] = "builtin", - ["cos"] = "builtin", - ["cosh"] = "builtin", - ["countbits"] = "builtin", - ["cross"] = "builtin", - ["ddx"] = "builtin", - ["ddx_coarse"] = "builtin", - ["ddx_fine"] = "builtin", - ["ddy"] = "builtin", - ["ddy_coarse"] = "builtin", - ["ddy_fine"] = "builtin", - ["degrees"] = "builtin", - ["determinant"] = "builtin", - ["distance"] = "builtin", - ["dot"] = "builtin", - ["dst"] = "builtin", - ["errorf"] = "builtin", - ["exp"] = "builtin", - ["exp2"] = "builtin", - ["f16tof32"] = "builtin", - ["f32tof16"] = "builtin", - ["faceforward"] = "builtin", - ["firstbithigh"]= "builtin", - ["firstbitlow"] = "builtin", - ["floor"] = "builtin", - ["fma"] = "builtin", - ["fmod"] = "builtin", - ["frac"] = "builtin", - ["frexp"] = "builtin", - ["fwidth"] = "builtin", - ["isfinite"] = "builtin", - ["isinf"] = "builtin", - ["isnan"] = "builtin", - ["ldexp"] = "builtin", - ["length"] = "builtin", - ["lerp"] = "builtin", - ["lit"] = "builtin", - ["log"] = "builtin", - ["log10"] = "builtin", - ["log2"] = "builtin", - ["mad"] = "builtin", - ["max"] = "builtin", - ["min"] = "builtin", - ["modf"] = "builtin", - ["msad4"] = "builtin", - ["mul"] = "builtin", - ["noise"] = "builtin", - ["normalize"] = "builtin", - ["pow"] = "builtin", - ["printf"] = "builtin", - ["radians"] = "builtin", - ["rcp"] = "builtin", - ["reflect"] = "builtin", - ["refract"] = "builtin", - ["reversebits"] = "builtin", - ["round"] = "builtin", - ["rsqrt"] = "builtin", - ["saturate"] = "builtin", - ["sign"] = "builtin", - ["sin"] = "builtin", - ["sincos"] = "builtin", - ["sinh"] = "builtin", - ["smoothstep"] = "builtin", - ["sqrt"] = "builtin", - ["step"] = "builtin", - ["tan"] = "builtin", - ["tanh"] = "builtin", - ["transpose"] = "builtin", - ["trunc"] = "builtin", - - --common symbols in GLSL that don't exist in HLSL - ["mix"] = "forbiddenbuiltin", - ["fract"] = "forbiddenbuiltin", - ["inversesqrt"]= "forbiddenbuiltin", - ["dFdx"] = "forbiddenbuiltin", - ["dFdy"] = "forbiddenbuiltin", - ["dFdxFine"] = "forbiddenbuiltin", - ["dFdyFine"] = "forbiddenbuiltin", - ["dFdxCoarse"] = "forbiddenbuiltin", - ["dFdyCoarse"] = "forbiddenbuiltin", + ["abort"] = "keyword", + ["abs"] = "keyword", + ["acos"] = "keyword", + ["all"] = "keyword", + ["any"] = "keyword", + ["asdouble"] = "keyword", + ["asfloat"] = "keyword", + ["asin"] = "keyword", + ["asint"] = "keyword", + ["asuint"] = "keyword", + ["atan"] = "keyword", + ["atan2"] = "keyword", + ["ceil"] = "keyword", + ["clamp"] = "keyword", + ["clip"] = "keyword", + ["cos"] = "keyword", + ["cosh"] = "keyword", + ["countbits"] = "keyword", + ["cross"] = "keyword", + ["ddx"] = "keyword", + ["ddx_coarse"] = "keyword", + ["ddx_fine"] = "keyword", + ["ddy"] = "keyword", + ["ddy_coarse"] = "keyword", + ["ddy_fine"] = "keyword", + ["degrees"] = "keyword", + ["determinant"] = "keyword", + ["distance"] = "keyword", + ["dot"] = "keyword", + ["dst"] = "keyword", + ["errorf"] = "keyword", + ["exp"] = "keyword", + ["exp2"] = "keyword", + ["f16tof32"] = "keyword", + ["f32tof16"] = "keyword", + ["faceforward"] = "keyword", + ["firstbithigh"]= "keyword", + ["firstbitlow"] = "keyword", + ["floor"] = "keyword", + ["fma"] = "keyword", + ["fmod"] = "keyword", + ["frac"] = "keyword", + ["frexp"] = "keyword", + ["fwidth"] = "keyword", + ["isfinite"] = "keyword", + ["isinf"] = "keyword", + ["isnan"] = "keyword", + ["ldexp"] = "keyword", + ["length"] = "keyword", + ["lerp"] = "keyword", + ["lit"] = "keyword", + ["log"] = "keyword", + ["log10"] = "keyword", + ["log2"] = "keyword", + ["mad"] = "keyword", + ["max"] = "keyword", + ["min"] = "keyword", + ["modf"] = "keyword", + ["msad4"] = "keyword", + ["mul"] = "keyword", + ["noise"] = "keyword", + ["normalize"] = "keyword", + ["pow"] = "keyword", + ["printf"] = "keyword", + ["radians"] = "keyword", + ["rcp"] = "keyword", + ["reflect"] = "keyword", + ["refract"] = "keyword", + ["reversebits"] = "keyword", + ["round"] = "keyword", + ["rsqrt"] = "keyword", + ["saturate"] = "keyword", + ["sign"] = "keyword", + ["sin"] = "keyword", + ["sincos"] = "keyword", + ["sinh"] = "keyword", + ["smoothstep"] = "keyword", + ["sqrt"] = "keyword", + ["step"] = "keyword", + ["tan"] = "keyword", + ["tanh"] = "keyword", + ["transpose"] = "keyword", + ["trunc"] = "keyword", }, } -- cgit v1.2.3