7 instantiations of Rune
Microsoft.CodeAnalysis.CodeStyle (7)
AbstractVirtualCharService.cs (2)
168result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 177result.Add(VirtualChar.Create(new Rune(tokenText[index]), span));
Rune.cs (4)
134public static explicit operator Rune(char ch) => new Rune(ch); 136public static explicit operator Rune(uint value) => new Rune(value); 138public static explicit operator Rune(int value) => new Rune(value); 1119internal static Rune UnsafeCreate(uint scalarValue) => new Rune(scalarValue, false);
VirtualCharSequence.Chunks.cs (1)
127: VirtualChar.Create(new Rune(ch), span);
108 references to Rune
Microsoft.CodeAnalysis.CodeStyle (99)
AbstractVirtualCharService.cs (3)
204if (Rune.TryCreate(ch, out var rune)) 211Rune.TryCreate(ch, info.Get(tokenText, index + 1), out rune))
Rune.cs (85)
26/// assuming that the underlying <see cref="Rune"/> instance is well-formed. 29internal readonly struct Rune : IComparable<Rune>, IEquatable<Rune> 59/// Creates a <see cref="Rune"/> from the provided UTF-16 code unit. 76/// Creates a <see cref="Rune"/> from the provided UTF-16 surrogate pair. 88/// Creates a <see cref="Rune"/> from the provided Unicode scalar value. 99/// Creates a <see cref="Rune"/> from the provided Unicode scalar value. 120public static bool operator ==(Rune left, Rune right) => left._value == right._value; 122public static bool operator !=(Rune left, Rune right) => left._value != right._value; 124public static bool operator <(Rune left, Rune right) => left._value < right._value; 126public static bool operator <=(Rune left, Rune right) => left._value <= right._value; 128public static bool operator >(Rune left, Rune right) => left._value > right._value; 130public static bool operator >=(Rune left, Rune right) => left._value >= right._value; 134public static explicit operator Rune(char ch) => new Rune(ch); 136public static explicit operator Rune(uint value) => new Rune(value); 138public static explicit operator Rune(int value) => new Rune(value); 161/// A <see cref="Rune"/> instance that represents the Unicode replacement character U+FFFD. 163public static Rune ReplacementChar => UnsafeCreate(UnicodeUtility.ReplacementChar); 224private static Rune ChangeCaseCultureAware(Rune rune, CultureInfo culture, bool toUpper) 262public int CompareTo(Rune other) => _value.CompareTo(other._value); 265/// Decodes the <see cref="Rune"/> at the beginning of the provided UTF-16 source buffer. 270/// and outs via <paramref name="result"/> the decoded <see cref="Rune"/> and via <paramref name="charsConsumed"/> the 271/// number of <see langword="char"/>s used in the input buffer to encode the <see cref="Rune"/>. 290public static OperationStatus DecodeFromUtf16(ReadOnlySpan<char> source, out Rune result, out int charsConsumed) 349/// Decodes the <see cref="Rune"/> at the beginning of the provided UTF-8 source buffer. 354/// and outs via <paramref name="result"/> the decoded <see cref="Rune"/> and via <paramref name="bytesConsumed"/> the 355/// number of <see langword="byte"/>s used in the input buffer to encode the <see cref="Rune"/>. 374public static OperationStatus DecodeFromUtf8(ReadOnlySpan<byte> source, out Rune result, out int bytesConsumed) 539/// Decodes the <see cref="Rune"/> at the end of the provided UTF-16 source buffer. 542/// This method is very similar to <see cref="DecodeFromUtf16(ReadOnlySpan{char}, out Rune, out int)"/>, but it allows 547public static OperationStatus DecodeLastFromUtf16(ReadOnlySpan<char> source, out Rune result, out int charsConsumed) 599/// Decodes the <see cref="Rune"/> at the end of the provided UTF-8 source buffer. 602/// This method is very similar to <see cref="DecodeFromUtf8(ReadOnlySpan{byte}, out Rune, out int)"/>, but it allows 607public static OperationStatus DecodeLastFromUtf8(ReadOnlySpan<byte> source, out Rune value, out int bytesConsumed) 684OperationStatus operationStatus = DecodeFromUtf8(source, out Rune tempRune, out int tempBytesConsumed); 716/// Encodes this <see cref="Rune"/> to a UTF-16 destination buffer. 734/// Encodes this <see cref="Rune"/> to a UTF-8 destination buffer. 751public override bool Equals(object obj) => (obj is Rune other) && Equals(other); 753public bool Equals(Rune other) => this == other; 758/// Gets the <see cref="Rune"/> which begins at index <paramref name="index"/> in 765public static Rune GetRuneAt(string input, int index) 874/// Returns a <see cref="string"/> representation of this <see cref="Rune"/> instance. 903/// Attempts to create a <see cref="Rune"/> from the provided input value. 905public static bool TryCreate(char ch, out Rune result) 921/// Attempts to create a <see cref="Rune"/> from the provided UTF-16 surrogate pair. 924public static bool TryCreate(char highSurrogate, char lowSurrogate, out Rune result) 951/// Attempts to create a <see cref="Rune"/> from the provided input value. 953public static bool TryCreate(int value, out Rune result) => TryCreate((uint)value, out result); 956/// Attempts to create a <see cref="Rune"/> from the provided input value. 958public static bool TryCreate(uint value, out Rune result) 973/// Encodes this <see cref="Rune"/> to a UTF-16 destination buffer. 1009/// Encodes this <see cref="Rune"/> to a destination buffer as UTF-8 bytes. 1077/// Attempts to get the <see cref="Rune"/> which begins at index <paramref name="index"/> in 1085public static bool TryGetRuneAt(string input, int index, out Rune value) 1116/// Creates a <see cref="Rune"/> without performing validation on the input. 1119internal static Rune UnsafeCreate(uint scalarValue) => new Rune(scalarValue, false); 1123public static double GetNumericValue(Rune value) 1145public static UnicodeCategory GetUnicodeCategory(Rune value) 1157private static UnicodeCategory GetUnicodeCategoryNonAscii(Rune value) 1208public static bool IsControl(Rune value) 1222public static bool IsDigit(Rune value) 1234public static bool IsLetter(Rune value) 1246public static bool IsLetterOrDigit(Rune value) 1258public static bool IsLower(Rune value) 1270public static bool IsNumber(Rune value) 1282public static bool IsPunctuation(Rune value) 1287public static bool IsSeparator(Rune value) 1292public static bool IsSymbol(Rune value) 1297public static bool IsUpper(Rune value) 1309public static bool IsWhiteSpace(Rune value) 1327public static Rune ToLower(Rune value, CultureInfo culture) 1352public static Rune ToLowerInvariant(Rune value) 1382public static Rune ToUpper(Rune value, CultureInfo culture) 1407public static Rune ToUpperInvariant(Rune value)
VirtualChar.cs (11)
33/// cref="Rune.ReplacementChar"/>. The value of this character can be retrieved from 36public readonly Rune Rune; 40/// cref="Rune"/>. If <see cref="Rune"/> is not <see cref="Rune.ReplacementChar"/>, this will be <c>0</c>. 54public static VirtualChar Create(Rune rune, TextSpan span) 60/// value will be <see cref="Rune.ReplacementChar"/>. 67return new VirtualChar(rune: Rune.ReplacementChar, surrogateChar, span); 70private VirtualChar(Rune rune, char surrogateChar, TextSpan span) 72Contract.ThrowIfFalse(surrogateChar == 0 || rune == Rune.ReplacementChar, 91=> SurrogateChar != 0 ? char.IsDigit(SurrogateChar) : Rune.IsDigit(Rune); 94=> SurrogateChar != 0 ? char.IsLetterOrDigit(SurrogateChar) : Rune.IsLetterOrDigit(Rune); 97=> SurrogateChar != 0 ? char.IsWhiteSpace(SurrogateChar) : Rune.IsWhiteSpace(Rune);
Microsoft.CodeAnalysis.CSharp.CodeStyle (9)
CSharpVirtualCharService.cs (3)
302if (Rune.TryCreate(ch, out var rune)) 313if (Rune.TryCreate(ch, nextCh, out rune))
RuneExtensions.cs (1)
17public static bool TryGetEscapeCharacter(this Rune rune, out char escapedChar)
UseUtf8StringLiteralDiagnosticAnalyzer.cs (5)
156if (!TryGetNextRune(arrayCreationElements, i, out var rune, out var bytesConsumed) || 182static bool IsControlOrFormatRune(Rune rune) 183=> Rune.GetUnicodeCategory(rune) is UnicodeCategory.Control or UnicodeCategory.Format 193private static bool TryGetNextRune(ImmutableArray<IOperation> arrayCreationElements, int startIndex, out Rune rune, out int bytesConsumed) 214return Rune.DecodeFromUtf8(array, out rune, out bytesConsumed) == System.Buffers.OperationStatus.Done;