Open cbarrett opened 13 years ago
This sort of thing would be useful, but the parsing code is already pretty hairy. Can we get it concise?
I would go about it by defining data Base = Decimal | Octal | Hex
and adding a Base
subexpression to the CInteger
type.
Given:
Pony outputs:
Seems suboptimal especially when specifying constants in hex (or octal?) for readability purposes.
One possible approach -- implement Num etc on a type that stores the base information inside it and then format it accordingly during pretty printing. I don't think losing 0X10 to 0x10 is that big a deal at that point.