diff --git a/src/Fantomas.Tests/StringTests.fs b/src/Fantomas.Tests/StringTests.fs index b020c0b62a..53eb3ce05a 100644 --- a/src/Fantomas.Tests/StringTests.fs +++ b/src/Fantomas.Tests/StringTests.fs @@ -339,3 +339,8 @@ let s = \"\"\"aaaa bbb\"\"\" " + +[] +let ``unicode null character should be recognized as a trivia item, 2050`` () = + formatSourceString false "let s = \"\\000\"" config + |> should equal "let s = \"\\000\"\n" diff --git a/src/Fantomas/TokenParser.fs b/src/Fantomas/TokenParser.fs index 3d6a1c7c49..05ac947bfa 100644 --- a/src/Fantomas/TokenParser.fs +++ b/src/Fantomas/TokenParser.fs @@ -522,7 +522,7 @@ let private (|InterpStringEndOrPartToken|_|) token = None let escapedCharacterRegex = - System.Text.RegularExpressions.Regex("(\\\\(a|b|f|n|r|t|u|v|x|'|\\\"|\\\\))+") + System.Text.RegularExpressions.Regex("(\\\\(a|b|f|n|r|t|u|v|x|0|'|\\\"|\\\\))+") let private (|MultipleStringTextTokens|_|) tokens = let f _ =