You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
' key `${dotted_key.str()}` is already declared. Unexpected redeclaration at "${p.tok.kind}" "${p.tok.lit}" in this (excerpt): "...${p.excerpt()}..."')
523
+
}
524
+
498
525
// NOTE these are *relatively* costly checks. In general - and by specification,
499
526
// TOML documents are expected to be "small" so this shouldn't be a problem. Famous last words.
// This check also covers *implicit* table allocations from "dotted" keys, so no need for e.g: `p.check_implicitly_declared(dotted_key)!`
664
+
ifis_all_tables(p.root_map, dotted_key) {
665
+
returnerror(@MOD +'.'+ @STRUCT +'.'+ @FN +
666
+
' key `${dotted_key.str()}` is already declared. Unexpected redeclaration at "${p.tok.kind}" "${p.tok.lit}" in this (excerpt): "...${p.excerpt()}..."')
667
+
}
636
668
p.explicit_declared << dotted_key
637
-
// ... also check implicitly declared keys
638
-
p.check_implicitly_declared(dotted_key)!
639
669
640
670
p.ignore_while(space_formatting)
641
-
642
671
util.printdbg(@MOD +'.'+ @STRUCT +'.'+ @FN, 'setting root map key to `${dotted_key}` at "${p.tok.kind}" "${p.tok.lit}"')
first:=DottedKey([dotted_key[0]]) // The array that holds the entries
941
-
last:=DottedKey([dotted_key[1]]) // The key the parsed array data should be added to
942
-
943
-
// Disallow re-declaring last part
944
-
p.check_explicitly_declared(last)!
967
+
ifis_all_tables(p.root_map, dotted_key) {
968
+
returnerror(@MOD +'.'+ @STRUCT +'.'+ @FN +
969
+
' key `${dotted_key.str()}` is already declared. Unexpected redeclaration at "${p.tok.kind}" "${p.tok.lit}" in this (excerpt): "...${p.excerpt()}..."')
// Give a nicer error if the `as` cast below can not be done
999
-
iftable[p.last_aot.str()]!is []ast.Value {
1034
+
ifarray_of_tables!is []ast.Value {
1000
1035
returnerror(@MOD +'.'+ @STRUCT +'.'+ @FN +
1001
1036
' nested array of tables "${p.last_aot}" expected an array but got "${table[p.last_aot.str()].type_name()}". Re-definition is not allowed. (excerpt): "...${p.excerpt()}..."')
1002
1037
}
1003
-
t_arr=&(table[p.last_aot.str()]as []ast.Value)
1038
+
t_arr=&(array_of_tablesas []ast.Value)
1004
1039
t_map= ast.Value(map[string]ast.Value{})
1005
1040
if p.last_aot_index < t_arr.len {
1006
1041
t_map= t_arr[p.last_aot_index]
1007
1042
}
1008
1043
1044
+
if t_map !ismap[string]ast.Value {
1045
+
returnerror(@MOD +'.'+ @STRUCT +'.'+ @FN +
1046
+
' expected a table but got "${t_map.type_name()}". (excerpt): "...${p.excerpt()}..."')
0 commit comments