toml: fix error return in value parsing (#12097)

pull/12102/head
Larpon 2021-10-07 14:51:18 +02:00 committed by GitHub
parent fbe54e49f5
commit 42359d8915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -650,13 +650,15 @@ pub fn (mut p Parser) value() ?ast.Value {
ast.Value(t)
}
else {
error(@MOD + '.' + @STRUCT + '.' + @FN +
' value expected .boolean, .quoted, .lsbr, .lcbr or .number got "$p.tok.kind" "$p.tok.lit"')
ast.Value(ast.Null{}) // TODO workaround bug
ast.Value(ast.Null{})
}
}
if value is ast.Null {
return error(@MOD + '.' + @STRUCT + '.' + @FN +
' value expected .boolean, .quoted, .lsbr, .lcbr or .number got "$p.tok.kind" "$p.tok.lit"')
}
}
util.printdbg(@MOD + '.' + @STRUCT + '.' + @FN, 'parsed value $value.to_json()')
util.printdbg(@MOD + '.' + @STRUCT + '.' + @FN, 'parsed "$p.tok.kind" as value $value.to_json()')
return value
}

View File

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