Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefinition error not being called #112

Closed
python36 opened this issue Sep 2, 2021 · 1 comment
Closed

Redefinition error not being called #112

python36 opened this issue Sep 2, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@python36
Copy link

python36 commented Sep 2, 2021

Environment

toml++ version and/or commit hash:
toml++ v2.5.0 037bfdd

Compiler:
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

C++ standard mode:
17

Target arch:
x86

Library configuration overrides:

Relevant compilation flags:

Describe the bug

If the table was created earlier, then the redefinition error is not called

Steps to reproduce (or a small repro code sample)

This is parsed without error:

[a.b.c.d]
  u = 6
[a]
  b.t = 8
[a.b]
  u = 0

Result:

[a.b]
t = 8
u = 0

    [a.b.c.d]
    u = 6

But this is with an error:

[a]
  b.t = 8
[a.b]
  u = 0

Result:

terminate called after throwing an instance of 'toml::v2::ex::parse_error'
  what():  Error while parsing table header: cannot redefine existing table 'a.b'

Additional information

For example with tomli (Python):

>>> tomli.loads("""
... [a.b.c.d]
... u = 6
... [a]
... b.t = 8
... [a.b]
... u = 0""")
Traceback (most recent call last):
...
tomli._parser.TOMLDecodeError: Can not declare ('a', 'b') twice (at line 6, column 5)
>>> tomli.loads("""[a]
... b.t = 8
... [a.b]
... u = 0""")
Traceback (most recent call last):
...
tomli._parser.TOMLDecodeError: Can not declare ('a', 'b') twice (at line 3, column 5)
@python36 python36 added the bug Something isn't working label Sep 2, 2021
@marzer
Copy link
Owner

marzer commented Sep 2, 2021

Ah, interesting. Thanks for the report.

@marzer marzer closed this as completed in f3896b7 Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants