diff options
author | pommicket <pommicket@gmail.com> | 2022-12-28 18:10:34 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-28 18:10:34 -0500 |
commit | 92c2f6c5db7606515948b233470181c119f7e308 (patch) | |
tree | e77c345cdfcc2e398d9395ec0fe262ce133d42b7 /keywords.py | |
parent | 8ef7a72c55e66c097c0130ab17e2062ef75e4723 (diff) |
GLSL syntax highlighting
Diffstat (limited to 'keywords.py')
-rwxr-xr-x | keywords.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/keywords.py b/keywords.py index 1779811..72de967 100755 --- a/keywords.py +++ b/keywords.py @@ -125,6 +125,70 @@ builtins_c = [ 'tss_dtor_t', 'thrd_start_t', 'once_flag', 'xtime', 'clock_t', 'time_t', 'wctrans_t', 'wctype_t', ] + +# see https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.html#keywords +keywords_glsl = [ + 'const', 'uniform', 'buffer', 'shared', 'attribute', 'varying', 'coherent', + 'volatile', 'restrict', 'readonly', 'writeonly', 'atomic_uint', 'layout', + 'centroid', 'flat', 'smooth', 'noperspective', 'patch', 'sample', 'invariant', + 'precise', 'break', 'continue', 'do', 'for', 'while', 'switch', 'case', 'default', + 'if', 'else', 'subroutine', 'in', 'out', 'inout', 'int', 'void', 'bool', 'true', + 'false', 'float', 'double', 'discard', 'return', 'vec2', 'vec3', 'vec4', 'ivec2', + 'ivec3', 'ivec4', 'bvec2', 'bvec3', 'bvec4', 'uint', 'uvec2', 'uvec3', 'uvec4', + 'dvec2', 'dvec3', 'dvec4', 'mat2', 'mat3', 'mat4', 'mat2x2', 'mat2x3', 'mat2x4', + 'mat3x2', 'mat3x3', 'mat3x4', 'mat4x2', 'mat4x3', 'mat4x4', 'dmat2', 'dmat3', 'dmat4', + 'dmat2x2', 'dmat2x3', 'dmat2x4', 'dmat3x2', 'dmat3x3', 'dmat3x4', 'dmat4x2', 'dmat4x3', + 'dmat4x4', 'lowp', 'mediump', 'highp', 'precision', 'sampler1D', 'sampler1DShadow', + 'sampler1DArray', 'sampler1DArrayShadow', 'isampler1D', 'isampler1DArray', 'usampler1D', + 'usampler1DArray', 'sampler2D', 'sampler2DShadow', 'sampler2DArray', 'sampler2DArrayShadow', + 'isampler2D', 'isampler2DArray', 'usampler2D', 'usampler2DArray', 'sampler2DRect', + 'sampler2DRectShadow', 'isampler2DRect', 'usampler2DRect', 'sampler2DMS', 'isampler2DMS', + 'usampler2DMS', 'sampler2DMSArray', 'isampler2DMSArray', 'usampler2DMSArray', 'sampler3D', + 'isampler3D', 'usampler3D', 'samplerCube', 'samplerCubeShadow', 'isamplerCube', 'usamplerCube', + 'samplerCubeArray', 'samplerCubeArrayShadow', 'isamplerCubeArray', 'usamplerCubeArray', 'samplerBuffer', + 'isamplerBuffer', 'usamplerBuffer', 'image1D', 'iimage1D', 'uimage1D', 'image1DArray', 'iimage1DArray', + 'uimage1DArray', 'image2D', 'iimage2D', 'uimage2D', 'image2DArray', 'iimage2DArray', 'uimage2DArray', + 'image2DRect', 'iimage2DRect', 'uimage2DRect', 'image2DMS', 'iimage2DMS', 'uimage2DMS', + 'image2DMSArray', 'iimage2DMSArray', 'uimage2DMSArray', 'image3D', 'iimage3D', 'uimage3D', + 'imageCube', 'iimageCube', 'uimageCube', 'imageCubeArray', 'iimageCubeArray', 'uimageCubeArray', + 'imageBuffer', 'iimageBuffer', 'uimageBuffer', 'struct' +] + +# extracted from https://registry.khronos.org/OpenGL-Refpages/gl4/index.php +builtins_glsl = ['abs', 'acos', 'acosh', 'all', 'any', 'asin', 'asinh', 'atan', 'atanh', + 'atomicAdd', 'atomicAnd', 'atomicCompSwap', 'atomicCounter', 'atomicCounterDecrement', + 'atomicCounterIncrement', 'atomicExchange', 'atomicMax', 'atomicMin', 'atomicOr', + 'atomicXor', 'barrier', 'bitCount', 'bitfieldExtract', 'bitfieldInsert', 'bitfieldReverse', + 'ceil', 'clamp', 'cos', 'cosh', 'cross', 'degrees', 'determinant', 'dFdx', 'dFdxCoarse', + 'dFdxFine', 'dFdy', 'dFdyCoarse', 'dFdyFine', 'distance', 'dot', 'EmitStreamVertex', 'EmitVertex', + 'EndPrimitive', 'EndStreamPrimitive', 'equal', 'exp', 'exp2', 'faceforward', 'findLSB', 'findMSB', + 'floatBitsToInt', 'floatBitsToUint', 'floor', 'fma', 'fract', 'frexp', 'fwidth', 'fwidthCoarse', + 'fwidthFine', 'gl_ClipDistance', 'gl_CullDistance', 'gl_FragCoord', 'gl_FragDepth', 'gl_FrontFacing', + 'gl_GlobalInvocationID', 'gl_HelperInvocation', 'gl_InstanceID', 'gl_InvocationID', 'gl_Layer', + 'gl_LocalInvocationID', 'gl_LocalInvocationIndex', 'gl_NumSamples', 'gl_NumWorkGroups', + 'gl_PatchVerticesIn', 'gl_PointCoord', 'gl_PointSize', 'gl_Position', 'gl_PrimitiveID', + 'gl_PrimitiveIDIn', 'gl_SampleID', 'gl_SampleMask', 'gl_SampleMaskIn', 'gl_SamplePosition', + 'gl_TessCoord', 'gl_TessLevelInner', 'gl_TessLevelOuter', 'gl_VertexID', 'gl_ViewportIndex', + 'gl_WorkGroupID', 'gl_WorkGroupSize', 'greaterThan', 'greaterThanEqual', 'groupMemoryBarrier', + 'imageAtomicAdd', 'imageAtomicAnd', 'imageAtomicCompSwap', 'imageAtomicExchange', 'imageAtomicMax', + 'imageAtomicMin', 'imageAtomicOr', 'imageAtomicXor', 'imageLoad', 'imageSamples', 'imageSize', + 'imageStore', 'imulExtended', 'intBitsToFloat', 'interpolateAtCentroid', 'interpolateAtOffset', + 'interpolateAtSample', 'inverse', 'inversesqrt', 'isinf', 'isnan', 'ldexp', 'length', 'lessThan', + 'lessThanEqual', 'log', 'log2', 'matrixCompMult', 'max', 'memoryBarrier', 'memoryBarrierAtomicCounter', + 'memoryBarrierBuffer', 'memoryBarrierImage', 'memoryBarrierShared', 'min', 'mix', 'mod', 'modf', + 'noise', 'noise1', 'noise2', 'noise3', 'noise4', 'normalize', 'not', 'notEqual', 'outerProduct', + 'packDouble2x32', 'packHalf2x16', 'packSnorm2x16', 'packSnorm4x8', 'packUnorm', 'packUnorm2x16', + 'packUnorm4x8', 'pow', 'radians', 'reflect', 'refract', 'removedTypes', 'round', 'roundEven', + 'sign', 'sin', 'sinh', 'smoothstep', 'sqrt', 'step', 'tan', 'tanh', 'texelFetch', 'texelFetchOffset', + 'texture', 'textureGather', 'textureGatherOffset', 'textureGatherOffsets', 'textureGrad', + 'textureGradOffset', 'textureLod', 'textureLodOffset', 'textureOffset', 'textureProj', + 'textureProjGrad', 'textureProjGradOffset', 'textureProjLod', 'textureProjLodOffset', + 'textureProjOffset', 'textureQueryLevels', 'textureQueryLod', 'textureSamples', 'textureSize', + 'transpose', 'trunc', 'uaddCarry', 'uintBitsToFloat', 'umulExtended', 'unpackDouble2x32', + 'unpackHalf2x16', 'unpackSnorm2x16', 'unpackSnorm4x8', 'unpackUnorm', 'unpackUnorm2x16', + 'unpackUnorm4x8', 'usubBorrow'] +constants_glsl = [] + for x in ['char', 'char16_t', 'char32_t', 'wchar_t', 'short', 'int', 'long', 'llong', 'address', 'flag']: @@ -381,4 +445,6 @@ output_keywords(file, label(keywords_java, SYNTAX_KEYWORD) + label(constants_jav output_keywords(file, label(keywords_python, SYNTAX_KEYWORD) + label(builtins_python, SYNTAX_BUILTIN), 'python') output_keywords(file, label(builtins_html, SYNTAX_BUILTIN), 'html') output_keywords(file, label(constants_config, SYNTAX_CONSTANT), 'config') +output_keywords(file, label(keywords_glsl, SYNTAX_KEYWORD) + label(constants_glsl, SYNTAX_CONSTANT) + + label(builtins_glsl, SYNTAX_BUILTIN), 'glsl') file.close() |