This function is necessary due to the extreme "metaness" of
this project. It returns a string that is meant to be consumed
by mixin to generate code. Since the strings being fed to
the system at compile-time are generally going to be
"raw" strings, they'll either be r"" or ` style D strings.
If the regex requires the '"' character they'll use `, and
vice-versa. When generating code, I opted for r"" strings.
This would cause a compilation error if the regex has the
quote character in it. So this function returns an escaped
version that can be safely used.
This function is necessary due to the extreme "metaness" of this project. It returns a string that is meant to be consumed by mixin to generate code. Since the strings being fed to the system at compile-time are generally going to be "raw" strings, they'll either be r"" or ` style D strings. If the regex requires the '"' character they'll use `, and vice-versa. When generating code, I opted for r"" strings. This would cause a compilation error if the regex has the quote character in it. So this function returns an escaped version that can be safely used.