Open ratmice opened 8 years ago
You already have decimal integer constants embedded in strings with "\ddd"; are you asking for 2-byte hexadecimal constants too?
Yeah, It isn't terribly important as you mention I can (and currently do use "\ddd"), basically the same thing that dwrensha did here:
https://github.com/dwrensha/robotrevolutiondance/blob/master/sml-lib/files/elf/elf.sml The elf specification defines this by its hex constant: www.sco.com/developers/gabi/latest/ch4.eheader.html ELFMAG0 0x7f e_ident[EI_MAG0]
sometimes it would be nice to reflect the constant as defined, rather than doing the conversion, for the benefit of readers comparing the implementation and specification.
It would be nice if in addition to the decimal constant \ddd and \uxxxx you could just embed an integer constant directly into a string constant prepended by \e.g. #"\0x33" or something similar to the c syntax '\x33'
The Char.chr function works for this, but it cannot be used in pattern matches
[edit: I suppose just embedding the integer/word constants isn't terribly elegant due to \1x33 etc]