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)); 1185$"/// <summary>Supports searching for the string {EscapeXmlComment(Literal(substring))}.</summary>", 1186$"internal static readonly SearchValues<string> {fieldName} = SearchValues.Create([{Literal(substring)}], StringComparison.{stringComparison});", 1190writer.WriteLine($"// The pattern has the literal {Literal(substring)} {offsetDescription}. Find the next occurrence."); 1232string prefixes = string.Join(", ", opts.LeadingPrefixes.Select(prefix => Literal(prefix))); 1262writer.WriteLine($"// The pattern begins with a literal {Literal(prefix)}. Find the next occurrence right-to-left."); 1264writer.WriteLine($"pos = inputSpan.Slice(0, pos).LastIndexOf({Literal(prefix)});"); 1509target.Literal.String is not null ? $"the {stringComparisonComment}string {Literal(target.Literal.String)}." : 1510target.Literal.Chars is not null ? $"one of the characters {Literal(new string(target.Literal.Chars))}" : 1530target.Literal.String is string literalString ? $"IndexOf({Literal(literalString)}{stringComparisonArgument});" : 3162writer.Write($"!{sourceSpan}.StartsWith({Literal(caseInsensitiveString)}, StringComparison.OrdinalIgnoreCase)"); 3163prevDescription = $"Match the string {Literal(caseInsensitiveString)} (ordinal case-insensitive)"; 3422using (EmitBlock(writer, $"if (inputSpan[--pos] != {Literal(str)}[{str.Length - 1} - i])")) 3432string clause = $"!{sourceSpan}.StartsWith({Literal(str)})"; 5070indexOfExpr = $"{last}IndexOf({Literal(node.Str!)})"; 5472$"((ch = {chExpr}) >= {Literal((char)analysis.UpperBoundExclusiveIfOnlyRanges)} || ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) == 0)" : 5473$"((ch = {chExpr}) < {Literal((char)analysis.UpperBoundExclusiveIfOnlyRanges)} && ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) != 0)"; 5481$"((ch = {chExpr}) < 128 && ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) == 0)" : 5482$"((ch = {chExpr}) >= 128 || ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) != 0)"; 5503_ => $"({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) {(negate ? "=" : "!")}= 0", 5505return $"((ch = {chExpr}) < 128 ? {asciiExpr} : {(negate ? "!" : "")}RegexRunner.CharInClass((char)ch, {Literal(charClass)}))"; 5510$"((ch = {chExpr}) < 128 || !RegexRunner.CharInClass((char)ch, {Literal(charClass)}))" : 5511$"((ch = {chExpr}) >= 128 && RegexRunner.CharInClass((char)ch, {Literal(charClass)}))"; 5517$"((ch = {chExpr}) >= 128 && !RegexRunner.CharInClass((char)ch, {Literal(charClass)}))" : 5518$"((ch = {chExpr}) < 128 || RegexRunner.CharInClass((char)ch, {Literal(charClass)}))"; 5607RegexNodeKind.Multi => $"Match the string {Literal(node.Str!)}{direction}.", 5636name = Literal(name);