schovi / baked_file_system

Virtual File System for Crystal language. Embedding your assets into final binary.
MIT License
177 stars 18 forks source link

Fix interpolation in generated string literals #15

Closed straight-shoota closed 6 years ago

straight-shoota commented 6 years ago

This PR is a more complete fix to the string encoder than #14 and based on that work from @jreinert

It fixes the issue that string literals generated for macro code could contain macro expressions or string interpolation which would lead to unexpected behaviour or mostly just fail to compile. The string encoder now escapes all relevant characters and also adds a few simplifications for ASCII control characters. I also added some unit test for StringEncoder to ensure it works properly.

/cc @jreinert @schovi