34 references to Literal
System.Text.RegularExpressions.Generator (34)
RegexGenerator.Emitter.cs (34)
62writer.WriteLine($"/// <code>{EscapeXmlComment(Literal(regexMethod.Pattern, quote: false))}</code><br/>"); 111rm.MatchTimeout is not null ? $"new({Literal(rm.Pattern)}, {Literal(rm.Options)}, {GetTimeoutExpression(rm.MatchTimeout.Value)});" : 112rm.Options != 0 ? $"new({Literal(rm.Pattern)}, {Literal(rm.Options)});" : 113$"new({Literal(rm.Pattern)});"); 141writer.WriteLine($" base.pattern = {Literal(rm.Pattern)};"); 172writer.Write(Literal(s)); 503: Literal(chars.ToString()); 592string setLiteral = Literal(new string(chars)); 1145$"/// <summary>Supports searching for the string {EscapeXmlComment(Literal(substring))}.</summary>", 1146$"internal static readonly SearchValues<string> {fieldName} = SearchValues.Create([{Literal(substring)}], StringComparison.{stringComparison});", 1150writer.WriteLine($"// The pattern has the literal {Literal(substring)} {offsetDescription}. Find the next occurrence."); 1192string prefixes = string.Join(", ", opts.LeadingPrefixes.Select(prefix => Literal(prefix))); 1222writer.WriteLine($"// The pattern begins with a literal {Literal(prefix)}. Find the next occurrence right-to-left."); 1224writer.WriteLine($"pos = inputSpan.Slice(0, pos).LastIndexOf({Literal(prefix)});"); 1469target.Literal.String is not null ? $"the {stringComparisonComment}string {Literal(target.Literal.String)}." : 1470target.Literal.Chars is not null ? $"one of the characters {Literal(new string(target.Literal.Chars))}" : 1490target.Literal.String is string literalString ? $"IndexOf({Literal(literalString)}{stringComparisonArgument});" : 3141writer.Write($"!{sourceSpan}.StartsWith({Literal(caseInsensitiveString)}, StringComparison.OrdinalIgnoreCase)"); 3142prevDescription = $"Match the string {Literal(caseInsensitiveString)} (ordinal case-insensitive)"; 3401using (EmitBlock(writer, $"if (inputSpan[--pos] != {Literal(str)}[{str.Length - 1} - i])")) 3411string clause = $"!{sourceSpan}.StartsWith({Literal(str)})"; 5049indexOfExpr = $"{last}IndexOf({Literal(node.Str!)})"; 5451$"((ch = {chExpr}) >= {Literal((char)analysis.UpperBoundExclusiveIfOnlyRanges)} || ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) == 0)" : 5452$"((ch = {chExpr}) < {Literal((char)analysis.UpperBoundExclusiveIfOnlyRanges)} && ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) != 0)"; 5460$"((ch = {chExpr}) < 128 && ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) == 0)" : 5461$"((ch = {chExpr}) >= 128 || ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) != 0)"; 5482_ => $"({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) {(negate ? "=" : "!")}= 0", 5484return $"((ch = {chExpr}) < 128 ? {asciiExpr} : {(negate ? "!" : "")}RegexRunner.CharInClass((char)ch, {Literal(charClass)}))"; 5489$"((ch = {chExpr}) < 128 || !RegexRunner.CharInClass((char)ch, {Literal(charClass)}))" : 5490$"((ch = {chExpr}) >= 128 && RegexRunner.CharInClass((char)ch, {Literal(charClass)}))"; 5496$"((ch = {chExpr}) >= 128 && !RegexRunner.CharInClass((char)ch, {Literal(charClass)}))" : 5497$"((ch = {chExpr}) < 128 || RegexRunner.CharInClass((char)ch, {Literal(charClass)}))"; 5586RegexNodeKind.Multi => $"Match the string {Literal(node.Str!)}{direction}.", 5615name = Literal(name);