File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -818,19 +818,24 @@ pub fn (mut p Parser) inline_table(mut tbl map[string]ast.Value) ! {
818818 p.check_immutable (left_most)!
819819 }
820820 }
821+ key_str := key.str ()
822+ util.printdbg (@MOD + '.' + @STRUCT + '.' + @FN, 'inserting @6 "${key_str} " = ${val} into ${ptr_str(t)} ' )
821823 unsafe {
822- util.printdbg (@MOD + '.' + @STRUCT + '.' + @FN, 'inserting @6 "${key} " = ${val} into ${ptr_str(t)} ' )
823- t[key.str ()] = val
824+ if _ := t[key_str] {
825+ return error (@MOD + '.' + @STRUCT + '.' + @FN +
826+ ' key "${key_str} " is already initialized with a value. At "${p.tok.kind} " "${p.tok.lit} " in this (excerpt): "...${p.excerpt()} ..."' )
827+ }
828+ t[key_str] = val
824829 }
825830 } else {
826831 p.ignore_while (space_formatting)
827832 key , val := p.key_value ()!
828833 key_str := key.str ()
834+ util.printdbg (@MOD + '.' + @STRUCT + '.' + @FN, 'inserting @5 "${key_str} " = ${val} into ${ptr_str(tbl)} ' )
829835 if _ := tbl[key_str] {
830836 return error (@MOD + '.' + @STRUCT + '.' + @FN +
831837 ' key "${key_str} " is already initialized with a value. At "${p.tok.kind} " "${p.tok.lit} " in this (excerpt): "...${p.excerpt()} ..."' )
832838 }
833- util.printdbg (@MOD + '.' + @STRUCT + '.' + @FN, 'inserting @5 "${key_str} " = ${val} into ${ptr_str(tbl)} ' )
834839 tbl[key_str] = val
835840 }
836841 previous_token_was_value = true
Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ const valid_exceptions = [
2424// NOTE: entries in this list are tests of invalid TOML that should have the parser fail, but currently does not.
2525const invalid_exceptions = [
2626 'do_not_remove' ,
27- 'inline-table/duplicate-key-02.toml' ,
2827 'string/multiline-escape-space-02.toml' ,
2928 'string/missing-quotes-array.toml' ,
3029 'table/append-with-dotted-keys-05.toml' ,
You can’t perform that action at this time.
0 commit comments