Related duplicate rule reporting in lexer

This commit is contained in:
David Beazley 2016-10-09 12:33:27 -05:00
parent a6eab9d9e0
commit d614aa0e04

View File

@ -74,10 +74,11 @@ class LexerMetaDict(OrderedDict):
''' '''
def __setitem__(self, key, value): def __setitem__(self, key, value):
if key in self and not isinstance(value, property): if key in self and not isinstance(value, property):
if isinstance(self[key], str) and callable(value): if isinstance(self[key], str):
value.pattern = self[key] if callable(value):
else: value.pattern = self[key]
raise AttributeError('Name %s redefined' % (key)) else:
raise AttributeError('Name %s redefined' % (key))
super().__setitem__(key, value) super().__setitem__(key, value)