toml: check for exponents starting with an underscore (#12271)

pull/12274/head
Larpon 2021-10-22 18:56:43 +02:00 committed by GitHub
parent eed94c727c
commit eb364f0301
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -160,6 +160,10 @@ fn (c Checker) check_number(num ast.Number) ? {
}
if has_exponent_notation {
if lit.to_lower().all_after('e').starts_with('_') {
return error(@MOD + '.' + @STRUCT + '.' + @FN +
' the exponent in "$lit" can not start with an underscore in ...${c.excerpt(num.pos)}...')
}
if lit.to_lower().all_after('e').contains('.') {
return error(@MOD + '.' + @STRUCT + '.' + @FN +
' numbers like "$lit" (with exponent) can not have a decimal point in ...${c.excerpt(num.pos)}...')

View File

@ -22,8 +22,6 @@ const (
// Encoding
'encoding/bad-utf8-in-comment.toml',
'encoding/bad-utf8-in-string.toml',
// Float
'float/exp-leading-us.toml',
// Table
'table/rrbrace.toml',
'table/duplicate-table-array2.toml',