2 instantiations of VirtualChar
Microsoft.CodeAnalysis.CodeStyle (2)
VirtualChar.cs (2)
55
=>
new
(rune, surrogateChar: default, span);
67
return new
VirtualChar
(rune: Rune.ReplacementChar, surrogateChar, span);
100 references to VirtualChar
Microsoft.CodeAnalysis.CodeStyle (90)
AbstractVirtualCharService.cs (15)
17
public abstract bool TryGetEscapeCharacter(
VirtualChar
ch, out char escapedChar);
85
var
currentVC = result[0];
98
var
nextVC = result[i];
107
var
nextVC = result[i];
113
var
lastVC = result.Last();
161
var result = ImmutableSegmentedList.CreateBuilder<
VirtualChar
>();
168
result.Add(
VirtualChar
.Create(new Rune('"'), new TextSpan(offset + index, 2)));
177
result.Add(
VirtualChar
.Create(new Rune(tokenText[index]), span));
192
protected static int ConvertTextAtIndexToRune(string tokenText, int index, ImmutableSegmentedList<
VirtualChar
>.Builder result, int offset)
195
protected static int ConvertTextAtIndexToRune(SourceText tokenText, int index, ImmutableSegmentedList<
VirtualChar
>.Builder result, int offset)
199
T tokenText, int index, TTextInfo info, ImmutableSegmentedList<
VirtualChar
>.Builder result, int offset)
207
result.Add(
VirtualChar
.Create(rune, new TextSpan(offset + index, 1)));
214
result.Add(
VirtualChar
.Create(rune, new TextSpan(offset + index, 2)));
221
result.Add(
VirtualChar
.Create(ch, new TextSpan(offset + index, 1)));
232
ImmutableSegmentedList<
VirtualChar
>.Builder result)
EmbeddedSyntaxHelpers.cs (2)
18
public static TextSpan GetSpan(
VirtualChar
firstChar,
VirtualChar
lastChar)
EmbeddedSyntaxNode.cs (1)
125
public bool Contains(
VirtualChar
virtualChar)
IVirtualCharService.cs (4)
29
/// Takes in a string token and return the <see cref="
VirtualChar
"/>s corresponding to each
50
/// VirtualChar in the result array with a matching <see cref="
VirtualChar
.Rune"/> property.
51
/// Similarly, each VirtualChar's <see cref="
VirtualChar
.Span"/> will abut each other, and
70
bool TryGetEscapeCharacter(
VirtualChar
ch, out char escapeChar);
VirtualChar.cs (31)
13
/// <see cref="
VirtualChar
"/> provides a uniform view of a language's string token characters regardless if they
17
/// (<c>\</c> and <c>t</c>). <see cref="
VirtualChar
"/> will represent both, providing the raw <see cref="char"/>
27
internal readonly struct VirtualChar : IEquatable<
VirtualChar
>, IComparable<
VirtualChar
>, IComparable<char>
30
/// The value of this <see cref="
VirtualChar
"/> as a <see cref="Rune"/> if such a representation is possible.
46
/// cref="
VirtualChar
"/>.
51
/// Creates a new <see cref="
VirtualChar
"/> from the provided <paramref name="rune"/>. This operation cannot
54
public static
VirtualChar
Create(Rune rune, TextSpan span)
58
/// Creates a new <see cref="
VirtualChar
"/> from an unpaired high or low surrogate character. This will throw
62
public static
VirtualChar
Create(char surrogateChar, TextSpan span)
101
public static bool operator ==(
VirtualChar
char1,
VirtualChar
char2)
104
public static bool operator !=(
VirtualChar
char1,
VirtualChar
char2)
107
public static bool operator ==(
VirtualChar
ch1, char ch2)
110
public static bool operator !=(
VirtualChar
ch1, char ch2)
114
=> obj is
VirtualChar
vc && Equals(vc);
116
public bool Equals(
VirtualChar
other)
158
public int CompareTo(
VirtualChar
other)
161
public static bool operator <(
VirtualChar
ch1,
VirtualChar
ch2)
164
public static bool operator <=(
VirtualChar
ch1,
VirtualChar
ch2)
167
public static bool operator >(
VirtualChar
ch1,
VirtualChar
ch2)
170
public static bool operator >=(
VirtualChar
ch1,
VirtualChar
ch2)
176
public static bool operator <(
VirtualChar
ch1, char ch2)
179
public static bool operator <=(
VirtualChar
ch1, char ch2)
182
public static bool operator >(
VirtualChar
ch1, char ch2)
185
public static bool operator >=(
VirtualChar
ch1, char ch2)
VirtualCharSequence.Chunks.cs (12)
16
/// Abstraction over a contiguous chunk of <see cref="
VirtualChar
"/>s. This
17
/// is used so we can expose <see cref="
VirtualChar
"/>s over an <see cref="ImmutableArray{VirtualChar}"/>
28
public abstract
VirtualChar
this[int index] { get; }
29
public abstract
VirtualChar
? Find(int position);
39
private readonly ImmutableSegmentedList<
VirtualChar
> _array;
41
public ImmutableSegmentedListChunk(ImmutableSegmentedList<
VirtualChar
> array)
45
public override
VirtualChar
this[int index] => _array[index];
47
public override
VirtualChar
? Find(int position)
100
public override
VirtualChar
? Find(int position)
109
public override
VirtualChar
this[int index]
126
?
VirtualChar
.Create(ch, span)
127
:
VirtualChar
.Create(new Rune(ch), span);
VirtualCharSequence.cs (23)
30
public static readonly VirtualCharSequence Empty = Create(ImmutableSegmentedList<
VirtualChar
>.Empty);
32
public static VirtualCharSequence Create(ImmutableSegmentedList<
VirtualChar
> virtualChars)
72
/// Gets the <see cref="
VirtualChar
"/> at the specified index.
74
public
VirtualChar
this[int index] => _leafCharacters[_span.Start + index];
92
public
VirtualChar
First() => this[0];
93
public
VirtualChar
Last() => this[^1];
99
public
VirtualChar
? Find(int position)
102
public bool Contains(
VirtualChar
@char)
105
public int IndexOf(
VirtualChar
@char)
108
foreach (
var
ch in this)
119
public
VirtualChar
? FirstOrNull(Func<
VirtualChar
, bool> predicate)
121
foreach (
var
ch in this)
130
public
VirtualChar
? LastOrNull(Func<
VirtualChar
, bool> predicate)
134
var
ch = this[i];
142
public bool Any(Func<
VirtualChar
, bool> predicate)
144
foreach (
var
ch in this)
153
public bool All(Func<
VirtualChar
, bool> predicate)
155
foreach (
var
ch in this)
167
public VirtualCharSequence SkipWhile(Func<
VirtualChar
, bool> predicate)
170
foreach (
var
ch in this)
187
foreach (
var
ch in this)
VirtualCharSequence.Enumerator.cs (2)
13
public struct Enumerator : IEnumerator<
VirtualChar
>
25
public readonly
VirtualChar
Current => _virtualCharSequence[_position];
Microsoft.CodeAnalysis.CSharp.CodeStyle (9)
CSharpVirtualCharService.cs (8)
133
var result = ImmutableSegmentedList.CreateBuilder<
VirtualChar
>();
201
var result = ImmutableSegmentedList.CreateBuilder<
VirtualChar
>();
288
var runeResults = ImmutableSegmentedList.CreateBuilder<
VirtualChar
>();
295
private static void ConvertCharactersToRunes(ArrayBuilder<(char ch, TextSpan span)> charResults, ImmutableSegmentedList<
VirtualChar
>.Builder runeResults)
304
runeResults.Add(
VirtualChar
.Create(rune, span));
315
runeResults.Add(
VirtualChar
.Create(rune, TextSpan.FromBounds(span.Start, nextSpan.End)));
323
runeResults.Add(
VirtualChar
.Create(ch, span));
338
public override bool TryGetEscapeCharacter(
VirtualChar
ch, out char escapedChar)
RuneExtensions.cs (1)
14
public static bool TryGetEscapeCharacter(this
VirtualChar
ch, out char escapedChar)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (1)
VisualBasicVirtualCharService.vb (1)
18
Public Overrides Function TryGetEscapeCharacter(ch As
VirtualChar
, ByRef escapedChar As Char) As Boolean