Number Format¶
Numbers are specified in a way similar to what is common practice in many programming languages such as C, Python, Java, etc. The number formats are presented in table Number formats.
Type |
Prefix |
Example(s) |
|---|---|---|
Decimal |
none |
|
Hexadecimal |
0x |
|
Octal |
0o |
|
Binary |
0b |
|
Roman |
0r |
|
Napier |
0n |
|
Decimal integers do not start with zero and have no prefixes.
Hexadecimal numbers are preceded by 0x. Octal numbers are preceded by
0o. Binary numbers are preceded by 0b. The dots inside the hexadecimal
numbers and binary numbers are ignored, but may facilitate reading. Roman
numbers must be preceded by a 0r prefix. Napier numbers, as used in location
arithmetic [], must be preceded by a 0n prefix.
This number format is used in token identifier definitions
(section sec-token-id-definitions), line and column number increment
definitions (section sec-line-column-counting), encoding files
(section sec-engine-encoding-tables), and for integer macro arguments
(section sec-section-define).
Inside regular expressions a the number format follows the POSIX conventions.
Only decimal numbers can be used as repetition numbers. That is, a{11,12}
matches eleven or twelve a s. For character definitions, the
escape-backslash \ is the prefix for octal numbers, \x, \X, and
\U are the possible prefixes for hexadecimal numbers. The exact syntax of
number specifications is explained in section
sec-context-free-regular-expressions.