1 instantiation of VirtualChar
Microsoft.CodeAnalysis.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (1)
54
=>
new
(rune, surrogateChar: default, span);
82 references to VirtualChar
Microsoft.CodeAnalysis.CodeStyle (82)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxHelpers.cs (2)
18
public static TextSpan GetSpan(
VirtualChar
firstChar,
VirtualChar
lastChar)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
125
public bool Contains(
VirtualChar
virtualChar)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (15)
16
public abstract bool TryGetEscapeCharacter(
VirtualChar
ch, out char escapedChar);
84
var
currentVC = result[0];
97
var
nextVC = result[i];
106
var
nextVC = result[i];
112
var
lastVC = result.Last();
160
var result = ImmutableSegmentedList.CreateBuilder<
VirtualChar
>();
167
result.Add(
VirtualChar
.Create(new Rune('"'), new TextSpan(offset + index, 2)));
176
result.Add(
VirtualChar
.Create(new Rune(tokenText[index]), span));
191
protected static int ConvertTextAtIndexToRune(string tokenText, int index, ImmutableSegmentedList<
VirtualChar
>.Builder result, int offset)
194
protected static int ConvertTextAtIndexToRune(SourceText tokenText, int index, ImmutableSegmentedList<
VirtualChar
>.Builder result, int offset)
198
T tokenText, int index, TTextInfo info, ImmutableSegmentedList<
VirtualChar
>.Builder result, int offset)
206
result.Add(
VirtualChar
.Create(rune, new TextSpan(offset + index, 1)));
213
result.Add(
VirtualChar
.Create(rune, new TextSpan(offset + index, 2)));
220
result.Add(
VirtualChar
.Create(ch, new TextSpan(offset + index, 1)));
231
ImmutableSegmentedList<
VirtualChar
>.Builder result)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\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);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (24)
12
/// <see cref="
VirtualChar
"/> provides a uniform view of a language's string token characters regardless if they
16
/// (<c>\</c> and <c>t</c>). <see cref="
VirtualChar
"/> will represent both, providing the raw <see cref="char"/>
26
internal readonly record struct VirtualChar : IComparable<
VirtualChar
>, IComparable<char>
29
/// The value of this <see cref="
VirtualChar
"/> as a <see cref="Rune"/> if such a representation is possible.
45
/// cref="
VirtualChar
"/>.
50
/// Creates a new <see cref="
VirtualChar
"/> from the provided <paramref name="rune"/>. This operation cannot
53
public static
VirtualChar
Create(Rune rune, TextSpan span)
57
/// Creates a new <see cref="
VirtualChar
"/> from an unpaired high or low surrogate character. This will throw
61
public static
VirtualChar
Create(char surrogateChar, TextSpan span)
106
public static bool operator ==(
VirtualChar
ch1, char ch2)
109
public static bool operator !=(
VirtualChar
ch1, char ch2)
140
public int CompareTo(
VirtualChar
other)
143
public static bool operator <(
VirtualChar
ch1,
VirtualChar
ch2)
146
public static bool operator <=(
VirtualChar
ch1,
VirtualChar
ch2)
149
public static bool operator >(
VirtualChar
ch1,
VirtualChar
ch2)
152
public static bool operator >=(
VirtualChar
ch1,
VirtualChar
ch2)
158
public static bool operator <(
VirtualChar
ch1, char ch2)
161
public static bool operator <=(
VirtualChar
ch1, char ch2)
164
public static bool operator >(
VirtualChar
ch1, char ch2)
167
public static bool operator >=(
VirtualChar
ch1, char ch2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (11)
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);
37
private sealed class ImmutableSegmentedListChunk(ImmutableSegmentedList<
VirtualChar
> array) : Chunk
40
public override
VirtualChar
this[int index] => array[index];
42
public override
VirtualChar
? Find(int position)
85
public override
VirtualChar
? Find(int position)
94
public override
VirtualChar
this[int index]
111
?
VirtualChar
.Create(ch, span)
112
:
VirtualChar
.Create(new Rune(ch), span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\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)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Enumerator.cs (2)
12
public struct Enumerator(VirtualCharSequence virtualCharSequence) : IEnumerator<
VirtualChar
>
17
public readonly
VirtualChar
Current => virtualCharSequence[_position];