// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Debug.Assert(currentVC.Span.Start>token.SpanStart,"First span has to start after the start of the string token (including its delimeter)");
Debug.Assert(currentVC.Span.Start==token.SpanStart+1||currentVC.Span.Start==token.SpanStart+2,"First span should start on the second or third char of the string.");
for(vari=1;i<result.Length;i++)
{
varnextVC=result[i];
Debug.Assert(currentVC.Span.End==nextVC.Span.Start,"Virtual character spans have to be touching.");
currentVC=nextVC;
}
varlastVC=result.Last();
Debug.Assert(lastVC.Span.End==token.Span.End-1,"Last span has to end right before the end of hte string token (including its trailing delimeter).");
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem.Collections.Immutable;
usingMicrosoft.CodeAnalysis.Host;
namespaceMicrosoft.CodeAnalysis.VirtualChars
{
/// <summary>
/// Helper service that takes the raw text of a string token and produces the individual
/// characters that raw string token represents (i.e. with escapes collapsed). The difference
/// between this and the result from token.ValueText is that for each collapsed character returned
/// the original span of text in the original token can be found. i.e. if you had the following
/// in C#:
///
/// "G\u006fo"
///
/// Then you'd get back:
///
/// 'G' -> [0, 1)
/// 'o' -> [1, 7)
/// 'o' -> [7, 1)
///
/// This allows for regex processing that can refer back to the users' original code instead of
Debug.Assert(currentVC.Span.Start>token.SpanStart,"First span has to start after the start of the string token (including its delimeter)");
Debug.Assert(currentVC.Span.Start==token.SpanStart+1||currentVC.Span.Start==token.SpanStart+2,"First span should start on the second or third char of the string.");
for(vari=1;i<result.Length;i++)
{
varnextVC=result[i];
Debug.Assert(currentVC.Span.End==nextVC.Span.Start,"Virtual character spans have to be touching.");
currentVC=nextVC;
}
varlastVC=result.Last();
Debug.Assert(lastVC.Span.End==token.Span.End-1,"Last span has to end right before the end of hte string token (including its trailing delimeter).");
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.