I am having problems implementing the hexadecimal float notation as a regex.
In the specification the notation for floating hexadecimal notation has been defined as follows:
hex_float_lit = "0" ( "x" | "X" ) hex_mantissa hex_exponent .
hex_mantissa = [ "_" ] hex_digits "." [ hex_digits ] |
[ "_" ] hex_digits |
"." hex_digits .
hex_exponent = ( "p" | "P" ) [ "+" | "-" ] decimal_digits .
In the last line the hex_exponent which must follow the hex_mantissa (see first line: hex_float_lit) defines the start of the hex_exponent being a [pP]{1}[+-]?[0-9]+(?:[_]?[0-9])* (please correct this regex of the last line if I am wrong). If the part after the mantissa must begin with a p or P from the following examples on the same link this for example 0x15e will not match, since after x and the mantissa-part comes no pP. But this 0x15e compiles successfully in Go. How is it possible after this syntax-declaration that 0x15e is correct? Where is this case covered in the notation above?
Any helps are appreciated, Thank you
A