mirror of
https://github.com/AssetRipper/AssetRipper.Bindings.LibTorchSharp.git
synced 2026-11-13 04:26:21 -10:00
17 lines
459 B
C#
17 lines
459 B
C#
using Microsoft.CodeAnalysis.CSharp;
|
|
|
|
namespace AssetRipper.Bindings.LibTorchSharp.SourceGenerator.Extensions;
|
|
|
|
internal static class StringExtensions
|
|
{
|
|
public static string PrefixWithAtSignIfKeyword(this string text)
|
|
{
|
|
return text.IsKeyword() ? '@' + text : text;
|
|
}
|
|
|
|
public static bool IsKeyword(this string text)
|
|
{
|
|
return SyntaxFacts.GetKeywordKind(text) != SyntaxKind.None || SyntaxFacts.GetContextualKeywordKind(text) != SyntaxKind.None;
|
|
}
|
|
}
|