Merge pull request #12 from nguerrera/dev
Remove #if NET45 for GetUnicodeCategory and just use CharUnicodeInfo everywhere.
This commit is contained in:
commit
c28b1c538d
|
|
@ -33,13 +33,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
value == '\f' ||
|
value == '\f' ||
|
||||||
value == '\t' ||
|
value == '\t' ||
|
||||||
value == '\u000B' || // Vertical Tab
|
value == '\u000B' || // Vertical Tab
|
||||||
#if NET45
|
|
||||||
// No GetUnicodeCategory on Char in CoreCLR
|
|
||||||
|
|
||||||
Char.GetUnicodeCategory(value) == UnicodeCategory.SpaceSeparator;
|
|
||||||
#else
|
|
||||||
CharUnicodeInfo.GetUnicodeCategory(value) == UnicodeCategory.SpaceSeparator;
|
CharUnicodeInfo.GetUnicodeCategory(value) == UnicodeCategory.SpaceSeparator;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Whitespace", Justification = "This would be a breaking change in a shipping API")]
|
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Whitespace", Justification = "This would be a breaking change in a shipping API")]
|
||||||
|
|
@ -94,13 +88,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
|
|
||||||
public static bool IsDecimalDigit(char value)
|
public static bool IsDecimalDigit(char value)
|
||||||
{
|
{
|
||||||
#if NET45
|
|
||||||
// No GetUnicodeCategory on Char in CoreCLR
|
|
||||||
|
|
||||||
return Char.GetUnicodeCategory(value) == UnicodeCategory.DecimalDigitNumber;
|
|
||||||
#else
|
|
||||||
return CharUnicodeInfo.GetUnicodeCategory(value) == UnicodeCategory.DecimalDigitNumber;
|
return CharUnicodeInfo.GetUnicodeCategory(value) == UnicodeCategory.DecimalDigitNumber;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsLetterOrDecimalDigit(char value)
|
public static bool IsLetterOrDecimalDigit(char value)
|
||||||
|
|
@ -110,14 +98,8 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
|
|
||||||
public static bool IsLetter(char value)
|
public static bool IsLetter(char value)
|
||||||
{
|
{
|
||||||
UnicodeCategory cat;
|
UnicodeCategory cat = CharUnicodeInfo.GetUnicodeCategory(value);
|
||||||
#if NET45
|
|
||||||
// No GetUnicodeCategory on Char in CoreCLR
|
|
||||||
|
|
||||||
cat = Char.GetUnicodeCategory(value);
|
|
||||||
#else
|
|
||||||
cat = CharUnicodeInfo.GetUnicodeCategory(value);
|
|
||||||
#endif
|
|
||||||
return cat == UnicodeCategory.UppercaseLetter
|
return cat == UnicodeCategory.UppercaseLetter
|
||||||
|| cat == UnicodeCategory.LowercaseLetter
|
|| cat == UnicodeCategory.LowercaseLetter
|
||||||
|| cat == UnicodeCategory.TitlecaseLetter
|
|| cat == UnicodeCategory.TitlecaseLetter
|
||||||
|
|
@ -128,26 +110,12 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
|
|
||||||
public static bool IsFormatting(char value)
|
public static bool IsFormatting(char value)
|
||||||
{
|
{
|
||||||
#if NET45
|
|
||||||
// No GetUnicodeCategory on Char in CoreCLR
|
|
||||||
|
|
||||||
return Char.GetUnicodeCategory(value) == UnicodeCategory.Format;
|
|
||||||
#else
|
|
||||||
|
|
||||||
return CharUnicodeInfo.GetUnicodeCategory(value) == UnicodeCategory.Format;
|
return CharUnicodeInfo.GetUnicodeCategory(value) == UnicodeCategory.Format;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsCombining(char value)
|
public static bool IsCombining(char value)
|
||||||
{
|
{
|
||||||
UnicodeCategory cat;
|
UnicodeCategory cat= CharUnicodeInfo.GetUnicodeCategory(value);
|
||||||
#if NET45
|
|
||||||
// No GetUnicodeCategory on Char in CoreCLR
|
|
||||||
|
|
||||||
cat = Char.GetUnicodeCategory(value);
|
|
||||||
#else
|
|
||||||
cat = CharUnicodeInfo.GetUnicodeCategory(value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return cat == UnicodeCategory.SpacingCombiningMark || cat == UnicodeCategory.NonSpacingMark;
|
return cat == UnicodeCategory.SpacingCombiningMark || cat == UnicodeCategory.NonSpacingMark;
|
||||||
|
|
||||||
|
|
@ -155,13 +123,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
|
|
||||||
public static bool IsConnecting(char value)
|
public static bool IsConnecting(char value)
|
||||||
{
|
{
|
||||||
#if NET45
|
|
||||||
// No GetUnicodeCategory on Char in CoreCLR
|
|
||||||
|
|
||||||
return Char.GetUnicodeCategory(value) == UnicodeCategory.ConnectorPunctuation;
|
|
||||||
#else
|
|
||||||
return CharUnicodeInfo.GetUnicodeCategory(value) == UnicodeCategory.ConnectorPunctuation;
|
return CharUnicodeInfo.GetUnicodeCategory(value) == UnicodeCategory.ConnectorPunctuation;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string SanitizeClassName(string inputName)
|
public static string SanitizeClassName(string inputName)
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,7 @@ namespace Microsoft.AspNet.Razor.Tokenizer
|
||||||
{
|
{
|
||||||
return Char.IsLetter(character) ||
|
return Char.IsLetter(character) ||
|
||||||
character == '_' ||
|
character == '_' ||
|
||||||
#if NET45
|
|
||||||
// No GetUnicodeCategory on Char in CoreCLR
|
|
||||||
|
|
||||||
Char.GetUnicodeCategory(character) == UnicodeCategory.LetterNumber;
|
|
||||||
#else
|
|
||||||
CharUnicodeInfo.GetUnicodeCategory(character) == UnicodeCategory.LetterNumber;
|
CharUnicodeInfo.GetUnicodeCategory(character) == UnicodeCategory.LetterNumber;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsIdentifierPart(char character)
|
public static bool IsIdentifierPart(char character)
|
||||||
|
|
@ -40,14 +34,7 @@ namespace Microsoft.AspNet.Razor.Tokenizer
|
||||||
|
|
||||||
private static bool IsIdentifierPartByUnicodeCategory(char character)
|
private static bool IsIdentifierPartByUnicodeCategory(char character)
|
||||||
{
|
{
|
||||||
UnicodeCategory category;
|
UnicodeCategory category = CharUnicodeInfo.GetUnicodeCategory(character);
|
||||||
#if NET45
|
|
||||||
// No GetUnicodeCategory on Char in CoreCLR
|
|
||||||
|
|
||||||
category = Char.GetUnicodeCategory(character);
|
|
||||||
#else
|
|
||||||
category = CharUnicodeInfo.GetUnicodeCategory(character);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return category == UnicodeCategory.NonSpacingMark || // Mn
|
return category == UnicodeCategory.NonSpacingMark || // Mn
|
||||||
category == UnicodeCategory.SpacingCombiningMark || // Mc
|
category == UnicodeCategory.SpacingCombiningMark || // Mc
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue