pnathan / pp-toml

Paul's Parser for Tom's Own Minimal Language
https://github.com/mojombo/toml
Other
19 stars 3 forks source link

Support full ints #22

Open pnathan opened 2 years ago

pnathan commented 2 years ago

It's probable? we don't support all of the int formats TOML 1.0 does.

Integer Integers are whole numbers. Positive numbers may be prefixed with a plus sign. Negative numbers are prefixed with a minus sign.

int1 = +99 int2 = 42 int3 = 0 int4 = -17 For large numbers, you may use underscores between digits to enhance readability. Each underscore must be surrounded by at least one digit on each side.

int5 = 1_000 int6 = 5_349_221 int7 = 53_49_221 # Indian number system grouping int8 = 1_2_3_4_5 # VALID but discouraged Leading zeros are not allowed. Integer values -0 and +0 are valid and identical to an unprefixed zero.

Non-negative integer values may also be expressed in hexadecimal, octal, or binary. In these formats, leading + is not allowed and leading zeros are allowed (after the prefix). Hex values are case-insensitive. Underscores are allowed between digits (but not between the prefix and the value).

hexadecimal with prefix 0x

hex1 = 0xDEADBEEF hex2 = 0xdeadbeef hex3 = 0xdead_beef

octal with prefix 0o

oct1 = 0o01234567 oct2 = 0o755 # useful for Unix file permissions

binary with prefix 0b

bin1 = 0b11010110 Arbitrary 64-bit signed integers (from −2^63 to 2^63−1) should be accepted and handled losslessly. If an integer cannot be represented losslessly, an error must be thrown.