| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System.Diagnostics; |
| | | 5 | | using System.Diagnostics.CodeAnalysis; |
| | | 6 | | using System.Globalization; |
| | | 7 | | using System.IO; |
| | | 8 | | using System.Runtime.CompilerServices; |
| | | 9 | | using System.Text; |
| | | 10 | | |
| | | 11 | | namespace System.Reflection |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Parses an assembly name. |
| | | 15 | | /// </summary> |
| | | 16 | | internal ref partial struct AssemblyNameParser |
| | | 17 | | { |
| | | 18 | | public readonly struct AssemblyNameParts |
| | | 19 | | { |
| | | 20 | | public AssemblyNameParts(string name, Version? version, string? cultureName, AssemblyNameFlags flags, byte[] |
| | 4704 | 21 | | { |
| | 4704 | 22 | | _name = name; |
| | 4704 | 23 | | _version = version; |
| | 4704 | 24 | | _cultureName = cultureName; |
| | 4704 | 25 | | _flags = flags; |
| | 4704 | 26 | | _publicKeyOrToken = publicKeyOrToken; |
| | 4704 | 27 | | } |
| | | 28 | | |
| | | 29 | | public readonly string _name; |
| | | 30 | | public readonly Version? _version; |
| | | 31 | | public readonly string? _cultureName; |
| | | 32 | | public readonly AssemblyNameFlags _flags; |
| | | 33 | | public readonly byte[]? _publicKeyOrToken; |
| | | 34 | | } |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Token categories for the lexer. |
| | | 38 | | /// </summary> |
| | | 39 | | private enum Token |
| | | 40 | | { |
| | | 41 | | Equals = 1, |
| | | 42 | | Comma = 2, |
| | | 43 | | String = 3, |
| | | 44 | | End = 4, |
| | | 45 | | } |
| | | 46 | | |
| | | 47 | | private enum AttributeKind |
| | | 48 | | { |
| | | 49 | | Version = 1, |
| | | 50 | | Culture = 2, |
| | | 51 | | PublicKeyOrToken = 4, |
| | | 52 | | ProcessorArchitecture = 8, |
| | | 53 | | Retargetable = 16, |
| | | 54 | | ContentType = 32 |
| | | 55 | | } |
| | | 56 | | |
| | | 57 | | private readonly ReadOnlySpan<char> _input; |
| | | 58 | | private int _index; |
| | | 59 | | |
| | | 60 | | private AssemblyNameParser(ReadOnlySpan<char> input) |
| | 10140 | 61 | | { |
| | | 62 | | #if SYSTEM_PRIVATE_CORELIB |
| | | 63 | | if (input.Length == 0) |
| | | 64 | | throw new ArgumentException(SR.Format_StringZeroLength); |
| | | 65 | | #else |
| | 10140 | 66 | | Debug.Assert(input.Length > 0); |
| | | 67 | | #endif |
| | | 68 | | |
| | 10140 | 69 | | _input = input; |
| | 10140 | 70 | | _index = 0; |
| | 10140 | 71 | | } |
| | | 72 | | |
| | | 73 | | #if SYSTEM_PRIVATE_CORELIB |
| | | 74 | | public static AssemblyNameParts Parse(string name) => Parse(name.AsSpan()); |
| | | 75 | | |
| | | 76 | | public static AssemblyNameParts Parse(ReadOnlySpan<char> name) |
| | | 77 | | { |
| | | 78 | | AssemblyNameParser parser = new(name); |
| | | 79 | | AssemblyNameParts result = default; |
| | | 80 | | if (parser.TryParse(ref result)) |
| | | 81 | | { |
| | | 82 | | return result; |
| | | 83 | | } |
| | | 84 | | throw new FileLoadException(SR.InvalidAssemblyName, name.ToString()); |
| | | 85 | | } |
| | | 86 | | #endif |
| | | 87 | | |
| | | 88 | | internal static bool TryParse(ReadOnlySpan<char> name, ref AssemblyNameParts parts) |
| | 10140 | 89 | | { |
| | 10140 | 90 | | AssemblyNameParser parser = new(name); |
| | 10140 | 91 | | return parser.TryParse(ref parts); |
| | 10140 | 92 | | } |
| | | 93 | | |
| | | 94 | | private static bool TryRecordNewSeen(scoped ref AttributeKind seenAttributes, AttributeKind newAttribute) |
| | 4804 | 95 | | { |
| | 4804 | 96 | | if ((seenAttributes & newAttribute) != 0) |
| | 632 | 97 | | { |
| | 632 | 98 | | return false; |
| | | 99 | | } |
| | 4172 | 100 | | seenAttributes |= newAttribute; |
| | 4172 | 101 | | return true; |
| | 4804 | 102 | | } |
| | | 103 | | |
| | | 104 | | private bool TryParse(ref AssemblyNameParts result) |
| | 10140 | 105 | | { |
| | | 106 | | // Name must come first. |
| | 10140 | 107 | | if (!TryGetNextToken(out string name, out Token token) || token != Token.String || string.IsNullOrEmpty(name |
| | 984 | 108 | | return false; |
| | | 109 | | |
| | 9156 | 110 | | Version? version = null; |
| | 9156 | 111 | | string? cultureName = null; |
| | 9156 | 112 | | byte[]? pkt = null; |
| | 9156 | 113 | | AssemblyNameFlags flags = 0; |
| | | 114 | | |
| | 9156 | 115 | | AttributeKind alreadySeen = default; |
| | 9156 | 116 | | if (!TryGetNextToken(out _, out token)) |
| | 72 | 117 | | return false; |
| | | 118 | | |
| | 42556 | 119 | | while (token != Token.End) |
| | 37852 | 120 | | { |
| | 37852 | 121 | | if (token != Token.Comma) |
| | 444 | 122 | | return false; |
| | | 123 | | |
| | 37408 | 124 | | if (!TryGetNextToken(out string attributeName, out token) || token != Token.String) |
| | 320 | 125 | | return false; |
| | | 126 | | |
| | 37088 | 127 | | if (!TryGetNextToken(out _, out token) || token != Token.Equals) |
| | 1012 | 128 | | return false; |
| | | 129 | | |
| | 36076 | 130 | | if (!TryGetNextToken(out string attributeValue, out token) || token != Token.String) |
| | 292 | 131 | | return false; |
| | | 132 | | |
| | 35784 | 133 | | if (attributeName == string.Empty) |
| | 76 | 134 | | return false; |
| | | 135 | | |
| | 35708 | 136 | | if (IsAttribute(attributeName, "Version")) |
| | 1728 | 137 | | { |
| | 1728 | 138 | | if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.Version)) |
| | 228 | 139 | | { |
| | 228 | 140 | | return false; |
| | | 141 | | } |
| | 1500 | 142 | | if (!TryParseVersion(attributeValue, ref version)) |
| | 432 | 143 | | { |
| | 432 | 144 | | return false; |
| | | 145 | | } |
| | 1068 | 146 | | } |
| | 33980 | 147 | | else if (IsAttribute(attributeName, "Culture")) |
| | 0 | 148 | | { |
| | 0 | 149 | | if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.Culture)) |
| | 0 | 150 | | { |
| | 0 | 151 | | return false; |
| | | 152 | | } |
| | 0 | 153 | | if (!TryParseCulture(attributeValue, out cultureName)) |
| | 0 | 154 | | { |
| | 0 | 155 | | return false; |
| | | 156 | | } |
| | 0 | 157 | | } |
| | 33980 | 158 | | else if (IsAttribute(attributeName, "PublicKeyToken")) |
| | 952 | 159 | | { |
| | 952 | 160 | | if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.PublicKeyOrToken)) |
| | 196 | 161 | | { |
| | 196 | 162 | | return false; |
| | | 163 | | } |
| | 756 | 164 | | if (!TryParsePKT(attributeValue, isToken: true, out pkt)) |
| | 528 | 165 | | { |
| | 528 | 166 | | return false; |
| | | 167 | | } |
| | 228 | 168 | | } |
| | 33028 | 169 | | else if (IsAttribute(attributeName, "PublicKey")) |
| | 1016 | 170 | | { |
| | 1016 | 171 | | if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.PublicKeyOrToken)) |
| | 88 | 172 | | { |
| | 88 | 173 | | return false; |
| | | 174 | | } |
| | 928 | 175 | | if (!TryParsePKT(attributeValue, isToken: false, out pkt)) |
| | 304 | 176 | | { |
| | 304 | 177 | | return false; |
| | | 178 | | } |
| | 624 | 179 | | flags |= AssemblyNameFlags.PublicKey; |
| | 624 | 180 | | } |
| | 32012 | 181 | | else if (IsAttribute(attributeName, "ProcessorArchitecture")) |
| | 468 | 182 | | { |
| | 468 | 183 | | if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.ProcessorArchitecture)) |
| | 24 | 184 | | { |
| | 24 | 185 | | return false; |
| | | 186 | | } |
| | 444 | 187 | | if (!TryParseProcessorArchitecture(attributeValue, out ProcessorArchitecture arch)) |
| | 88 | 188 | | { |
| | 88 | 189 | | return false; |
| | | 190 | | } |
| | 356 | 191 | | flags |= (AssemblyNameFlags)(((int)arch) << 4); |
| | 356 | 192 | | } |
| | 31544 | 193 | | else if (IsAttribute(attributeName, "Retargetable")) |
| | 372 | 194 | | { |
| | 372 | 195 | | if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.Retargetable)) |
| | 28 | 196 | | { |
| | 28 | 197 | | return false; |
| | | 198 | | } |
| | | 199 | | |
| | 344 | 200 | | if (attributeValue.Equals("Yes", StringComparison.OrdinalIgnoreCase)) |
| | 272 | 201 | | { |
| | 272 | 202 | | flags |= AssemblyNameFlags.Retargetable; |
| | 272 | 203 | | } |
| | 72 | 204 | | else if (attributeValue.Equals("No", StringComparison.OrdinalIgnoreCase)) |
| | 0 | 205 | | { |
| | | 206 | | // nothing to do |
| | 0 | 207 | | } |
| | | 208 | | else |
| | 72 | 209 | | { |
| | 72 | 210 | | return false; |
| | | 211 | | } |
| | 272 | 212 | | } |
| | 31172 | 213 | | else if (IsAttribute(attributeName, "ContentType")) |
| | 268 | 214 | | { |
| | 268 | 215 | | if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.ContentType)) |
| | 68 | 216 | | { |
| | 68 | 217 | | return false; |
| | | 218 | | } |
| | | 219 | | |
| | 200 | 220 | | if (attributeValue.Equals("WindowsRuntime", StringComparison.OrdinalIgnoreCase)) |
| | 96 | 221 | | { |
| | 96 | 222 | | flags |= (AssemblyNameFlags)(((int)AssemblyContentType.WindowsRuntime) << 9); |
| | 96 | 223 | | } |
| | | 224 | | else |
| | 104 | 225 | | { |
| | 104 | 226 | | return false; |
| | | 227 | | } |
| | 96 | 228 | | } |
| | | 229 | | else |
| | 30904 | 230 | | { |
| | | 231 | | // Desktop compat: If we got here, the attribute name is unknown to us. Ignore it. |
| | 30904 | 232 | | } |
| | | 233 | | |
| | 33548 | 234 | | if (!TryGetNextToken(out _, out token)) |
| | 76 | 235 | | { |
| | 76 | 236 | | return false; |
| | | 237 | | } |
| | 33472 | 238 | | } |
| | | 239 | | |
| | 4704 | 240 | | result = new AssemblyNameParts(name, version, cultureName, flags, pkt); |
| | 4704 | 241 | | return true; |
| | 10140 | 242 | | } |
| | | 243 | | |
| | | 244 | | private static bool IsAttribute(string candidate, string attributeKind) |
| | 231424 | 245 | | => candidate.Equals(attributeKind, StringComparison.OrdinalIgnoreCase); |
| | | 246 | | |
| | | 247 | | private static unsafe bool TryParseVersion(string attributeValue, ref Version? version) |
| | 1500 | 248 | | { |
| | | 249 | | #if NET |
| | 1500 | 250 | | ReadOnlySpan<char> attributeValueSpan = attributeValue; |
| | 1500 | 251 | | Span<Range> parts = stackalloc Range[5]; |
| | 1500 | 252 | | parts = parts.Slice(0, attributeValueSpan.Split(parts, '.')); |
| | | 253 | | #else |
| | | 254 | | string[] parts = attributeValue.Split('.'); |
| | | 255 | | #endif |
| | 1500 | 256 | | if (parts.Length is < 2 or > 4) |
| | 172 | 257 | | { |
| | 172 | 258 | | return false; |
| | | 259 | | } |
| | | 260 | | |
| | 1328 | 261 | | Span<ushort> versionNumbers = [ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue]; |
| | 10928 | 262 | | for (int i = 0; i < parts.Length; i++) |
| | 4396 | 263 | | { |
| | 4396 | 264 | | if (!ushort.TryParse( |
| | 4396 | 265 | | #if NET |
| | 4396 | 266 | | attributeValueSpan[parts[i]], |
| | 4396 | 267 | | #else |
| | 4396 | 268 | | parts[i], |
| | 4396 | 269 | | #endif |
| | 4396 | 270 | | NumberStyles.None, NumberFormatInfo.InvariantInfo, out versionNumbers[i])) |
| | 260 | 271 | | { |
| | 260 | 272 | | return false; |
| | | 273 | | } |
| | 4136 | 274 | | } |
| | | 275 | | |
| | 1068 | 276 | | if (versionNumbers[0] == ushort.MaxValue || |
| | 1068 | 277 | | versionNumbers[1] == ushort.MaxValue) |
| | 0 | 278 | | { |
| | 0 | 279 | | return false; |
| | | 280 | | } |
| | | 281 | | |
| | 1068 | 282 | | version = |
| | 1068 | 283 | | versionNumbers[2] == ushort.MaxValue ? new Version(versionNumbers[0], versionNumbers[1]) : |
| | 1068 | 284 | | versionNumbers[3] == ushort.MaxValue ? new Version(versionNumbers[0], versionNumbers[1], versionNumbers[ |
| | 1068 | 285 | | new Version(versionNumbers[0], versionNumbers[1], versionNumbers[2], versionNumbers[3]); |
| | | 286 | | |
| | 1068 | 287 | | return true; |
| | 1500 | 288 | | } |
| | | 289 | | |
| | | 290 | | private static bool TryParseCulture(string attributeValue, out string? result) |
| | 0 | 291 | | { |
| | 0 | 292 | | if (attributeValue.Equals("Neutral", StringComparison.OrdinalIgnoreCase)) |
| | 0 | 293 | | { |
| | 0 | 294 | | result = ""; |
| | 0 | 295 | | return true; |
| | | 296 | | } |
| | | 297 | | |
| | 0 | 298 | | result = attributeValue; |
| | 0 | 299 | | return true; |
| | 0 | 300 | | } |
| | | 301 | | |
| | | 302 | | private static bool TryParsePKT(string attributeValue, bool isToken, out byte[]? result) |
| | 1684 | 303 | | { |
| | 1684 | 304 | | if (attributeValue.Equals("null", StringComparison.OrdinalIgnoreCase) || attributeValue == string.Empty) |
| | 240 | 305 | | { |
| | 240 | 306 | | result = []; |
| | 240 | 307 | | return true; |
| | | 308 | | } |
| | | 309 | | |
| | 1444 | 310 | | if (attributeValue.Length % 2 != 0 || (isToken && attributeValue.Length != 8 * 2)) |
| | 412 | 311 | | { |
| | 412 | 312 | | result = null; |
| | 412 | 313 | | return false; |
| | | 314 | | } |
| | | 315 | | |
| | 1032 | 316 | | byte[] pkt = new byte[attributeValue.Length / 2]; |
| | 1032 | 317 | | if (!HexConverter.TryDecodeFromUtf16(attributeValue.AsSpan(), pkt, out int _)) |
| | 420 | 318 | | { |
| | 420 | 319 | | result = null; |
| | 420 | 320 | | return false; |
| | | 321 | | } |
| | | 322 | | |
| | 612 | 323 | | result = pkt; |
| | 612 | 324 | | return true; |
| | 1684 | 325 | | } |
| | | 326 | | |
| | | 327 | | private static bool TryParseProcessorArchitecture(string attributeValue, out ProcessorArchitecture result) |
| | 444 | 328 | | { |
| | 444 | 329 | | result = attributeValue switch |
| | 444 | 330 | | { |
| | 712 | 331 | | _ when attributeValue.Equals("msil", StringComparison.OrdinalIgnoreCase) => ProcessorArchitecture.MSIL, |
| | 216 | 332 | | _ when attributeValue.Equals("x86", StringComparison.OrdinalIgnoreCase) => ProcessorArchitecture.X86, |
| | 136 | 333 | | _ when attributeValue.Equals("ia64", StringComparison.OrdinalIgnoreCase) => ProcessorArchitecture.IA64, |
| | 160 | 334 | | _ when attributeValue.Equals("amd64", StringComparison.OrdinalIgnoreCase) => ProcessorArchitecture.Amd64 |
| | 136 | 335 | | _ when attributeValue.Equals("arm", StringComparison.OrdinalIgnoreCase) => ProcessorArchitecture.Arm, |
| | 88 | 336 | | _ => ProcessorArchitecture.None |
| | 444 | 337 | | }; |
| | 444 | 338 | | return result != ProcessorArchitecture.None; |
| | 444 | 339 | | } |
| | | 340 | | |
| | | 341 | | private static bool IsWhiteSpace(char ch) |
| | 186228 | 342 | | => ch is '\n' or '\r' or ' ' or '\t'; |
| | | 343 | | |
| | | 344 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 345 | | private bool TryGetNextChar(out char ch) |
| | 1445748 | 346 | | { |
| | 1445748 | 347 | | if (_index < _input.Length) |
| | 1433000 | 348 | | { |
| | 1433000 | 349 | | ch = _input[_index++]; |
| | 1433000 | 350 | | if (ch == '\0') |
| | 368 | 351 | | { |
| | 368 | 352 | | return false; |
| | | 353 | | } |
| | 1432632 | 354 | | } |
| | | 355 | | else |
| | 12748 | 356 | | { |
| | 12748 | 357 | | ch = '\0'; |
| | 12748 | 358 | | } |
| | | 359 | | |
| | 1445380 | 360 | | return true; |
| | 1445748 | 361 | | } |
| | | 362 | | |
| | | 363 | | // |
| | | 364 | | // Return the next token in assembly name. If the result is Token.String, |
| | | 365 | | // sets "tokenString" to the tokenized string. |
| | | 366 | | // |
| | | 367 | | private unsafe bool TryGetNextToken(out string tokenString, out Token token) |
| | 163416 | 368 | | { |
| | 163416 | 369 | | tokenString = string.Empty; |
| | | 370 | | char c; |
| | | 371 | | |
| | 179060 | 372 | | while (true) |
| | 179060 | 373 | | { |
| | 179060 | 374 | | if (!TryGetNextChar(out c)) |
| | 20 | 375 | | { |
| | 20 | 376 | | token = default; |
| | 20 | 377 | | return false; |
| | | 378 | | } |
| | | 379 | | |
| | 179040 | 380 | | switch (c) |
| | | 381 | | { |
| | | 382 | | case ',': |
| | 37928 | 383 | | { |
| | 37928 | 384 | | token = Token.Comma; |
| | 37928 | 385 | | return true; |
| | | 386 | | } |
| | | 387 | | case '=': |
| | 36360 | 388 | | { |
| | 36360 | 389 | | token = Token.Equals; |
| | 36360 | 390 | | return true; |
| | | 391 | | } |
| | | 392 | | case '\0': |
| | 5444 | 393 | | { |
| | 5444 | 394 | | token = Token.End; |
| | 5444 | 395 | | return true; |
| | | 396 | | } |
| | | 397 | | } |
| | | 398 | | |
| | 99308 | 399 | | if (!IsWhiteSpace(c)) |
| | 83664 | 400 | | { |
| | 83664 | 401 | | break; |
| | | 402 | | } |
| | 15644 | 403 | | } |
| | | 404 | | |
| | 83664 | 405 | | using ValueStringBuilder sb = new ValueStringBuilder(stackalloc char[64]); |
| | | 406 | | |
| | 83664 | 407 | | char quoteChar = '\0'; |
| | 83664 | 408 | | if (c is '\'' or '\"') |
| | 1688 | 409 | | { |
| | 1688 | 410 | | quoteChar = c; |
| | 1688 | 411 | | if (!TryGetNextChar(out c)) |
| | 8 | 412 | | { |
| | 8 | 413 | | token = default; |
| | 8 | 414 | | return false; |
| | | 415 | | } |
| | 1680 | 416 | | } |
| | | 417 | | |
| | | 418 | | for (; ; ) |
| | 1319848 | 419 | | { |
| | 1319848 | 420 | | if (c == 0) |
| | 7060 | 421 | | { |
| | 7060 | 422 | | if (quoteChar != 0) |
| | 552 | 423 | | { |
| | | 424 | | // EOS and unclosed quotes is an error |
| | 552 | 425 | | token = default; |
| | 552 | 426 | | return false; |
| | | 427 | | } |
| | | 428 | | // Reached end of input and therefore of string |
| | 6508 | 429 | | break; |
| | | 430 | | } |
| | | 431 | | |
| | 1312788 | 432 | | if (quoteChar != 0 && c == quoteChar) |
| | 1000 | 433 | | break; // Terminate: Found closing quote of quoted string. |
| | | 434 | | |
| | 1311788 | 435 | | if (quoteChar == 0 && (c is ',' or '=')) |
| | 74752 | 436 | | { |
| | 74752 | 437 | | _index--; |
| | 74752 | 438 | | break; // Terminate: Found start of a new ',' or '=' token. |
| | | 439 | | } |
| | | 440 | | |
| | 1237036 | 441 | | if (quoteChar == 0 && (c is '\'' or '\"')) |
| | 164 | 442 | | { |
| | 164 | 443 | | token = default; |
| | 164 | 444 | | return false; |
| | | 445 | | } |
| | | 446 | | |
| | 1236872 | 447 | | if (c is '\\') |
| | 28472 | 448 | | { |
| | 28472 | 449 | | if (!TryGetNextChar(out c)) |
| | 4 | 450 | | { |
| | 4 | 451 | | token = default; |
| | 4 | 452 | | return false; |
| | | 453 | | } |
| | | 454 | | |
| | 28468 | 455 | | switch (c) |
| | | 456 | | { |
| | | 457 | | case '\\': |
| | | 458 | | case ',': |
| | | 459 | | case '=': |
| | | 460 | | case '\'': |
| | | 461 | | case '"': |
| | 23688 | 462 | | sb.Append(c); |
| | 23688 | 463 | | break; |
| | | 464 | | case 't': |
| | 2388 | 465 | | sb.Append('\t'); |
| | 2388 | 466 | | break; |
| | | 467 | | case 'r': |
| | 996 | 468 | | sb.Append('\r'); |
| | 996 | 469 | | break; |
| | | 470 | | case 'n': |
| | 1056 | 471 | | sb.Append('\n'); |
| | 1056 | 472 | | break; |
| | | 473 | | default: |
| | 340 | 474 | | token = default; |
| | 340 | 475 | | return false; |
| | | 476 | | } |
| | 28128 | 477 | | } |
| | | 478 | | else |
| | 1208400 | 479 | | { |
| | 1208400 | 480 | | sb.Append(c); |
| | 1208400 | 481 | | } |
| | | 482 | | |
| | 1236528 | 483 | | if (!TryGetNextChar(out c)) |
| | 336 | 484 | | { |
| | 336 | 485 | | token = default; |
| | 336 | 486 | | return false; |
| | | 487 | | } |
| | 1236192 | 488 | | } |
| | | 489 | | |
| | | 490 | | |
| | 82260 | 491 | | int length = sb.Length; |
| | 82260 | 492 | | if (quoteChar == 0) |
| | 81260 | 493 | | { |
| | 86976 | 494 | | while (length > 0 && IsWhiteSpace(sb[length - 1])) |
| | 5716 | 495 | | length--; |
| | 81260 | 496 | | } |
| | | 497 | | |
| | 82260 | 498 | | tokenString = sb.AsSpan(0, length).ToString(); |
| | 82260 | 499 | | token = Token.String; |
| | 82260 | 500 | | return true; |
| | 163416 | 501 | | } |
| | | 502 | | } |
| | | 503 | | } |