PoignardAzur / venial

"A very small syn"
MIT License
192 stars 9 forks source link

Reject trailing tokens after declaration #42

Closed jcaesar closed 1 year ago

jcaesar commented 1 year ago

Current venial parses struct Good {} bad and silently ignores bad or any other trailing junk tokens. I'm not sure what the best way to deal with that is, but I think that should be an error.

(Origin issue: https://github.com/jcaesar/structstruck/issues/4)

PoignardAzur commented 1 year ago

At a glance, I think my preferred solution would be to have two separate consume_declaration and parse_declaration functions. Will handle it when I have the time.

jcaesar commented 1 year ago

@PoignardAzur How about just making parse_declaration_tokens public? (I'd argue that if you hand ownership of a list of tokens, you'd want them to be fully consumed.)

PoignardAzur commented 1 year ago

Right, I wasn't up-to-date on that part of the code.

PoignardAzur commented 1 year ago

I created #44 based on your PR. I think it addresses all your concerns?

jcaesar commented 1 year ago

Tested it, does.