From 780ac037168025ec18a7c7d7db8b0815d25c8760 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 25 Oct 2019 08:49:26 +0300 Subject: Add information about parsing error into libconf.py --- tools/utils/libconf.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tools/utils') diff --git a/tools/utils/libconf.py b/tools/utils/libconf.py index 635efd07d..7f9d6de90 100644 --- a/tools/utils/libconf.py +++ b/tools/utils/libconf.py @@ -226,8 +226,15 @@ class Tokenizer: for cls, type, regex in self.token_map: m = regex.match(string, pos=pos) if m: - yield cls(type, m.group(0), - self.filename, self.row, self.column) + try: + yield cls(type, m.group(0), + self.filename, self.row, self.column) + except ValueError as e: + print("Error parsing file " + "{0}, in line:\n{1}\n{2}".format(self.filename, + m.group(0), + self.row)) + raise self.column += len(m.group(0)) pos = m.end() break -- cgit v1.2.3-70-g09d2