charlesvdv / nom-bibtex

A feature complete bibtex parser using nom
https://docs.rs/nom-bibtex
MIT License
22 stars 15 forks source link

Catch errors later in the file #7

Closed TheZoq2 closed 4 years ago

TheZoq2 commented 4 years ago

I noticed that I sometimes wasn't getting errors in my bibtex-file. Looks like this was caused by the use of the many1 macro which parses as many entries as possible, but doesn't care if the whole file isn't parsed.

This recursive solution may have a few issues. First, I'm not sure if rust optimises for tail call recursion, in which case this would run out of stack space eventually. It might be better to keep the old solution and check whether or not everything was parsed at the end.

Also, I accidentally made these changes on top of #6, so only this needs to be merged if both should be. If not, let me know and I'll separate these changes.

charlesvdv commented 4 years ago

No that's perfect! Both changes looks good to me! :+1: