Improved bibtex parsing

Old parsing used separate line-by-line regexp matching for fields. New
parser tries to keep track of when it's inside an entry, yielding more
robust results.