aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Lhuillier <alexandre.lhuillier@orange.fr>2020-05-26 09:25:39 +0200
committerAlexandre Lhuillier <alexandre.lhuillier@orange.fr>2020-05-26 09:25:39 +0200
commit07d761e17ab92b881e2701a9b01db643560668c4 (patch)
treea7b7e58408d1e0d43cfa5268313b2e06ad8bad9d
parent98eb3a0e7765d9bd14964eaf368cf46888b6ec9c (diff)
downloadlite-xl-plugins-07d761e17ab92b881e2701a9b01db643560668c4.tar.gz
lite-xl-plugins-07d761e17ab92b881e2701a9b01db643560668c4.zip
Removed the "mistake detector" feature and the style changes in glsl and hlsl syntax highlighters
-rw-r--r--plugins/language_glsl.lua501
-rw-r--r--plugins/language_hlsl.lua190
2 files changed, 286 insertions, 405 deletions
diff --git a/plugins/language_glsl.lua b/plugins/language_glsl.lua
index f8983d4..da69ebd 100644
--- a/plugins/language_glsl.lua
+++ b/plugins/language_glsl.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 {
@@ -20,42 +18,6 @@ syntax.add {
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
- { pattern = "int[1-9]x[1-9]", type = "forbiddenbuiltin" },
- { pattern = "int1[0-6]x[1-9]", type = "forbiddenbuiltin" },
- { pattern = "int[1-9]x1[0-6]", type = "forbiddenbuiltin" },
- { pattern = "int1[0-6]x1[0-6]", type = "forbiddenbuiltin" },
- { pattern = "int[1-4]", type = "forbiddenbuiltin" },
-
- { pattern = "uint[1-9]x[1-9]", type = "forbiddenbuiltin" },
- { pattern = "uint1[0-6]x[1-9]", type = "forbiddenbuiltin" },
- { pattern = "uint[1-9]x1[0-6]", type = "forbiddenbuiltin" },
- { pattern = "uint1[0-6]x1[0-6]", type = "forbiddenbuiltin" },
- { pattern = "uint[1-4]", type = "forbiddenbuiltin" },
-
- { pattern = "dword[1-9]x[1-9]", type = "forbiddenbuiltin" },
- { pattern = "dword1[0-6]x[1-9]", type = "forbiddenbuiltin" },
- { pattern = "dword[1-9]x1[0-6]", type = "forbiddenbuiltin" },
- { pattern = "dword1[0-6]x1[0-6]", type = "forbiddenbuiltin" },
- { pattern = "dword[1-4]", type = "forbiddenbuiltin" },
-
- { pattern = "half[1-9]x[1-9]", type = "forbiddenbuiltin" },
- { pattern = "half1[0-6]x[1-9]", type = "forbiddenbuiltin" },
- { pattern = "half[1-9]x1[0-6]", type = "forbiddenbuiltin" },
- { pattern = "half1[0-6]x1[0-6]", type = "forbiddenbuiltin" },
- { pattern = "half[1-4]", type = "forbiddenbuiltin" },
-
- { pattern = "float[1-9]x[1-9]", type = "forbiddenbuiltin" },
- { pattern = "float1[0-6]x[1-9]", type = "forbiddenbuiltin" },
- { pattern = "float[1-9]x1[0-6]", type = "forbiddenbuiltin" },
- { pattern = "float1[0-6]x1[0-6]", type = "forbiddenbuiltin" },
- { pattern = "float[1-4]", type = "forbiddenbuiltin" },
-
- { pattern = "double[1-9]x[1-9]", type = "forbiddenbuiltin" },
- { pattern = "double1[0-6]x[1-9]", type = "forbiddenbuiltin" },
- { pattern = "double[1-9]x1[0-6]", type = "forbiddenbuiltin" },
- { pattern = "double1[0-6]x1[0-6]", type = "forbiddenbuiltin" },
- { pattern = "double[1-4]", type = "forbiddenbuiltin" },
-
{ pattern = "ivec[2-4]", type = "keyword2" },
{ pattern = "bvec[2-4]", type = "keyword2" },
{ pattern = "uvec[2-4]", type = "keyword2" },
@@ -198,220 +160,220 @@ syntax.add {
["atomic_uint"] = "keyword2",
- ["radians"] = "builtin",
- ["degrees"] = "builtin",
- ["sin"] = "builtin",
- ["cos"] = "builtin",
- ["tan"] = "builtin",
- ["asin"] = "builtin",
- ["acos"] = "builtin",
- ["atan"] = "builtin",
- ["sinh"] = "builtin",
- ["cosh"] = "builtin",
- ["tanh"] = "builtin",
- ["asinh"] = "builtin",
- ["acosh"] = "builtin",
- ["pow"] = "builtin",
- ["exp"] = "builtin",
- ["exp2"] = "builtin",
- ["log2"] = "builtin",
- ["sqrt"] = "builtin",
- ["inversesqrt"] = "forbiddenbuiltin",
- ["abs"] = "builtin",
- ["sign"] = "builtin",
- ["floor"] = "builtin",
- ["trunc"] = "builtin",
- ["round"] = "builtin",
- ["roundEven"] = "builtin",
- ["ceil"] = "builtin",
- ["fract"] = "builtin",
- ["mod"] = "builtin",
- ["modf"] = "builtin",
- ["min"] = "builtin",
- ["max"] = "builtin",
- ["clamp"] = "builtin",
- ["mix"] = "builtin",
- ["step"] = "builtin",
- ["smoothstep"] = "builtin",
- ["isnan"] = "builtin",
- ["isinf"] = "builtin",
- ["floatBitsToInt"] = "builtin",
- ["floatBitsToUint"] = "builtin",
- ["intBitsToFloat"] = "builtin",
- ["uintBitsToFloat"] = "builtin",
- ["fma"] = "builtin",
- ["frexp"] = "builtin",
- ["ldexp"] = "builtin",
- ["packUnorm2x16"] = "builtin",
- ["packSnorm2x16"] = "builtin",
- ["packUnorm4x8"] = "builtin",
- ["packSnorm4x8"] = "builtin",
- ["unpackUnorm2x16"] = "builtin",
- ["unpackSnorm2x16"] = "builtin",
- ["unpackUnorm4x8"] = "builtin",
- ["unpackSnorm4x8"] = "builtin",
- ["packHalf2x16"] = "builtin",
- ["unpackHalf2x16"] = "builtin",
- ["packDouble2x32"] = "builtin",
- ["unpackDouble2x32"] = "builtin",
- ["length"] = "builtin",
- ["distance"] = "builtin",
- ["dot"] = "builtin",
- ["cross"] = "builtin",
- ["normalize"] = "builtin",
- ["ftransform"] = "builtin",
- ["faceforward"] = "builtin",
- ["reflect"] = "builtin",
- ["refract"] = "builtin",
- ["matrixCompMult"] = "builtin",
- ["outerProduct"] = "builtin",
- ["transpose"] = "builtin",
- ["determinant"] = "builtin",
- ["inverse"] = "builtin",
- ["lessThan"] = "builtin",
- ["lessThanEqual"] = "builtin",
- ["greaterThan"] = "builtin",
- ["greaterThanEqual"] = "builtin",
- ["equal"] = "builtin",
- ["notEqual"] = "builtin",
- ["any"] = "builtin",
- ["all"] = "builtin",
- ["not"] = "builtin",
- ["uaddCarry"] = "builtin",
- ["usubBorrow"] = "builtin",
- ["umulExtended"] = "builtin",
- ["imulExtended"] = "builtin",
- ["bitfieldExtract"] = "builtin",
- ["bitfieldInsert"] = "builtin",
- ["bitfieldReverse"] = "builtin",
- ["bitCount"] = "builtin",
- ["findLSB"] = "builtin",
- ["findMSB"] = "builtin",
- ["textureSize"] = "builtin",
- ["textureQueryLod"] = "builtin",
- ["textureQueryLevels"] = "builtin",
- ["textureSamples"] = "builtin",
- ["texture"] = "builtin",
- ["textureProj"] = "builtin",
- ["textureLod"] = "builtin",
- ["textureOffset"] = "builtin",
- ["texelFetch"] = "builtin",
- ["texelFetchOffset"] = "builtin",
- ["textureProjOffset"] = "builtin",
- ["textureLodOffset"] = "builtin",
- ["textureProjLod"] = "builtin",
- ["textureProjLodOffset"] = "builtin",
- ["textureGrad"] = "builtin",
- ["textureGradOffset"] = "builtin",
- ["textureProjGrad"] = "builtin",
- ["textureProjGradOffset"]= "builtin",
- ["textureGather"] = "builtin",
- ["textureGatherOffset"] = "builtin",
- ["textureGatherOffsets"] = "builtin",
+ ["radians"] = "keyword",
+ ["degrees"] = "keyword",
+ ["sin"] = "keyword",
+ ["cos"] = "keyword",
+ ["tan"] = "keyword",
+ ["asin"] = "keyword",
+ ["acos"] = "keyword",
+ ["atan"] = "keyword",
+ ["sinh"] = "keyword",
+ ["cosh"] = "keyword",
+ ["tanh"] = "keyword",
+ ["asinh"] = "keyword",
+ ["acosh"] = "keyword",
+ ["pow"] = "keyword",
+ ["exp"] = "keyword",
+ ["exp2"] = "keyword",
+ ["log2"] = "keyword",
+ ["sqrt"] = "keyword",
+ ["inversesqrt"] = "keyword",
+ ["abs"] = "keyword",
+ ["sign"] = "keyword",
+ ["floor"] = "keyword",
+ ["trunc"] = "keyword",
+ ["round"] = "keyword",
+ ["roundEven"] = "keyword",
+ ["ceil"] = "keyword",
+ ["fract"] = "keyword",
+ ["mod"] = "keyword",
+ ["modf"] = "keyword",
+ ["min"] = "keyword",
+ ["max"] = "keyword",
+ ["clamp"] = "keyword",
+ ["mix"] = "keyword",
+ ["step"] = "keyword",
+ ["smoothstep"] = "keyword",
+ ["isnan"] = "keyword",
+ ["isinf"] = "keyword",
+ ["floatBitsToInt"] = "keyword",
+ ["floatBitsToUint"] = "keyword",
+ ["intBitsToFloat"] = "keyword",
+ ["uintBitsToFloat"] = "keyword",
+ ["fma"] = "keyword",
+ ["frexp"] = "keyword",
+ ["ldexp"] = "keyword",
+ ["packUnorm2x16"] = "keyword",
+ ["packSnorm2x16"] = "keyword",
+ ["packUnorm4x8"] = "keyword",
+ ["packSnorm4x8"] = "keyword",
+ ["unpackUnorm2x16"] = "keyword",
+ ["unpackSnorm2x16"] = "keyword",
+ ["unpackUnorm4x8"] = "keyword",
+ ["unpackSnorm4x8"] = "keyword",
+ ["packHalf2x16"] = "keyword",
+ ["unpackHalf2x16"] = "keyword",
+ ["packDouble2x32"] = "keyword",
+ ["unpackDouble2x32"] = "keyword",
+ ["length"] = "keyword",
+ ["distance"] = "keyword",
+ ["dot"] = "keyword",
+ ["cross"] = "keyword",
+ ["normalize"] = "keyword",
+ ["ftransform"] = "keyword",
+ ["faceforward"] = "keyword",
+ ["reflect"] = "keyword",
+ ["refract"] = "keyword",
+ ["matrixCompMult"] = "keyword",
+ ["outerProduct"] = "keyword",
+ ["transpose"] = "keyword",
+ ["determinant"] = "keyword",
+ ["inverse"] = "keyword",
+ ["lessThan"] = "keyword",
+ ["lessThanEqual"] = "keyword",
+ ["greaterThan"] = "keyword",
+ ["greaterThanEqual"] = "keyword",
+ ["equal"] = "keyword",
+ ["notEqual"] = "keyword",
+ ["any"] = "keyword",
+ ["all"] = "keyword",
+ ["not"] = "keyword",
+ ["uaddCarry"] = "keyword",
+ ["usubBorrow"] = "keyword",
+ ["umulExtended"] = "keyword",
+ ["imulExtended"] = "keyword",
+ ["bitfieldExtract"] = "keyword",
+ ["bitfieldInsert"] = "keyword",
+ ["bitfieldReverse"] = "keyword",
+ ["bitCount"] = "keyword",
+ ["findLSB"] = "keyword",
+ ["findMSB"] = "keyword",
+ ["textureSize"] = "keyword",
+ ["textureQueryLod"] = "keyword",
+ ["textureQueryLevels"] = "keyword",
+ ["textureSamples"] = "keyword",
+ ["texture"] = "keyword",
+ ["textureProj"] = "keyword",
+ ["textureLod"] = "keyword",
+ ["textureOffset"] = "keyword",
+ ["texelFetch"] = "keyword",
+ ["texelFetchOffset"] = "keyword",
+ ["textureProjOffset"] = "keyword",
+ ["textureLodOffset"] = "keyword",
+ ["textureProjLod"] = "keyword",
+ ["textureProjLodOffset"] = "keyword",
+ ["textureGrad"] = "keyword",
+ ["textureGradOffset"] = "keyword",
+ ["textureProjGrad"] = "keyword",
+ ["textureProjGradOffset"]= "keyword",
+ ["textureGather"] = "keyword",
+ ["textureGatherOffset"] = "keyword",
+ ["textureGatherOffsets"] = "keyword",
--Atomic Counter Functions
- ["atomicCounterIncrement"]= "builtin",
- ["atomicCounterDecrement"]= "builtin",
- ["atomicCounter"] = "builtin",
- ["atomicCounterAdd"] = "builtin",
- ["atomicCounterSubtract"] = "builtin",
- ["atomicCounterMin"] = "builtin",
- ["atomicCounterMax"] = "builtin",
- ["atomicCounterAnd"] = "builtin",
- ["atomicCounterOr"] = "builtin",
- ["atomicCounterXor"] = "builtin",
- ["atomicCounterExchange"] = "builtin",
- ["atomicCounterCompSwap"] = "builtin",
+ ["atomicCounterIncrement"]= "keyword",
+ ["atomicCounterDecrement"]= "keyword",
+ ["atomicCounter"] = "keyword",
+ ["atomicCounterAdd"] = "keyword",
+ ["atomicCounterSubtract"] = "keyword",
+ ["atomicCounterMin"] = "keyword",
+ ["atomicCounterMax"] = "keyword",
+ ["atomicCounterAnd"] = "keyword",
+ ["atomicCounterOr"] = "keyword",
+ ["atomicCounterXor"] = "keyword",
+ ["atomicCounterExchange"] = "keyword",
+ ["atomicCounterCompSwap"] = "keyword",
--Atomic Memory Functions
- ["atomicAdd"] = "builtin",
- ["atomicMin"] = "builtin",
- ["atomicMax"] = "builtin",
- ["atomicAnd"] = "builtin",
- ["atomicOr"] = "builtin",
- ["atomicXor"] = "builtin",
- ["atomicExchange"]= "builtin",
- ["atomicCompSwap"]= "builtin",
+ ["atomicAdd"] = "keyword",
+ ["atomicMin"] = "keyword",
+ ["atomicMax"] = "keyword",
+ ["atomicAnd"] = "keyword",
+ ["atomicOr"] = "keyword",
+ ["atomicXor"] = "keyword",
+ ["atomicExchange"]= "keyword",
+ ["atomicCompSwap"]= "keyword",
--Image Functions
- ["imageSize"] = "builtin",
- ["imageSamples"] = "builtin",
- ["imageLoad"] = "builtin",
- ["imageStore"] = "builtin",
- ["imageAtomicAdd"] = "builtin",
- ["imageAtomicMin"] = "builtin",
- ["imageAtomicMax"] = "builtin",
- ["imageAtomicAnd"] = "builtin",
- ["imageAtomicOr"] = "builtin",
- ["imageAtomicXor"] = "builtin",
- ["imageAtomicExchange"]= "builtin",
- ["imageAtomicCompSwap"]= "builtin",
+ ["imageSize"] = "keyword",
+ ["imageSamples"] = "keyword",
+ ["imageLoad"] = "keyword",
+ ["imageStore"] = "keyword",
+ ["imageAtomicAdd"] = "keyword",
+ ["imageAtomicMin"] = "keyword",
+ ["imageAtomicMax"] = "keyword",
+ ["imageAtomicAnd"] = "keyword",
+ ["imageAtomicOr"] = "keyword",
+ ["imageAtomicXor"] = "keyword",
+ ["imageAtomicExchange"]= "keyword",
+ ["imageAtomicCompSwap"]= "keyword",
--Geometry Shader Functions
- ["EmitStreamVertex"] = "builtin",
- ["EndStreamPrimitive"] = "builtin",
- ["EmitVertex"] = "builtin",
- ["EndPrimitive"] = "builtin",
+ ["EmitStreamVertex"] = "keyword",
+ ["EndStreamPrimitive"] = "keyword",
+ ["EmitVertex"] = "keyword",
+ ["EndPrimitive"] = "keyword",
--Fragment Processing Functions
- ["dFdx"] = "builtin",
- ["dFdy"] = "builtin",
- ["dFdxFine"] = "builtin",
- ["dFdyFine"] = "builtin",
- ["dFdxCoarse"] = "builtin",
- ["dFdyCoarse"] = "builtin",
- ["fwidth"] = "builtin",
- ["fwidthFine"] = "builtin",
- ["fwidthCoarse"] = "builtin",
- ["interpolateAtCentroid"]= "builtin",
- ["interpolateAtSample"] = "builtin",
- ["interpolateAtOffset"] = "builtin",
+ ["dFdx"] = "keyword",
+ ["dFdy"] = "keyword",
+ ["dFdxFine"] = "keyword",
+ ["dFdyFine"] = "keyword",
+ ["dFdxCoarse"] = "keyword",
+ ["dFdyCoarse"] = "keyword",
+ ["fwidth"] = "keyword",
+ ["fwidthFine"] = "keyword",
+ ["fwidthCoarse"] = "keyword",
+ ["interpolateAtCentroid"]= "keyword",
+ ["interpolateAtSample"] = "keyword",
+ ["interpolateAtOffset"] = "keyword",
--Shader Invocation Control Functions
- ["barrier"] = "builtin",
+ ["barrier"] = "keyword",
--Shader Memory Control Functions
- ["memoryBarrier"] = "builtin",
- ["memoryBarrierAtomicCounter"]= "builtin",
- ["memoryBarrierBuffer"] = "builtin",
- ["memoryBarrierShared"] = "builtin",
- ["memoryBarrierImage"] = "builtin",
- ["groupMemoryBarrier"] = "builtin",
+ ["memoryBarrier"] = "keyword",
+ ["memoryBarrierAtomicCounter"]= "keyword",
+ ["memoryBarrierBuffer"] = "keyword",
+ ["memoryBarrierShared"] = "keyword",
+ ["memoryBarrierImage"] = "keyword",
+ ["groupMemoryBarrier"] = "keyword",
--Subpass-Input Functions
- ["subpassLoad"] = "builtin",
+ ["subpassLoad"] = "keyword",
--Shader Invocation Group Functions
- ["anyInvocation"] = "builtin",
- ["allInvocations"] = "builtin",
- ["allInvocationsEqual"]= "builtin",
+ ["anyInvocation"] = "keyword",
+ ["allInvocations"] = "keyword",
+ ["allInvocationsEqual"]= "keyword",
--"In addition, when targeting Vulkan, the following keywords also exist:"
- ["texture1D"] = "builtin",
- ["texture1DArray"] = "builtin",
- ["itexture1D"] = "builtin",
- ["itexture1DArray"] = "builtin",
- ["utexture1D"] = "builtin",
- ["utexture1DArray"] = "builtin",
- ["texture2D"] = "builtin",
- ["texture2DArray"] = "builtin",
- ["itexture2D"] = "builtin",
- ["itexture2DArray"] = "builtin",
- ["utexture2D"] = "builtin",
- ["utexture2DArray"] = "builtin",
- ["texture2DRect"] = "builtin",
- ["itexture2DRect"] = "builtin",
- ["utexture2DRect"] = "builtin",
- ["texture2DMS"] = "builtin",
- ["itexture2DMS"] = "builtin",
- ["utexture2DMS"] = "builtin",
- ["texture2DMSArray"] = "builtin",
- ["itexture2DMSArray"]= "builtin",
- ["utexture2DMSArray"]= "builtin",
- ["texture3D"] = "builtin",
- ["itexture3D"] = "builtin",
- ["utexture3D"] = "builtin",
- ["textureCube"] = "builtin",
- ["itextureCube"] = "builtin",
- ["utextureCube"] = "builtin",
- ["textureCubeArray"] = "builtin",
- ["itextureCubeArray"]= "builtin",
- ["utextureCubeArray"]= "builtin",
- ["textureBuffer"] = "builtin",
- ["itextureBuffer"] = "builtin",
- ["utextureBuffer"] = "builtin",
+ ["texture1D"] = "keyword",
+ ["texture1DArray"] = "keyword",
+ ["itexture1D"] = "keyword",
+ ["itexture1DArray"] = "keyword",
+ ["utexture1D"] = "keyword",
+ ["utexture1DArray"] = "keyword",
+ ["texture2D"] = "keyword",
+ ["texture2DArray"] = "keyword",
+ ["itexture2D"] = "keyword",
+ ["itexture2DArray"] = "keyword",
+ ["utexture2D"] = "keyword",
+ ["utexture2DArray"] = "keyword",
+ ["texture2DRect"] = "keyword",
+ ["itexture2DRect"] = "keyword",
+ ["utexture2DRect"] = "keyword",
+ ["texture2DMS"] = "keyword",
+ ["itexture2DMS"] = "keyword",
+ ["utexture2DMS"] = "keyword",
+ ["texture2DMSArray"] = "keyword",
+ ["itexture2DMSArray"]= "keyword",
+ ["utexture2DMSArray"]= "keyword",
+ ["texture3D"] = "keyword",
+ ["itexture3D"] = "keyword",
+ ["utexture3D"] = "keyword",
+ ["textureCube"] = "keyword",
+ ["itextureCube"] = "keyword",
+ ["utextureCube"] = "keyword",
+ ["textureCubeArray"] = "keyword",
+ ["itextureCubeArray"]= "keyword",
+ ["utextureCubeArray"]= "keyword",
+ ["textureBuffer"] = "keyword",
+ ["itextureBuffer"] = "keyword",
+ ["utextureBuffer"] = "keyword",
["sampler"] = "keyword2",
["samplerShadow"] = "keyword2",
["subpassInput"] = "keyword2",
@@ -420,65 +382,6 @@ syntax.add {
["subpassInputMS"] = "keyword2",
["isubpassInputMS"] = "keyword2",
["usubpassInputMS"] = "keyword2",
-
- --"The following are the keywords reserved for future use. Using them will result in a compile-time error:"
- ["common"] = "forbiddenbuiltin",
- ["partition"] = "forbiddenbuiltin",
- ["active"] = "forbiddenbuiltin",
- ["asm"] = "forbiddenbuiltin",
- ["class"] = "forbiddenbuiltin",
- ["union"] = "forbiddenbuiltin",
- ["enum"] = "forbiddenbuiltin",
- ["typedef"] = "forbiddenbuiltin",
- ["template"] = "forbiddenbuiltin",
- ["this"] = "forbiddenbuiltin",
- ["resource"] = "forbiddenbuiltin",
- ["goto"] = "forbiddenbuiltin",
- ["inline"] = "forbiddenbuiltin",
- ["noinline"] = "forbiddenbuiltin",
- ["public"] = "forbiddenbuiltin",
- ["static"] = "forbiddenbuiltin",
- ["extern"] = "forbiddenbuiltin",
- ["external"] = "forbiddenbuiltin",
- ["interface"] = "forbiddenbuiltin",
- ["long"] = "forbiddenbuiltin",
- ["short"] = "forbiddenbuiltin",
- ["half"] = "forbiddenbuiltin",
- ["fixed"] = "forbiddenbuiltin",
- ["unsigned"] = "forbiddenbuiltin",
- ["superp"] = "forbiddenbuiltin",
- ["input"] = "forbiddenbuiltin",
- ["output"] = "forbiddenbuiltin",
- ["hvec2"] = "forbiddenbuiltin",
- ["hvec3"] = "forbiddenbuiltin",
- ["hvec4"] = "forbiddenbuiltin",
- ["fvec2"] = "forbiddenbuiltin",
- ["fvec3"] = "forbiddenbuiltin",
- ["fvec4"] = "forbiddenbuiltin",
- ["filter"] = "forbiddenbuiltin",
- ["sizeof"] = "forbiddenbuiltin",
- ["cast"] = "forbiddenbuiltin",
- ["namespace"] = "forbiddenbuiltin",
- ["using"] = "forbiddenbuiltin",
- ["sampler3DRect"]= "forbiddenbuiltin",
-
- --common symbols in HLSL that don't exist in GLSL
- ["frac"] = "forbiddenbuiltin",
- ["lerp"] = "forbiddenbuiltin",
- ["mul"] = "forbiddenbuiltin",
- ["min16float"] = "forbiddenbuiltin",
- ["min10float"] = "forbiddenbuiltin",
- ["min16int"] = "forbiddenbuiltin",
- ["min12int"] = "forbiddenbuiltin",
- ["min16uint"] = "forbiddenbuiltin",
- ["rsqrt"] = "forbiddenbuiltin",
- ["ddx"] = "forbiddenbuiltin",
- ["ddx_coarse"] = "forbiddenbuiltin",
- ["ddx_fine"] = "forbiddenbuiltin",
- ["ddy"] = "forbiddenbuiltin",
- ["ddy_coarse"] = "forbiddenbuiltin",
- ["ddy_fine"] = "forbiddenbuiltin",
-
},
}
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",
},
}