Closed sssooonnnggg closed 2 weeks ago
Thanks! Are there other escape characters we need to be mindful of as well?
I'd appreciate you adding a unit test here. FlatSharp.Compiler.UnitTests is the correct project.
Thank you for your review. According to the source code of flatc's parser (idl_parser.cpp), we need to handle three cases: \", \', \\ \' does not need to be escaped in FlatSharp because "'" is a valid string in C# In addition to \\", we also need to handle \\ I will handle it and add unit tests later.
@jamescourtney Please review again, process backslash and double quote, some unit tests added😊
Thanks for your efforts here! I'm a little perplexed that flatc doesn't handle this for me, since it is the grammar parser after all. In any case, I'll take a look later today and hopefully approve.
FYI,the string readed from flatc parser is converted from an escaped string in fbs file to the original string. When we generate C# code with a string literal, we need to convert the original string back to an escaped string.
The fbs below cannot be compiled because of unescaped double quotes.
This PR fixes it.