Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions biblib/bib.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ParseError(Exception):
class Parser:
"""A parser for .bib BibTeX database files."""

def __init__(self, *, month_style='full'):
def __init__(self, *, month_style='full', paranoid=False):
"""Initialize an empty database.

This also initializes standard month macros (which are usually
Expand All @@ -43,6 +43,7 @@ def __init__(self, *, month_style='full'):

self.__log, self.__errors = [], False
self.__entries = collections.OrderedDict()
self.__paranoid = paranoid

if month_style == 'full':
self.__macros = {'jan': 'January', 'feb': 'February',
Expand Down Expand Up @@ -119,7 +120,11 @@ def parse(self, str_or_fp_or_iter, name=None, *, log_fp=None):
# Just continue to the next entry if there's an error
with recoverer:
self._scan_command_or_entry()
recoverer.reraise()

if self.__paranoid:
recoverer.reraise()
else:
recoverer.dispose()
return self

def get_entries(self):
Expand Down