!(function (n) {
(n.languages.xeora = n.languages.extend('markup', {
constant: {
pattern: /\$(?:DomainContents|PageRenderDuration)\$/,
inside: { punctuation: { pattern: /\$/ } },
},
variable: {
pattern: /\$@?(?:#+|[-+*~=^])?[\w.]+\$/,
inside: {
punctuation: { pattern: /[$.]/ },
operator: { pattern: /#+|[-+*~=^@]/ },
},
},
'function-inline': {
pattern:
/\$F:[-\w.]+\?[-\w.]+(?:,(?:(?:@[-#]*\w+\.[\w+.]\.*)*\|)*(?:(?:[\w+]|[-#*.~^]+[\w+]|=\S)(?:[^$=]|=+[^=])*=*|(?:@[-#]*\w+\.[\w+.]\.*)+(?:(?:[\w+]|[-#*~^][-#*.~^]*[\w+]|=\S)(?:[^$=]|=+[^=])*=*)?)?)?\$/,
inside: {
variable: {
pattern: /(?:[,|])@?(?:#+|[-+*~=^])?[\w.]+/,
inside: {
punctuation: { pattern: /[,.|]/ },
operator: { pattern: /#+|[-+*~=^@]/ },
},
},
punctuation: { pattern: /\$\w:|[$:?.,|]/ },
},
alias: 'function',
},
'function-block': {
pattern:
/\$XF:\{[-\w.]+\?[-\w.]+(?:,(?:(?:@[-#]*\w+\.[\w+.]\.*)*\|)*(?:(?:[\w+]|[-#*.~^]+[\w+]|=\S)(?:[^$=]|=+[^=])*=*|(?:@[-#]*\w+\.[\w+.]\.*)+(?:(?:[\w+]|[-#*~^][-#*.~^]*[\w+]|=\S)(?:[^$=]|=+[^=])*=*)?)?)?\}:XF\$/,
inside: { punctuation: { pattern: /[$:{}?.,|]/ } },
alias: 'function',
},
'directive-inline': {
pattern: /\$\w(?:#\d+\+?)?(?:\[[-\w.]+\])?:[-\/\w.]+\$/,
inside: {
punctuation: {
pattern: /\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/,
inside: { tag: { pattern: /#\d/ } },
},
},
alias: 'function',
},
'directive-block-open': {
pattern:
/\$\w+:\{|\$\w(?:#\d+\+?)?(?:\[[-\w.]+\])?:[-\w.]+:\{(?:![A-Z]+)?/,
inside: {
punctuation: {
pattern: /\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/,
inside: { tag: { pattern: /#\d/ } },
},
attribute: {
pattern: /![A-Z]+$/,
inside: { punctuation: { pattern: /!/ } },
alias: 'keyword',
},
},
alias: 'function',
},
'directive-block-separator': {
pattern: /\}:[-\w.]+:\{/,
inside: { punctuation: { pattern: /[:{}]/ } },
alias: 'function',
},
'directive-block-close': {
pattern: /\}:[-\w.]+\$/,
inside: { punctuation: { pattern: /[:{}$]/ } },
alias: 'function',
},
})),
n.languages.insertBefore(
'inside',
'punctuation',
{ variable: n.languages.xeora['function-inline'].inside.variable },
n.languages.xeora['function-block']
),
(n.languages.xeoracube = n.languages.xeora);
})(Prism);
ss='path'>path: root/public/prism/prism-hlsl.js
blob: b281aa201138757c5bbce48e5271e85c94b16356 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
Prism.languages.hlsl = Prism.languages.extend('c', {
// Regarding keywords and class names:
// The list of all keywords was split into 'keyword' and 'class-name' tokens based on whether they are capitalized.
// https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-keywords
// https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-reserved-words
'class-name': [
Prism.languages.c['class-name'],
/\b(?:AppendStructuredBuffer|BlendState|Buffer|ByteAddressBuffer|CompileShader|ComputeShader|ConsumeStructuredBuffer|DepthStencilState|DepthStencilView|DomainShader|GeometryShader|Hullshader|InputPatch|LineStream|OutputPatch|PixelShader|PointStream|RWBuffer|RWByteAddressBuffer|RWStructuredBuffer|RWTexture(?:1D|1DArray|2D|2DArray|3D)|RasterizerState|RenderTargetView|SamplerComparisonState|SamplerState|StructuredBuffer|Texture(?:1D|1DArray|2D|2DArray|2DMS|2DMSArray|3D|Cube|CubeArray)|TriangleStream|VertexShader)\b/,
],
keyword: [
// HLSL keyword
/\b(?:asm|asm_fragment|auto|break|case|catch|cbuffer|centroid|char|class|column_major|compile|compile_fragment|const|const_cast|continue|default|delete|discard|do|dynamic_cast|else|enum|explicit|export|extern|for|friend|fxgroup|goto|groupshared|if|in|inline|inout|interface|line|lineadj|linear|long|matrix|mutable|namespace|new|nointerpolation|noperspective|operator|out|packoffset|pass|pixelfragment|point|precise|private|protected|public|register|reinterpret_cast|return|row_major|sample|sampler|shared|short|signed|sizeof|snorm|stateblock|stateblock_state|static|static_cast|string|struct|switch|tbuffer|technique|technique10|technique11|template|texture|this|throw|triangle|triangleadj|try|typedef|typename|uniform|union|unorm|unsigned|using|vector|vertexfragment|virtual|void|volatile|while)\b/,
// scalar, vector, and matrix types
/\b(?:bool|double|dword|float|half|int|min(?:10float|12int|16(?:float|int|uint))|uint)(?:[1-4](?:x[1-4])?)?\b/,
],
// https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-grammar#floating-point-numbers
number:
/(?:(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[eE][+-]?\d+)?|\b0x[\da-fA-F]+)[fFhHlLuU]?\b/,
boolean: /\b(?:false|true)\b/,
});
|