3 ms·
In the C# multiquoted strings, how does it know this: Console.WriteLine(""""""); Console.WriteLine(""""""); Are 2 triplequoted empty strings and not one
by rererereferred 2y ago
In the C# multiquoted strings, how does it know this:
Console.WriteLine("""""");
Console.WriteLine("""""");
Are 2 triplequoted empty strings and not one "\nConsole.WriteLine(" sixtuplequoted string?
- ygra 2y agoThe former, I'd say. https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/strings/#raw-string-literals https://learn.microsoft.com/en-us/dotnet/csharp/programming-... For a multi-line string the quotes have to be on their own line.
- Joker_vD 2y agoIf the opening quotes are followed by anything that is not a whitespace before the next new-line (or EOF), then it's a single-line string. I imagine implementing those things took several iterations :)
- yen223 2y agoIt's a syntax error! Unterminated raw string literal. https://replit.com/@Wei-YenYen/DistantAdmirableCareware#main.cs https://replit.com/@Wei-YenYen/DistantAdmirableCareware#main...
- Joker_vD 2y agoAh, so there is no backtracking in lexer for this case. Makes sense.