Copyright © 2001-2005 Oren Ben-Kiki, Clark Evans, Brian Ingerson
This specification is a draft reflecting consensus reached by members of the yaml-core mailing list. Any questions regarding this draft should be raised on this list.
Integers represent arbitrarily sized finite mathematical integers. Integers can be formatted using the familiar decimal notation, may have a leading “0x” to signal hexadecimal, a leading “0b” to indicate binary bits (base 2), or have leading “0” to signal an octal base. Using “:” allows expressing integers in base 60, which is convenient for time and angle values. Any “_” characters in the number are ignored, allowing a readable representation of large values.
Scalars of this type should be represented by a native integer data type, if possible. However, there are cases where an integer provided may overflow the native type’s storage capability. In this case, the processor should find some manner to round-trip the integer, perhaps using a string based representation. In general, integers representable using 32 binary digits should safely round-trip through most systems.
0|-?[1-9]&[0-9]* # (base 10)
Resolution and Validation:
Valid values must match the following regular expression, which may also be used for implicit tag resolution:
[-+]?0b[0-1_]+ # (base 2) |[-+]?0[0-7_]+ # (base 8) |[-+]?(0|[1-9][0-9_]*) # (base 10) |[-+]?0x[0-9a-fA-F_]+ # (base 16) |[-+]?[1-9][0-9_]*(:[0-5]?[0-9])+ # (base 60)