dtlib: add _Token __repr__

Convert numeric IDs to symbolic token ID names for ease of debugging.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2021-08-30 19:00:35 -07:00 committed by Anas Nashif
parent ce6d402787
commit 4e783a363a

View File

@ -664,6 +664,10 @@ class _Token(NamedTuple):
id: int
val: _TokVal
def __repr__(self):
id_repr = _T(self.id).name
return f'Token(id=_T.{id_repr}, val={repr(self.val)})'
class DT:
"""
Represents a devicetree parsed from a .dts file (or from many files, if the