toml: fix error return in value parsing (#12097)
parent
fbe54e49f5
commit
42359d8915
|
@ -650,13 +650,15 @@ pub fn (mut p Parser) value() ?ast.Value {
|
||||||
ast.Value(t)
|
ast.Value(t)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
error(@MOD + '.' + @STRUCT + '.' + @FN +
|
ast.Value(ast.Null{})
|
||||||
' value expected .boolean, .quoted, .lsbr, .lcbr or .number got "$p.tok.kind" "$p.tok.lit"')
|
|
||||||
ast.Value(ast.Null{}) // TODO workaround bug
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ const (
|
||||||
'string/basic-out-of-range-unicode-escape-1.toml',
|
'string/basic-out-of-range-unicode-escape-1.toml',
|
||||||
'string/basic-out-of-range-unicode-escape-2.toml',
|
'string/basic-out-of-range-unicode-escape-2.toml',
|
||||||
'string/bad-uni-esc.toml',
|
'string/bad-uni-esc.toml',
|
||||||
'string/missing-quotes.toml',
|
|
||||||
// Integer
|
// Integer
|
||||||
'integer/capital-bin.toml',
|
'integer/capital-bin.toml',
|
||||||
'integer/invalid-bin.toml',
|
'integer/invalid-bin.toml',
|
||||||
|
|
Loading…
Reference in New Issue