ron-rs/ron

plus sign on unsigned integers

Closed this issue · 2 comments

I don't see a reason why + should only be allowed on signed integers.

Currently this fails:

    assert_eq!(
        std::u64::MAX,
        from_str("+19").unwrap()
    );

Should probably be supported, but the spec isn't explicitly allowing it atm:

https://github.com/ron-rs/ron/blob/master/docs/grammar.md#numbers

juntyr commented

I have to admit I thought they were allowed until I looked at the spec. Since this would expand allowed RON, I don't see why we couldn't modify the spec and parser. The one footgun might be around schema-less parsing, since we would now deserialise "+19" as an unsigned integer and currently only store either a f64 or i64 inside Value. I've been meaning to extend that to all supported ints at some point anyways ...