Open tcr opened 7 years ago
There are only a few instances of these in the codebase (see C.lhs) but it should be parsed properly at least.
CIntConst (CInteger v repr flags) _ -> let allow_signed = not (testFlag FlagUnsigned flags) allow_unsigned = not allow_signed || repr /= DecRepr widths = [ (32 :: Int, if any (`testFlag` flags) [FlagLongLong, FlagLong] then WordWidth else BitWidth 32) , (64, BitWidth 64) ] allowed_types = [ IsInt s w | (bits, w) <- widths , (True, s) <- [(allow_signed, Signed), (allow_unsigned, Unsigned)] , v < 2 ^ (bits - if s == Signed then 1 else 0) ] repr' = case repr of DecRepr -> Rust.DecRepr OctalRepr -> Rust.OctalRepr HexRepr -> Rust.HexRepr in case allowed_types of [] -> badSource expr "integer (too big)" ty : _ -> return (literalNumber ty (Rust.LitInt v repr'))
There are only a few instances of these in the codebase (see C.lhs) but it should be parsed properly at least.