grmtools icon indicating copy to clipboard operation
grmtools copied to clipboard

Remove debug formatting in non-debug locations

Open ltratt opened this issue 3 years ago • 2 comments

In a couple of places (e.g. https://github.com/softdevteam/grmtools/blob/master/lrlex/src/lib/ctbuilder.rs#L419) we use debug formatting in a non-debug location. This feels somewhat unsatisfactory, particularly as there are fewer guarantees about stability.

ltratt avatar Jul 21 '22 08:07 ltratt

I had a look through these, and it appears to me that these just want to be turned into \"{}\". I.e. they are all names, etc that we wouldn't expect to contain any escape sequences. So I don't think we need to go as far as something like \"{}\", x.escape_default(), to try mirroring that debug also escapes.

Edit: The above may not be right, I think actually '\' and '"' may be valid lex names that need escaping here.

ratmice avatar Oct 09 '22 15:10 ratmice

I think actually '' and '"' may be valid lex names that need escaping here.

Good point! Yes, this needs checking.

ltratt avatar Oct 09 '22 17:10 ltratt