Added getattr() support
This commit is contained in:
parent
3f7240b9a2
commit
a33ff221e5
5
CHANGES
5
CHANGES
@ -1,3 +1,8 @@
|
||||
Version 0.4
|
||||
-----------
|
||||
9/5/2018 Added support for getattr() and related functions on
|
||||
productions.
|
||||
|
||||
Version 0.3
|
||||
-----------
|
||||
4/1/2018 Support for Lexer inheritance added. For example:
|
||||
|
@ -144,7 +144,10 @@ class YaccProduction:
|
||||
raise AttributeError('No index attribute found')
|
||||
|
||||
def __getattr__(self, name):
|
||||
return self._slice[self._namemap[name]].value
|
||||
if name in self._namemap:
|
||||
return self._slice[self._namemap[name]].value
|
||||
else:
|
||||
raise AttributeError(f'No symbol {name}')
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
if name[0:1] == '_' or name not in self._namemap:
|
||||
|
Loading…
Reference in New Issue
Block a user