33 references to Literal
System.Text.RegularExpressions.Generator (33)
RegexGenerator.Emitter.cs (33)
138rm.MatchTimeout is not null ? $"new({Literal(rm.Pattern)}, {Literal(rm.Options)}, {GetTimeoutExpression(rm.MatchTimeout.Value)});" : 139rm.Options != 0 ? $"new({Literal(rm.Pattern)}, {Literal(rm.Options)});" : 140$"new({Literal(rm.Pattern)});"); 168writer.WriteLine($" base.pattern = {Literal(rm.Pattern)};"); 199writer.Write(Literal(s)); 530: Literal(chars.ToString()); 619string setLiteral = Literal(new string(chars)); 1187$"/// <summary>Supports searching for the string {EscapeXmlComment(Literal(substring))}.</summary>", 1188$"internal static readonly SearchValues<string> {fieldName} = SearchValues.Create([{Literal(substring)}], StringComparison.{stringComparison});", 1192writer.WriteLine($"// The pattern has the literal {Literal(substring)} {offsetDescription}. Find the next occurrence."); 1234string prefixes = string.Join(", ", opts.LeadingPrefixes.Select(prefix => Literal(prefix))); 1264writer.WriteLine($"// The pattern begins with a literal {Literal(prefix)}. Find the next occurrence right-to-left."); 1266writer.WriteLine($"pos = inputSpan.Slice(0, pos).LastIndexOf({Literal(prefix)});"); 1511target.Literal.String is not null ? $"the {stringComparisonComment}string {Literal(target.Literal.String)}." : 1512target.Literal.Chars is not null ? $"one of the characters {Literal(new string(target.Literal.Chars))}" : 1532target.Literal.String is string literalString ? $"IndexOf({Literal(literalString)}{stringComparisonArgument});" : 3113writer.Write($"!{sourceSpan}.StartsWith({Literal(caseInsensitiveString)}, StringComparison.OrdinalIgnoreCase)"); 3114prevDescription = $"Match the string {Literal(caseInsensitiveString)} (ordinal case-insensitive)"; 3373using (EmitBlock(writer, $"if (inputSpan[--pos] != {Literal(str)}[{str.Length - 1} - i])")) 3383string clause = $"!{sourceSpan}.StartsWith({Literal(str)})"; 5061indexOfExpr = $"{last}IndexOf({Literal(node.Str!)})"; 5463$"((ch = {chExpr}) >= {Literal((char)analysis.UpperBoundExclusiveIfOnlyRanges)} || ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) == 0)" : 5464$"((ch = {chExpr}) < {Literal((char)analysis.UpperBoundExclusiveIfOnlyRanges)} && ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) != 0)"; 5472$"((ch = {chExpr}) < 128 && ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) == 0)" : 5473$"((ch = {chExpr}) >= 128 || ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) != 0)"; 5494_ => $"({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) {(negate ? "=" : "!")}= 0", 5496return $"((ch = {chExpr}) < 128 ? {asciiExpr} : {(negate ? "!" : "")}RegexRunner.CharInClass((char)ch, {Literal(charClass)}))"; 5501$"((ch = {chExpr}) < 128 || !RegexRunner.CharInClass((char)ch, {Literal(charClass)}))" : 5502$"((ch = {chExpr}) >= 128 && RegexRunner.CharInClass((char)ch, {Literal(charClass)}))"; 5508$"((ch = {chExpr}) >= 128 && !RegexRunner.CharInClass((char)ch, {Literal(charClass)}))" : 5509$"((ch = {chExpr}) < 128 || RegexRunner.CharInClass((char)ch, {Literal(charClass)}))"; 5598RegexNodeKind.Multi => $"Match the string {Literal(node.Str!)}{direction}.", 5627name = Literal(name);