本文整理汇总了C#中SyntaxToken.WithKind方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxToken.WithKind方法的具体用法?C# SyntaxToken.WithKind怎么用?C# SyntaxToken.WithKind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyntaxToken
的用法示例。
在下文中一共展示了SyntaxToken.WithKind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseObjectType
private PredefinedObjectTypeSyntax ParseObjectType(SyntaxToken token)
{
switch (token.Kind)
{
case SyntaxKind.BufferKeyword:
case SyntaxKind.RasterizerOrderedBufferKeyword:
case SyntaxKind.RWBufferKeyword:
return ParseBufferType(token);
case SyntaxKind.ByteAddressBufferKeyword:
case SyntaxKind.RasterizerOrderedByteAddressBufferKeyword:
case SyntaxKind.RWByteAddressBufferKeyword:
case SyntaxKind.RasterizerStateKeyword:
case SyntaxKind.BlendStateKeyword:
case SyntaxKind.DepthStencilStateKeyword:
case SyntaxKind.Texture2DLegacyKeyword:
case SyntaxKind.TextureCubeLegacyKeyword:
case SyntaxKind.SamplerKeyword:
case SyntaxKind.Sampler1DKeyword:
case SyntaxKind.Sampler2DKeyword:
case SyntaxKind.Sampler3DKeyword:
case SyntaxKind.SamplerCubeKeyword:
case SyntaxKind.SamplerStateKeyword:
case SyntaxKind.SamplerComparisonStateKeyword:
return new PredefinedObjectTypeSyntax(token, null);
case SyntaxKind.InputPatchKeyword:
case SyntaxKind.OutputPatchKeyword:
return ParsePatchType(token);
case SyntaxKind.PointStreamKeyword:
case SyntaxKind.LineStreamKeyword:
case SyntaxKind.TriangleStreamKeyword:
return ParseStreamOutputType(token);
case SyntaxKind.AppendStructuredBufferKeyword:
case SyntaxKind.ConsumeStructuredBufferKeyword:
case SyntaxKind.RasterizerOrderedStructuredBufferKeyword:
case SyntaxKind.RWStructuredBufferKeyword:
case SyntaxKind.StructuredBufferKeyword:
return ParseStructuredBufferType(token);
case SyntaxKind.RasterizerOrderedTexture1DKeyword:
case SyntaxKind.RasterizerOrderedTexture1DArrayKeyword:
case SyntaxKind.RasterizerOrderedTexture2DKeyword:
case SyntaxKind.RasterizerOrderedTexture2DArrayKeyword:
case SyntaxKind.RasterizerOrderedTexture3DKeyword:
case SyntaxKind.RWTexture1DKeyword:
case SyntaxKind.RWTexture1DArrayKeyword:
case SyntaxKind.RWTexture2DKeyword:
case SyntaxKind.RWTexture2DArrayKeyword:
case SyntaxKind.RWTexture3DKeyword:
case SyntaxKind.Texture1DKeyword:
case SyntaxKind.Texture1DArrayKeyword:
case SyntaxKind.Texture2DKeyword:
case SyntaxKind.Texture2DArrayKeyword:
case SyntaxKind.Texture3DKeyword:
case SyntaxKind.TextureCubeKeyword:
case SyntaxKind.TextureCubeArrayKeyword:
return ParseTextureType(token);
case SyntaxKind.Texture2DMSKeyword:
case SyntaxKind.Texture2DMSArrayKeyword:
return ParseMultisampledTextureType(token);
}
switch (token.ContextualKind)
{
case SyntaxKind.TextureKeyword:
case SyntaxKind.GeometryShaderKeyword:
case SyntaxKind.PixelShaderKeyword:
case SyntaxKind.VertexShaderKeyword:
return new PredefinedObjectTypeSyntax(token.WithKind(token.ContextualKind), null);
case SyntaxKind.ConstantBufferKeyword:
return ParseTemplatedConstantBufferType(token);
}
TemplateArgumentListSyntax templateArgumentList = null;
if (Current.Kind == SyntaxKind.LessThanToken)
templateArgumentList = ParseTemplateArgumentList();
return new PredefinedObjectTypeSyntax(token, templateArgumentList);
}