toml: fix bin, oct and hex capital identifier check (#12254)

pull/12255/head
Larpon 2021-10-21 13:12:17 +02:00 committed by GitHub
parent 5607224be6
commit a84b1a53ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -101,6 +101,10 @@ fn (c Checker) check_number(num ast.Number) ? {
} else {
if !hex_bin_oct {
if !is_float && lit[0] == `0` {
if lit[1] in [`B`, `O`, `X`] {
return error(@MOD + '.' + @STRUCT + '.' + @FN +
' numbers like "$lit" only lowercase notation in ...${c.excerpt(num.pos)}...')
}
return error(@MOD + '.' + @STRUCT + '.' + @FN +
' numbers like "$lit" can not start with a zero in ...${c.excerpt(num.pos)}...')
}

View File

@ -21,7 +21,6 @@ const (
'string/basic-out-of-range-unicode-escape-2.toml',
'string/bad-uni-esc.toml',
// Integer
'integer/capital-bin.toml',
'integer/invalid-bin.toml',
'integer/invalid-oct.toml',
// Encoding