Replace delimiters with unicode shapes

This commit is contained in:
2026-03-19 00:40:27 -04:00
parent 467c1464aa
commit e9ad41bbb3
9 changed files with 91 additions and 60 deletions

View File

@@ -51,7 +51,16 @@ extern int32 TrySavePackageSEH(
#endif
// ============================================================
// Name Formatting
// Name sanitization
//
// Our parsers use Unicode geometric shape delimiters that
// are unlikely to appear in names: ◂▸ for type brackets, ◆
// for map key◆value, ◦ for type◦name in prototypes, │ for
// list/path separation. If any of these characters appear
// in a name, we replace them with safe ASCII equivalents.
// One consequence of name sanitization is that we can't use
// Unreal's name-lookup routines — the LLM only sees
// sanitized names. So we do our own name lookups.
// ============================================================
void WingUtils::SanitizeNameInPlace(FString &Name)
@@ -61,7 +70,11 @@ void WingUtils::SanitizeNameInPlace(FString &Name)
{
TCHAR c = Name[Src];
if (c < 0x20 || c == 0x7F) continue;
if ((c == ' ') || (c == ',') || (c == ':')) c = '_';
if (c == L'') c='<';
if (c == L'') c='>';
if (c == L'') c='*';
if (c == L'') c='.';
if (c == L'') c = '|';
Name[Dst++] = c;
}
if (Dst == 0) Name[Dst++] = '_';
@@ -82,6 +95,10 @@ FString WingUtils::SanitizeName(FName Name)
return Result;
}
// ============================================================
// Name Lookup
// ============================================================
FString WingUtils::FormatName(const UWorld *World)
{
return World->GetPathName();