Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ IsValidTypeNameOrIdentifier()

static bool System.CSharpHelpers.IsValidTypeNameOrIdentifier ( string value,
bool isTypeName )
inlinestaticpackage

Definition at line 53 of file CSharpHelpers.cs.

54 {
55 bool nextMustBeStartChar = true;
56 if (string.IsNullOrEmpty(value))
57 {
58 return false;
59 }
60 foreach (char c in value)
61 {
63 {
64 case UnicodeCategory.UppercaseLetter:
65 case UnicodeCategory.LowercaseLetter:
66 case UnicodeCategory.TitlecaseLetter:
67 case UnicodeCategory.ModifierLetter:
68 case UnicodeCategory.OtherLetter:
69 case UnicodeCategory.LetterNumber:
70 nextMustBeStartChar = false;
71 break;
72 case UnicodeCategory.NonSpacingMark:
73 case UnicodeCategory.SpacingCombiningMark:
74 case UnicodeCategory.DecimalDigitNumber:
75 case UnicodeCategory.ConnectorPunctuation:
76 if (nextMustBeStartChar && c != '_')
77 {
78 return false;
79 }
80 nextMustBeStartChar = false;
81 break;
82 default:
84 {
85 return false;
86 }
87 break;
88 }
89 }
90 return true;
91 }
static bool IsSpecialTypeChar(char ch, ref bool nextMustBeStartChar)
static UnicodeCategory GetUnicodeCategory(char ch)

References System.Globalization.CharUnicodeInfo.GetUnicodeCategory(), System.CSharpHelpers.IsSpecialTypeChar(), and System.value.

Referenced by System.CSharpHelpers.IsValidLanguageIndependentIdentifier().