Repository navigation
modules/niri: escape strings (mostly) in accordance to kdl spec - #193
Conversation
excluding ill defined escape sequences like backspace
|
eh the kdl spec isn't quite clear about if it needs to be escaped, though ig its probably best to just not escape it in considering the usecase |
|
i suppose it would make sense to escape |
|
feel free to implement a full unicode parser in nix for the unicode escapes as that will definetly take a more time than i have 🙃 |
|
i would assume that the parser would just accept unicode characters and the my suggestion would be (partially uses raw nix strings with two single quotes) ''"'' => ''\"''
''/'' => ''\/''
''\'' => ''\\''
# nix does not have backspace literals (ig they could be read from a file but like. then it's okay for there to be an error
# nix does not have form feed literals either
<LF> => "\n"
<CR> => ''\r'' # also will probably not occur buy why not
<TAB> => "\t"
# disregard unicode for now and just leave it like it isan implementation would be escape = builtins.replaceStrings
[''"'' "/" ''\'' "\n" "\r" "\t" ]
[''\"'' ''\/'' ''\\'' ''\n'' ''\r'' ''\t''] |

excluding ill defined escape sequences like backspace
Fixes #192