tartrazine/lexers/hlsl.xml

111 lines
7.3 KiB
XML
Raw Normal View History

2024-08-02 20:03:49 +00:00
<lexer>
<config>
<name>HLSL</name>
<alias>hlsl</alias>
<filename>*.hlsl</filename>
<filename>*.hlsli</filename>
<filename>*.cginc</filename>
<filename>*.fx</filename>
<filename>*.fxh</filename>
<mime_type>text/x-hlsl</mime_type>
</config>
<rules>
<state name="root">
<rule pattern="^#.*$">
<token type="CommentPreproc"/>
</rule>
<rule pattern="//.*$">
<token type="CommentSingle"/>
</rule>
<rule pattern="/(\\\n)?[*](.|\n)*?[*](\\\n)?/">
<token type="CommentMultiline"/>
</rule>
<rule pattern="\+|-|~|!=?|\*|/|%|&lt;&lt;|&gt;&gt;|&lt;=?|&gt;=?|==?|&amp;&amp;?|\^|\|\|?">
<token type="Operator"/>
</rule>
<rule pattern="[?:]">
<token type="Operator"/>
</rule>
<rule pattern="\bdefined\b">
<token type="Operator"/>
</rule>
<rule pattern="[;{}(),.\[\]]">
<token type="Punctuation"/>
</rule>
<rule pattern="[+-]?\d*\.\d+([eE][-+]?\d+)?f?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[+-]?\d+\.\d*([eE][-+]?\d+)?f?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="0[xX][0-9a-fA-F]*">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="0[0-7]*">
<token type="LiteralNumberOct"/>
</rule>
<rule pattern="[1-9][0-9]*">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="&quot;">
<token type="LiteralString"/>
<push state="string"/>
</rule>
<rule pattern="\b(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)\b">
<token type="Keyword"/>
</rule>
<rule pattern="\b(true|false)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="\b(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)\b">
<token type="KeywordReserved"/>
</rule>
<rule pattern="\b(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)\b">
<token type="KeywordType"/>
</rule>
<rule pattern="\b(bool|double|float|int|half|min16float|min10float|min16int|min12int|min16uint|uint)([1-4](x[1-4])?)?\b">
<token type="KeywordType"/>
</rule>
<rule pattern="\b(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)\b">
<token type="NameBuiltin"/>
</rule>
<rule pattern="\b(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)\b">
<token type="NameDecorator"/>
</rule>
<rule pattern="\bSV_Target[0-7]?\b">
<token type="NameDecorator"/>
</rule>
<rule pattern="\b(allow_uav_condition|branch|call|domain|earlydepthstencil|fastopt|flatten|forcecase|instance|loop|maxtessfactor|numthreads|outputcontrolpoints|outputtopology|partitioning|patchconstantfunc|unroll)\b">
<token type="NameDecorator"/>
</rule>
<rule pattern="[a-zA-Z_]\w*">
<token type="Name"/>
</rule>
<rule pattern="\\$">
<token type="CommentPreproc"/>
</rule>
<rule pattern="\s+">
<token type="Text"/>
</rule>
</state>
<state name="string">
<rule pattern="&quot;">
<token type="LiteralString"/>
<pop depth="1"/>
</rule>
<rule pattern="\\([\\abfnrtv&quot;\&#x27;]|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="[^\\&quot;\n]+">
<token type="LiteralString"/>
</rule>
<rule pattern="\\\n">
<token type="LiteralString"/>
</rule>
<rule pattern="\\">
<token type="LiteralString"/>
</rule>
</state>
</rules>
</lexer>