Add string conversions for predicates and encodings.

This is just used for printing better comments in generated code.
This commit is contained in:
Jakob Stoklund Olesen
2016-08-26 08:50:47 -07:00
parent 4f14d1ea32
commit 0b1aa7c6cd
3 changed files with 20 additions and 0 deletions

View File

@@ -1003,6 +1003,9 @@ class EncRecipe(object):
if instp:
assert instp.predicate_context() == format
def __str__(self):
return self.name
class Encoding(object):
"""
@@ -1034,6 +1037,9 @@ class Encoding(object):
self.instp = And.combine(recipe.instp, instp)
self.isap = And.combine(recipe.isap, instp)
def __str__(self):
return '[{}/{:02x}]'.format(self.recipe, self.encbits)
def ctrl_typevar(self):
"""
Get the controlling type variable for this encoding or `None`.