mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
The lexer was not allowing underscores between leading zeros in decimal integer
literals and float literals (e.g. 0_0 or 0_0.0).
library/lexer.m:
Allow underscores in the above cases.
tests/hard_coded/parse_number_from_io.{m,exp,exp2,exp3}:
tests/hard_coded/parse_number_from_string.{m,exp,exp2,exp3}:
Extend these tests to cover the above cases.
tests/invalid/invalid_binary_literal.err_exp:
tests/invalid/invalid_octal_literal.err_exp:
tests/invalid/invalid_hex_literal.err_exp:
Conform to the above change.
61 lines
324 B
Plaintext
61 lines
324 B
Plaintext
Decimal:
|
|
0
|
|
0
|
|
0
|
|
0
|
|
10
|
|
-10
|
|
10
|
|
-10
|
|
1
|
|
1
|
|
-1
|
|
-1
|
|
|
|
Binary:
|
|
0
|
|
0
|
|
1
|
|
-1
|
|
68
|
|
-68
|
|
|
|
Octal:
|
|
511
|
|
-511
|
|
511
|
|
-511
|
|
511
|
|
-511
|
|
511
|
|
-511
|
|
|
|
Hexadecimal:
|
|
255
|
|
-255
|
|
255
|
|
-255
|
|
255
|
|
-255
|
|
4095
|
|
|
|
Float:
|
|
0.123
|
|
-0.123
|
|
0.123
|
|
-0.123
|
|
1.123
|
|
-1.123
|
|
12.123
|
|
-12.123
|
|
12.123
|
|
-12.123
|
|
12300000000000.0
|
|
12300000000000.0
|
|
1200000000000.0
|
|
1200000000000.0
|
|
1.2e-10
|
|
1.2e-10
|
|
0.0
|
|
1.01
|