7 instantiations of Rune
Microsoft.CodeAnalysis.CodeStyle (7)
AbstractVirtualCharService.cs (2)
168
result.Add(VirtualChar.Create(new
Rune
('"'), new TextSpan(offset + index, 2)));
177
result.Add(VirtualChar.Create(new
Rune
(tokenText[index]), span));
Rune.cs (4)
134
public static explicit operator Rune(char ch) => new
Rune
(ch);
136
public static explicit operator Rune(uint value) => new
Rune
(value);
138
public static explicit operator Rune(int value) => new
Rune
(value);
1119
internal 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)
204
if (
Rune
.TryCreate(ch, out
var
rune))
211
Rune
.TryCreate(ch, info.Get(tokenText, index + 1), out rune))
Rune.cs (85)
26
/// assuming that the underlying <see cref="
Rune
"/> instance is well-formed.
29
internal 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.
120
public static bool operator ==(
Rune
left,
Rune
right) => left._value == right._value;
122
public static bool operator !=(
Rune
left,
Rune
right) => left._value != right._value;
124
public static bool operator <(
Rune
left,
Rune
right) => left._value < right._value;
126
public static bool operator <=(
Rune
left,
Rune
right) => left._value <= right._value;
128
public static bool operator >(
Rune
left,
Rune
right) => left._value > right._value;
130
public static bool operator >=(
Rune
left,
Rune
right) => left._value >= right._value;
134
public static explicit operator
Rune
(char ch) => new Rune(ch);
136
public static explicit operator
Rune
(uint value) => new Rune(value);
138
public static explicit operator
Rune
(int value) => new Rune(value);
161
/// A <see cref="
Rune
"/> instance that represents the Unicode replacement character U+FFFD.
163
public static
Rune
ReplacementChar => UnsafeCreate(UnicodeUtility.ReplacementChar);
224
private static
Rune
ChangeCaseCultureAware(
Rune
rune, CultureInfo culture, bool toUpper)
262
public 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
"/>.
290
public 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
"/>.
374
public 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
547
public 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
607
public static OperationStatus DecodeLastFromUtf8(ReadOnlySpan<byte> source, out
Rune
value, out int bytesConsumed)
684
OperationStatus 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.
751
public override bool Equals(object obj) => (obj is
Rune
other) && Equals(other);
753
public bool Equals(
Rune
other) => this == other;
758
/// Gets the <see cref="
Rune
"/> which begins at index <paramref name="index"/> in
765
public 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.
905
public static bool TryCreate(char ch, out
Rune
result)
921
/// Attempts to create a <see cref="
Rune
"/> from the provided UTF-16 surrogate pair.
924
public static bool TryCreate(char highSurrogate, char lowSurrogate, out
Rune
result)
951
/// Attempts to create a <see cref="
Rune
"/> from the provided input value.
953
public 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.
958
public 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
1085
public static bool TryGetRuneAt(string input, int index, out
Rune
value)
1116
/// Creates a <see cref="
Rune
"/> without performing validation on the input.
1119
internal static
Rune
UnsafeCreate(uint scalarValue) => new Rune(scalarValue, false);
1123
public static double GetNumericValue(
Rune
value)
1145
public static UnicodeCategory GetUnicodeCategory(
Rune
value)
1157
private static UnicodeCategory GetUnicodeCategoryNonAscii(
Rune
value)
1208
public static bool IsControl(
Rune
value)
1222
public static bool IsDigit(
Rune
value)
1234
public static bool IsLetter(
Rune
value)
1246
public static bool IsLetterOrDigit(
Rune
value)
1258
public static bool IsLower(
Rune
value)
1270
public static bool IsNumber(
Rune
value)
1282
public static bool IsPunctuation(
Rune
value)
1287
public static bool IsSeparator(
Rune
value)
1292
public static bool IsSymbol(
Rune
value)
1297
public static bool IsUpper(
Rune
value)
1309
public static bool IsWhiteSpace(
Rune
value)
1327
public static
Rune
ToLower(
Rune
value, CultureInfo culture)
1352
public static
Rune
ToLowerInvariant(
Rune
value)
1382
public static
Rune
ToUpper(
Rune
value, CultureInfo culture)
1407
public static
Rune
ToUpperInvariant(
Rune
value)
VirtualChar.cs (11)
33
/// cref="
Rune
.ReplacementChar"/>. The value of this character can be retrieved from
36
public readonly
Rune
Rune;
40
/// cref="Rune"/>. If <see cref="Rune"/> is not <see cref="
Rune
.ReplacementChar"/>, this will be <c>0</c>.
54
public static VirtualChar Create(
Rune
rune, TextSpan span)
60
/// value will be <see cref="
Rune
.ReplacementChar"/>.
67
return new VirtualChar(rune:
Rune
.ReplacementChar, surrogateChar, span);
70
private VirtualChar(
Rune
rune, char surrogateChar, TextSpan span)
72
Contract.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)
302
if (
Rune
.TryCreate(ch, out
var
rune))
313
if (
Rune
.TryCreate(ch, nextCh, out rune))
RuneExtensions.cs (1)
17
public static bool TryGetEscapeCharacter(this
Rune
rune, out char escapedChar)
UseUtf8StringLiteralDiagnosticAnalyzer.cs (5)
156
if (!TryGetNextRune(arrayCreationElements, i, out
var
rune, out var bytesConsumed) ||
182
static bool IsControlOrFormatRune(
Rune
rune)
183
=>
Rune
.GetUnicodeCategory(rune) is UnicodeCategory.Control or UnicodeCategory.Format
193
private static bool TryGetNextRune(ImmutableArray<IOperation> arrayCreationElements, int startIndex, out
Rune
rune, out int bytesConsumed)
214
return
Rune
.DecodeFromUtf8(array, out rune, out bytesConsumed) == System.Buffers.OperationStatus.Done;