33 references to Literal
System.Text.RegularExpressions.Generator (33)
RegexGenerator.Emitter.cs (33)
137rm.MatchTimeout is not null ? $"new({Literal(rm.Pattern)}, {Literal(rm.Options)}, {GetTimeoutExpression(rm.MatchTimeout.Value)});" : 138rm.Options != 0 ? $"new({Literal(rm.Pattern)}, {Literal(rm.Options)});" : 139$"new({Literal(rm.Pattern)});"); 167writer.WriteLine($" base.pattern = {Literal(rm.Pattern)};"); 198writer.Write(Literal(s)); 529: Literal(chars.ToString()); 618string setLiteral = Literal(new string(chars)); 1171$"/// <summary>Supports searching for the string {EscapeXmlComment(Literal(substring))}.</summary>", 1172$"internal static readonly SearchValues<string> {fieldName} = SearchValues.Create([{Literal(substring)}], StringComparison.{stringComparison});", 1176writer.WriteLine($"// The pattern has the literal {Literal(substring)} {offsetDescription}. Find the next occurrence."); 1218string prefixes = string.Join(", ", opts.LeadingPrefixes.Select(prefix => Literal(prefix))); 1248writer.WriteLine($"// The pattern begins with a literal {Literal(prefix)}. Find the next occurrence right-to-left."); 1250writer.WriteLine($"pos = inputSpan.Slice(0, pos).LastIndexOf({Literal(prefix)});"); 1495target.Literal.String is not null ? $"the {stringComparisonComment}string {Literal(target.Literal.String)}." : 1496target.Literal.Chars is not null ? $"one of the characters {Literal(new string(target.Literal.Chars))}" : 1516target.Literal.String is string literalString ? $"IndexOf({Literal(literalString)}{stringComparisonArgument});" : 3167writer.Write($"!{sourceSpan}.StartsWith({Literal(caseInsensitiveString)}, StringComparison.OrdinalIgnoreCase)"); 3168prevDescription = $"Match the string {Literal(caseInsensitiveString)} (ordinal case-insensitive)"; 3427using (EmitBlock(writer, $"if (inputSpan[--pos] != {Literal(str)}[{str.Length - 1} - i])")) 3437string clause = $"!{sourceSpan}.StartsWith({Literal(str)})"; 5075indexOfExpr = $"{last}IndexOf({Literal(node.Str!)})"; 5477$"((ch = {chExpr}) >= {Literal((char)analysis.UpperBoundExclusiveIfOnlyRanges)} || ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) == 0)" : 5478$"((ch = {chExpr}) < {Literal((char)analysis.UpperBoundExclusiveIfOnlyRanges)} && ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) != 0)"; 5486$"((ch = {chExpr}) < 128 && ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) == 0)" : 5487$"((ch = {chExpr}) >= 128 || ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) != 0)"; 5508_ => $"({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) {(negate ? "=" : "!")}= 0", 5510return $"((ch = {chExpr}) < 128 ? {asciiExpr} : {(negate ? "!" : "")}RegexRunner.CharInClass((char)ch, {Literal(charClass)}))"; 5515$"((ch = {chExpr}) < 128 || !RegexRunner.CharInClass((char)ch, {Literal(charClass)}))" : 5516$"((ch = {chExpr}) >= 128 && RegexRunner.CharInClass((char)ch, {Literal(charClass)}))"; 5522$"((ch = {chExpr}) >= 128 && !RegexRunner.CharInClass((char)ch, {Literal(charClass)}))" : 5523$"((ch = {chExpr}) < 128 || RegexRunner.CharInClass((char)ch, {Literal(charClass)}))"; 5612RegexNodeKind.Multi => $"Match the string {Literal(node.Str!)}{direction}.", 5641name = Literal(name);