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.

Table 2 Number formats

Type

Prefix

Example(s)

Decimal

none

4711

Hexadecimal

0x

0x8A5, 0xfe.43.a5

Octal

0o

0o721

Binary

0b

0b0001.1010

Roman

0r

0rXMVIIII, 0rvii

Napier

0n

0nnaabdea, 0nABHJ

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.