diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/python/Pygments/py2/pygments/lexers/graphics.py | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/Pygments/py2/pygments/lexers/graphics.py')
-rw-r--r-- | contrib/python/Pygments/py2/pygments/lexers/graphics.py | 506 |
1 files changed, 253 insertions, 253 deletions
diff --git a/contrib/python/Pygments/py2/pygments/lexers/graphics.py b/contrib/python/Pygments/py2/pygments/lexers/graphics.py index b0b9145e0a..a60a403b7a 100644 --- a/contrib/python/Pygments/py2/pygments/lexers/graphics.py +++ b/contrib/python/Pygments/py2/pygments/lexers/graphics.py @@ -5,7 +5,7 @@ Lexers for computer graphics and plotting related languages. - :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -15,7 +15,7 @@ from pygments.token import Text, Comment, Operator, Keyword, Name, \ Number, Punctuation, String __all__ = ['GLShaderLexer', 'PostScriptLexer', 'AsymptoteLexer', 'GnuplotLexer', - 'PovrayLexer', 'HLSLShaderLexer'] + 'PovrayLexer', 'HLSLShaderLexer'] class GLShaderLexer(RegexLexer): @@ -46,102 +46,102 @@ class GLShaderLexer(RegexLexer): (r'0[0-7]*', Number.Oct), (r'[1-9][0-9]*', Number.Integer), (words(( - # Storage qualifiers - 'attribute', 'const', 'uniform', 'varying', - 'buffer', 'shared', 'in', 'out', - # Layout qualifiers - 'layout', - # Interpolation qualifiers - 'flat', 'smooth', 'noperspective', - # Auxiliary qualifiers - 'centroid', 'sample', 'patch', - # Parameter qualifiers. Some double as Storage qualifiers - 'inout', - # Precision qualifiers - 'lowp', 'mediump', 'highp', 'precision', - # Invariance qualifiers - 'invariant', - # Precise qualifiers - 'precise', - # Memory qualifiers - 'coherent', 'volatile', 'restrict', 'readonly', 'writeonly', - # Statements - 'break', 'continue', 'do', 'for', 'while', 'switch', - 'case', 'default', 'if', 'else', 'subroutine', - 'discard', 'return', 'struct'), + # Storage qualifiers + 'attribute', 'const', 'uniform', 'varying', + 'buffer', 'shared', 'in', 'out', + # Layout qualifiers + 'layout', + # Interpolation qualifiers + 'flat', 'smooth', 'noperspective', + # Auxiliary qualifiers + 'centroid', 'sample', 'patch', + # Parameter qualifiers. Some double as Storage qualifiers + 'inout', + # Precision qualifiers + 'lowp', 'mediump', 'highp', 'precision', + # Invariance qualifiers + 'invariant', + # Precise qualifiers + 'precise', + # Memory qualifiers + 'coherent', 'volatile', 'restrict', 'readonly', 'writeonly', + # Statements + 'break', 'continue', 'do', 'for', 'while', 'switch', + 'case', 'default', 'if', 'else', 'subroutine', + 'discard', 'return', 'struct'), prefix=r'\b', suffix=r'\b'), Keyword), (words(( - # Boolean values - 'true', 'false'), + # Boolean values + 'true', 'false'), prefix=r'\b', suffix=r'\b'), - Keyword.Constant), - (words(( - # Miscellaneous types - 'void', 'atomic_uint', - # Floating-point scalars and vectors - 'float', 'vec2', 'vec3', 'vec4', - 'double', 'dvec2', 'dvec3', 'dvec4', - # Integer scalars and vectors - 'int', 'ivec2', 'ivec3', 'ivec4', - 'uint', 'uvec2', 'uvec3', 'uvec4', - # Boolean scalars and vectors - 'bool', 'bvec2', 'bvec3', 'bvec4', - # Matrices - 'mat2', 'mat3', 'mat4', 'dmat2', 'dmat3', 'dmat4', - 'mat2x2', 'mat2x3', 'mat2x4', 'dmat2x2', 'dmat2x3', 'dmat2x4', - 'mat3x2', 'mat3x3', 'mat3x4', 'dmat3x2', 'dmat3x3', - 'dmat3x4', 'mat4x2', 'mat4x3', 'mat4x4', 'dmat4x2', 'dmat4x3', 'dmat4x4', - # Floating-point samplers - 'sampler1D', 'sampler2D', 'sampler3D', 'samplerCube', - 'sampler1DArray', 'sampler2DArray', 'samplerCubeArray', - 'sampler2DRect', 'samplerBuffer', - 'sampler2DMS', 'sampler2DMSArray', - # Shadow samplers - 'sampler1DShadow', 'sampler2DShadow', 'samplerCubeShadow', - 'sampler1DArrayShadow', 'sampler2DArrayShadow', - 'samplerCubeArrayShadow', 'sampler2DRectShadow', - # Signed integer samplers - 'isampler1D', 'isampler2D', 'isampler3D', 'isamplerCube', - 'isampler1DArray', 'isampler2DArray', 'isamplerCubeArray', - 'isampler2DRect', 'isamplerBuffer', - 'isampler2DMS', 'isampler2DMSArray', - # Unsigned integer samplers - 'usampler1D', 'usampler2D', 'usampler3D', 'usamplerCube', - 'usampler1DArray', 'usampler2DArray', 'usamplerCubeArray', - 'usampler2DRect', 'usamplerBuffer', - 'usampler2DMS', 'usampler2DMSArray', - # Floating-point image types - 'image1D', 'image2D', 'image3D', 'imageCube', - 'image1DArray', 'image2DArray', 'imageCubeArray', - 'image2DRect', 'imageBuffer', - 'image2DMS', 'image2DMSArray', - # Signed integer image types - 'iimage1D', 'iimage2D', 'iimage3D', 'iimageCube', - 'iimage1DArray', 'iimage2DArray', 'iimageCubeArray', - 'iimage2DRect', 'iimageBuffer', - 'iimage2DMS', 'iimage2DMSArray', - # Unsigned integer image types - 'uimage1D', 'uimage2D', 'uimage3D', 'uimageCube', - 'uimage1DArray', 'uimage2DArray', 'uimageCubeArray', - 'uimage2DRect', 'uimageBuffer', - 'uimage2DMS', 'uimage2DMSArray'), - prefix=r'\b', suffix=r'\b'), - Keyword.Type), - (words(( - # Reserved for future use. - 'common', 'partition', 'active', 'asm', 'class', - 'union', 'enum', 'typedef', 'template', 'this', - 'resource', 'goto', 'inline', 'noinline', 'public', - 'static', 'extern', 'external', 'interface', 'long', - 'short', 'half', 'fixed', 'unsigned', 'superp', 'input', - 'output', 'hvec2', 'hvec3', 'hvec4', 'fvec2', 'fvec3', - 'fvec4', 'sampler3DRect', 'filter', 'sizeof', 'cast', - 'namespace', 'using'), - prefix=r'\b', suffix=r'\b'), - Keyword.Reserved), - # All names beginning with "gl_" are reserved. - (r'gl_\w*', Name.Builtin), + Keyword.Constant), + (words(( + # Miscellaneous types + 'void', 'atomic_uint', + # Floating-point scalars and vectors + 'float', 'vec2', 'vec3', 'vec4', + 'double', 'dvec2', 'dvec3', 'dvec4', + # Integer scalars and vectors + 'int', 'ivec2', 'ivec3', 'ivec4', + 'uint', 'uvec2', 'uvec3', 'uvec4', + # Boolean scalars and vectors + 'bool', 'bvec2', 'bvec3', 'bvec4', + # Matrices + 'mat2', 'mat3', 'mat4', 'dmat2', 'dmat3', 'dmat4', + 'mat2x2', 'mat2x3', 'mat2x4', 'dmat2x2', 'dmat2x3', 'dmat2x4', + 'mat3x2', 'mat3x3', 'mat3x4', 'dmat3x2', 'dmat3x3', + 'dmat3x4', 'mat4x2', 'mat4x3', 'mat4x4', 'dmat4x2', 'dmat4x3', 'dmat4x4', + # Floating-point samplers + 'sampler1D', 'sampler2D', 'sampler3D', 'samplerCube', + 'sampler1DArray', 'sampler2DArray', 'samplerCubeArray', + 'sampler2DRect', 'samplerBuffer', + 'sampler2DMS', 'sampler2DMSArray', + # Shadow samplers + 'sampler1DShadow', 'sampler2DShadow', 'samplerCubeShadow', + 'sampler1DArrayShadow', 'sampler2DArrayShadow', + 'samplerCubeArrayShadow', 'sampler2DRectShadow', + # Signed integer samplers + 'isampler1D', 'isampler2D', 'isampler3D', 'isamplerCube', + 'isampler1DArray', 'isampler2DArray', 'isamplerCubeArray', + 'isampler2DRect', 'isamplerBuffer', + 'isampler2DMS', 'isampler2DMSArray', + # Unsigned integer samplers + 'usampler1D', 'usampler2D', 'usampler3D', 'usamplerCube', + 'usampler1DArray', 'usampler2DArray', 'usamplerCubeArray', + 'usampler2DRect', 'usamplerBuffer', + 'usampler2DMS', 'usampler2DMSArray', + # Floating-point image types + 'image1D', 'image2D', 'image3D', 'imageCube', + 'image1DArray', 'image2DArray', 'imageCubeArray', + 'image2DRect', 'imageBuffer', + 'image2DMS', 'image2DMSArray', + # Signed integer image types + 'iimage1D', 'iimage2D', 'iimage3D', 'iimageCube', + 'iimage1DArray', 'iimage2DArray', 'iimageCubeArray', + 'iimage2DRect', 'iimageBuffer', + 'iimage2DMS', 'iimage2DMSArray', + # Unsigned integer image types + 'uimage1D', 'uimage2D', 'uimage3D', 'uimageCube', + 'uimage1DArray', 'uimage2DArray', 'uimageCubeArray', + 'uimage2DRect', 'uimageBuffer', + 'uimage2DMS', 'uimage2DMSArray'), + prefix=r'\b', suffix=r'\b'), + Keyword.Type), + (words(( + # Reserved for future use. + 'common', 'partition', 'active', 'asm', 'class', + 'union', 'enum', 'typedef', 'template', 'this', + 'resource', 'goto', 'inline', 'noinline', 'public', + 'static', 'extern', 'external', 'interface', 'long', + 'short', 'half', 'fixed', 'unsigned', 'superp', 'input', + 'output', 'hvec2', 'hvec3', 'hvec4', 'fvec2', 'fvec3', + 'fvec4', 'sampler3DRect', 'filter', 'sizeof', 'cast', + 'namespace', 'using'), + prefix=r'\b', suffix=r'\b'), + Keyword.Reserved), + # All names beginning with "gl_" are reserved. + (r'gl_\w*', Name.Builtin), (r'[a-zA-Z_]\w*', Name), (r'\.', Punctuation), (r'\s+', Text), @@ -149,160 +149,160 @@ class GLShaderLexer(RegexLexer): } -class HLSLShaderLexer(RegexLexer): - """ - HLSL (Microsoft Direct3D Shader) lexer. - - .. versionadded:: 2.3 - """ - name = 'HLSL' - aliases = ['hlsl'] - filenames = ['*.hlsl', '*.hlsli'] - mimetypes = ['text/x-hlsl'] - - tokens = { - 'root': [ - (r'^#.*', Comment.Preproc), - (r'//.*', Comment.Single), - (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), - (r'\+|-|~|!=?|\*|/|%|<<|>>|<=?|>=?|==?|&&?|\^|\|\|?', - Operator), - (r'[?:]', Operator), # quick hack for ternary - (r'\bdefined\b', Operator), - (r'[;{}(),.\[\]]', Punctuation), - # FIXME when e is present, no decimal point needed - (r'[+-]?\d*\.\d+([eE][-+]?\d+)?f?', Number.Float), - (r'[+-]?\d+\.\d*([eE][-+]?\d+)?f?', Number.Float), - (r'0[xX][0-9a-fA-F]*', Number.Hex), - (r'0[0-7]*', Number.Oct), - (r'[1-9][0-9]*', Number.Integer), - (r'"', String, 'string'), - (words(( - 'asm','asm_fragment','break','case','cbuffer','centroid','class', - 'column_major','compile','compile_fragment','const','continue', - 'default','discard','do','else','export','extern','for','fxgroup', - 'globallycoherent','groupshared','if','in','inline','inout', - 'interface','line','lineadj','linear','namespace','nointerpolation', - 'noperspective','NULL','out','packoffset','pass','pixelfragment', - 'point','precise','return','register','row_major','sample', - 'sampler','shared','stateblock','stateblock_state','static', - 'struct','switch','tbuffer','technique','technique10', - 'technique11','texture','typedef','triangle','triangleadj', - 'uniform','vertexfragment','volatile','while'), - prefix=r'\b', suffix=r'\b'), - Keyword), - (words(('true','false'), prefix=r'\b', suffix=r'\b'), - Keyword.Constant), - (words(( - 'auto','catch','char','const_cast','delete','dynamic_cast','enum', - 'explicit','friend','goto','long','mutable','new','operator', - 'private','protected','public','reinterpret_cast','short','signed', - 'sizeof','static_cast','template','this','throw','try','typename', - 'union','unsigned','using','virtual'), - prefix=r'\b', suffix=r'\b'), - Keyword.Reserved), - (words(( - 'dword','matrix','snorm','string','unorm','unsigned','void','vector', - 'BlendState','Buffer','ByteAddressBuffer','ComputeShader', - 'DepthStencilState','DepthStencilView','DomainShader', - 'GeometryShader','HullShader','InputPatch','LineStream', - 'OutputPatch','PixelShader','PointStream','RasterizerState', - 'RenderTargetView','RasterizerOrderedBuffer', - 'RasterizerOrderedByteAddressBuffer', - 'RasterizerOrderedStructuredBuffer','RasterizerOrderedTexture1D', - 'RasterizerOrderedTexture1DArray','RasterizerOrderedTexture2D', - 'RasterizerOrderedTexture2DArray','RasterizerOrderedTexture3D', - 'RWBuffer','RWByteAddressBuffer','RWStructuredBuffer', - 'RWTexture1D','RWTexture1DArray','RWTexture2D','RWTexture2DArray', - 'RWTexture3D','SamplerState','SamplerComparisonState', - 'StructuredBuffer','Texture1D','Texture1DArray','Texture2D', - 'Texture2DArray','Texture2DMS','Texture2DMSArray','Texture3D', - 'TextureCube','TextureCubeArray','TriangleStream','VertexShader'), - prefix=r'\b', suffix=r'\b'), - Keyword.Type), - (words(( - 'bool','double','float','int','half','min16float','min10float', - 'min16int','min12int','min16uint','uint'), - prefix=r'\b', suffix=r'([1-4](x[1-4])?)?\b'), - Keyword.Type), # vector and matrix types - (words(( - 'abort','abs','acos','all','AllMemoryBarrier', - 'AllMemoryBarrierWithGroupSync','any','AppendStructuredBuffer', - 'asdouble','asfloat','asin','asint','asuint','asuint','atan', - 'atan2','ceil','CheckAccessFullyMapped','clamp','clip', - 'CompileShader','ConsumeStructuredBuffer','cos','cosh','countbits', - 'cross','D3DCOLORtoUBYTE4','ddx','ddx_coarse','ddx_fine','ddy', - 'ddy_coarse','ddy_fine','degrees','determinant', - 'DeviceMemoryBarrier','DeviceMemoryBarrierWithGroupSync','distance', - 'dot','dst','errorf','EvaluateAttributeAtCentroid', - 'EvaluateAttributeAtSample','EvaluateAttributeSnapped','exp', - 'exp2','f16tof32','f32tof16','faceforward','firstbithigh', - 'firstbitlow','floor','fma','fmod','frac','frexp','fwidth', - 'GetRenderTargetSampleCount','GetRenderTargetSamplePosition', - 'GlobalOrderedCountIncrement','GroupMemoryBarrier', - 'GroupMemoryBarrierWithGroupSync','InterlockedAdd','InterlockedAnd', - 'InterlockedCompareExchange','InterlockedCompareStore', - 'InterlockedExchange','InterlockedMax','InterlockedMin', - 'InterlockedOr','InterlockedXor','isfinite','isinf','isnan', - 'ldexp','length','lerp','lit','log','log10','log2','mad','max', - 'min','modf','msad4','mul','noise','normalize','pow','printf', - 'Process2DQuadTessFactorsAvg','Process2DQuadTessFactorsMax', - 'Process2DQuadTessFactorsMin','ProcessIsolineTessFactors', - 'ProcessQuadTessFactorsAvg','ProcessQuadTessFactorsMax', - 'ProcessQuadTessFactorsMin','ProcessTriTessFactorsAvg', - 'ProcessTriTessFactorsMax','ProcessTriTessFactorsMin', - 'QuadReadLaneAt','QuadSwapX','QuadSwapY','radians','rcp', - 'reflect','refract','reversebits','round','rsqrt','saturate', - 'sign','sin','sincos','sinh','smoothstep','sqrt','step','tan', - 'tanh','tex1D','tex1D','tex1Dbias','tex1Dgrad','tex1Dlod', - 'tex1Dproj','tex2D','tex2D','tex2Dbias','tex2Dgrad','tex2Dlod', - 'tex2Dproj','tex3D','tex3D','tex3Dbias','tex3Dgrad','tex3Dlod', - 'tex3Dproj','texCUBE','texCUBE','texCUBEbias','texCUBEgrad', - 'texCUBElod','texCUBEproj','transpose','trunc','WaveAllBitAnd', - 'WaveAllMax','WaveAllMin','WaveAllBitOr','WaveAllBitXor', - 'WaveAllEqual','WaveAllProduct','WaveAllSum','WaveAllTrue', - 'WaveAnyTrue','WaveBallot','WaveGetLaneCount','WaveGetLaneIndex', - 'WaveGetOrderedIndex','WaveIsHelperLane','WaveOnce', - 'WavePrefixProduct','WavePrefixSum','WaveReadFirstLane', - 'WaveReadLaneAt'), - prefix=r'\b', suffix=r'\b'), - Name.Builtin), # built-in functions - (words(( - 'SV_ClipDistance','SV_ClipDistance0','SV_ClipDistance1', - 'SV_Culldistance','SV_CullDistance0','SV_CullDistance1', - 'SV_Coverage','SV_Depth','SV_DepthGreaterEqual', - 'SV_DepthLessEqual','SV_DispatchThreadID','SV_DomainLocation', - 'SV_GroupID','SV_GroupIndex','SV_GroupThreadID','SV_GSInstanceID', - 'SV_InnerCoverage','SV_InsideTessFactor','SV_InstanceID', - 'SV_IsFrontFace','SV_OutputControlPointID','SV_Position', - 'SV_PrimitiveID','SV_RenderTargetArrayIndex','SV_SampleIndex', - 'SV_StencilRef','SV_TessFactor','SV_VertexID', - 'SV_ViewportArrayIndex'), - prefix=r'\b', suffix=r'\b'), - Name.Decorator), # system-value semantics - (r'\bSV_Target[0-7]?\b', Name.Decorator), - (words(( - 'allow_uav_condition','branch','call','domain','earlydepthstencil', - 'fastopt','flatten','forcecase','instance','loop','maxtessfactor', - 'numthreads','outputcontrolpoints','outputtopology','partitioning', - 'patchconstantfunc','unroll'), - prefix=r'\b', suffix=r'\b'), - Name.Decorator), # attributes - (r'[a-zA-Z_]\w*', Name), - (r'\\$', Comment.Preproc), # backslash at end of line -- usually macro continuation - (r'\s+', Text), - ], - 'string': [ - (r'"', String, '#pop'), - (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|' - r'u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})', String.Escape), - (r'[^\\"\n]+', String), # all other characters - (r'\\\n', String), # line continuation - (r'\\', String), # stray backslash - ], - } - - +class HLSLShaderLexer(RegexLexer): + """ + HLSL (Microsoft Direct3D Shader) lexer. + + .. versionadded:: 2.3 + """ + name = 'HLSL' + aliases = ['hlsl'] + filenames = ['*.hlsl', '*.hlsli'] + mimetypes = ['text/x-hlsl'] + + tokens = { + 'root': [ + (r'^#.*', Comment.Preproc), + (r'//.*', Comment.Single), + (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), + (r'\+|-|~|!=?|\*|/|%|<<|>>|<=?|>=?|==?|&&?|\^|\|\|?', + Operator), + (r'[?:]', Operator), # quick hack for ternary + (r'\bdefined\b', Operator), + (r'[;{}(),.\[\]]', Punctuation), + # FIXME when e is present, no decimal point needed + (r'[+-]?\d*\.\d+([eE][-+]?\d+)?f?', Number.Float), + (r'[+-]?\d+\.\d*([eE][-+]?\d+)?f?', Number.Float), + (r'0[xX][0-9a-fA-F]*', Number.Hex), + (r'0[0-7]*', Number.Oct), + (r'[1-9][0-9]*', Number.Integer), + (r'"', String, 'string'), + (words(( + 'asm','asm_fragment','break','case','cbuffer','centroid','class', + 'column_major','compile','compile_fragment','const','continue', + 'default','discard','do','else','export','extern','for','fxgroup', + 'globallycoherent','groupshared','if','in','inline','inout', + 'interface','line','lineadj','linear','namespace','nointerpolation', + 'noperspective','NULL','out','packoffset','pass','pixelfragment', + 'point','precise','return','register','row_major','sample', + 'sampler','shared','stateblock','stateblock_state','static', + 'struct','switch','tbuffer','technique','technique10', + 'technique11','texture','typedef','triangle','triangleadj', + 'uniform','vertexfragment','volatile','while'), + prefix=r'\b', suffix=r'\b'), + Keyword), + (words(('true','false'), prefix=r'\b', suffix=r'\b'), + Keyword.Constant), + (words(( + 'auto','catch','char','const_cast','delete','dynamic_cast','enum', + 'explicit','friend','goto','long','mutable','new','operator', + 'private','protected','public','reinterpret_cast','short','signed', + 'sizeof','static_cast','template','this','throw','try','typename', + 'union','unsigned','using','virtual'), + prefix=r'\b', suffix=r'\b'), + Keyword.Reserved), + (words(( + 'dword','matrix','snorm','string','unorm','unsigned','void','vector', + 'BlendState','Buffer','ByteAddressBuffer','ComputeShader', + 'DepthStencilState','DepthStencilView','DomainShader', + 'GeometryShader','HullShader','InputPatch','LineStream', + 'OutputPatch','PixelShader','PointStream','RasterizerState', + 'RenderTargetView','RasterizerOrderedBuffer', + 'RasterizerOrderedByteAddressBuffer', + 'RasterizerOrderedStructuredBuffer','RasterizerOrderedTexture1D', + 'RasterizerOrderedTexture1DArray','RasterizerOrderedTexture2D', + 'RasterizerOrderedTexture2DArray','RasterizerOrderedTexture3D', + 'RWBuffer','RWByteAddressBuffer','RWStructuredBuffer', + 'RWTexture1D','RWTexture1DArray','RWTexture2D','RWTexture2DArray', + 'RWTexture3D','SamplerState','SamplerComparisonState', + 'StructuredBuffer','Texture1D','Texture1DArray','Texture2D', + 'Texture2DArray','Texture2DMS','Texture2DMSArray','Texture3D', + 'TextureCube','TextureCubeArray','TriangleStream','VertexShader'), + prefix=r'\b', suffix=r'\b'), + Keyword.Type), + (words(( + 'bool','double','float','int','half','min16float','min10float', + 'min16int','min12int','min16uint','uint'), + prefix=r'\b', suffix=r'([1-4](x[1-4])?)?\b'), + Keyword.Type), # vector and matrix types + (words(( + 'abort','abs','acos','all','AllMemoryBarrier', + 'AllMemoryBarrierWithGroupSync','any','AppendStructuredBuffer', + 'asdouble','asfloat','asin','asint','asuint','asuint','atan', + 'atan2','ceil','CheckAccessFullyMapped','clamp','clip', + 'CompileShader','ConsumeStructuredBuffer','cos','cosh','countbits', + 'cross','D3DCOLORtoUBYTE4','ddx','ddx_coarse','ddx_fine','ddy', + 'ddy_coarse','ddy_fine','degrees','determinant', + 'DeviceMemoryBarrier','DeviceMemoryBarrierWithGroupSync','distance', + 'dot','dst','errorf','EvaluateAttributeAtCentroid', + 'EvaluateAttributeAtSample','EvaluateAttributeSnapped','exp', + 'exp2','f16tof32','f32tof16','faceforward','firstbithigh', + 'firstbitlow','floor','fma','fmod','frac','frexp','fwidth', + 'GetRenderTargetSampleCount','GetRenderTargetSamplePosition', + 'GlobalOrderedCountIncrement','GroupMemoryBarrier', + 'GroupMemoryBarrierWithGroupSync','InterlockedAdd','InterlockedAnd', + 'InterlockedCompareExchange','InterlockedCompareStore', + 'InterlockedExchange','InterlockedMax','InterlockedMin', + 'InterlockedOr','InterlockedXor','isfinite','isinf','isnan', + 'ldexp','length','lerp','lit','log','log10','log2','mad','max', + 'min','modf','msad4','mul','noise','normalize','pow','printf', + 'Process2DQuadTessFactorsAvg','Process2DQuadTessFactorsMax', + 'Process2DQuadTessFactorsMin','ProcessIsolineTessFactors', + 'ProcessQuadTessFactorsAvg','ProcessQuadTessFactorsMax', + 'ProcessQuadTessFactorsMin','ProcessTriTessFactorsAvg', + 'ProcessTriTessFactorsMax','ProcessTriTessFactorsMin', + 'QuadReadLaneAt','QuadSwapX','QuadSwapY','radians','rcp', + 'reflect','refract','reversebits','round','rsqrt','saturate', + 'sign','sin','sincos','sinh','smoothstep','sqrt','step','tan', + 'tanh','tex1D','tex1D','tex1Dbias','tex1Dgrad','tex1Dlod', + 'tex1Dproj','tex2D','tex2D','tex2Dbias','tex2Dgrad','tex2Dlod', + 'tex2Dproj','tex3D','tex3D','tex3Dbias','tex3Dgrad','tex3Dlod', + 'tex3Dproj','texCUBE','texCUBE','texCUBEbias','texCUBEgrad', + 'texCUBElod','texCUBEproj','transpose','trunc','WaveAllBitAnd', + 'WaveAllMax','WaveAllMin','WaveAllBitOr','WaveAllBitXor', + 'WaveAllEqual','WaveAllProduct','WaveAllSum','WaveAllTrue', + 'WaveAnyTrue','WaveBallot','WaveGetLaneCount','WaveGetLaneIndex', + 'WaveGetOrderedIndex','WaveIsHelperLane','WaveOnce', + 'WavePrefixProduct','WavePrefixSum','WaveReadFirstLane', + 'WaveReadLaneAt'), + prefix=r'\b', suffix=r'\b'), + Name.Builtin), # built-in functions + (words(( + 'SV_ClipDistance','SV_ClipDistance0','SV_ClipDistance1', + 'SV_Culldistance','SV_CullDistance0','SV_CullDistance1', + 'SV_Coverage','SV_Depth','SV_DepthGreaterEqual', + 'SV_DepthLessEqual','SV_DispatchThreadID','SV_DomainLocation', + 'SV_GroupID','SV_GroupIndex','SV_GroupThreadID','SV_GSInstanceID', + 'SV_InnerCoverage','SV_InsideTessFactor','SV_InstanceID', + 'SV_IsFrontFace','SV_OutputControlPointID','SV_Position', + 'SV_PrimitiveID','SV_RenderTargetArrayIndex','SV_SampleIndex', + 'SV_StencilRef','SV_TessFactor','SV_VertexID', + 'SV_ViewportArrayIndex'), + prefix=r'\b', suffix=r'\b'), + Name.Decorator), # system-value semantics + (r'\bSV_Target[0-7]?\b', Name.Decorator), + (words(( + 'allow_uav_condition','branch','call','domain','earlydepthstencil', + 'fastopt','flatten','forcecase','instance','loop','maxtessfactor', + 'numthreads','outputcontrolpoints','outputtopology','partitioning', + 'patchconstantfunc','unroll'), + prefix=r'\b', suffix=r'\b'), + Name.Decorator), # attributes + (r'[a-zA-Z_]\w*', Name), + (r'\\$', Comment.Preproc), # backslash at end of line -- usually macro continuation + (r'\s+', Text), + ], + 'string': [ + (r'"', String, '#pop'), + (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|' + r'u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})', String.Escape), + (r'[^\\"\n]+', String), # all other characters + (r'\\\n', String), # line continuation + (r'\\', String), # stray backslash + ], + } + + class PostScriptLexer(RegexLexer): """ Lexer for PostScript files. @@ -461,8 +461,8 @@ class AsymptoteLexer(RegexLexer): r'bounds|coord|frame|guide|horner|int|linefit|marginT|pair|pen|' r'picture|position|real|revolution|slice|splitface|ticksgridT|' r'tickvalues|tree|triple|vertex|void)\b', Keyword.Type), - (r'[a-zA-Z_]\w*:(?!:)', Name.Label), - (r'[a-zA-Z_]\w*', Name), + (r'[a-zA-Z_]\w*:(?!:)', Name.Label), + (r'[a-zA-Z_]\w*', Name), ], 'root': [ include('whitespace'), @@ -562,9 +562,9 @@ class GnuplotLexer(RegexLexer): (_shortened_many('pwd$', 're$read', 'res$et', 'scr$eendump', 'she$ll', 'test$'), Keyword, 'noargs'), - (r'([a-zA-Z_]\w*)(\s*)(=)', + (r'([a-zA-Z_]\w*)(\s*)(=)', bygroups(Name.Variable, Text, Operator), 'genericargs'), - (r'([a-zA-Z_]\w*)(\s*\(.*?\)\s*)(=)', + (r'([a-zA-Z_]\w*)(\s*\(.*?\)\s*)(=)', bygroups(Name.Function, Text, Operator), 'genericargs'), (r'@[a-zA-Z_]\w*', Name.Constant), # macros (r';', Keyword), @@ -610,7 +610,7 @@ class GnuplotLexer(RegexLexer): (r'(\d+\.\d*|\.\d+)', Number.Float), (r'-?\d+', Number.Integer), ('[,.~!%^&*+=|?:<>/-]', Operator), - (r'[{}()\[\]]', Punctuation), + (r'[{}()\[\]]', Punctuation), (r'(eq|ne)\b', Operator.Word), (r'([a-zA-Z_]\w*)(\s*)(\()', bygroups(Name.Function, Text, Punctuation)), |