Generate an InstructionFormat enum.
This is a no-payload enum which will have the same variants as InstructionData. This makes it possible to talk about the format of an instruction without actually creating an InstructionData instance.
This commit is contained in:
@@ -49,9 +49,12 @@ class Formatter(object):
|
||||
assert self.indent != '', 'Already at top level indentation'
|
||||
self.indent = self.indent[0:-self.shiftwidth]
|
||||
|
||||
def line(self, s):
|
||||
def line(self, s=None):
|
||||
"""And an indented line."""
|
||||
self.lines.append('{}{}\n'.format(self.indent, s))
|
||||
if s:
|
||||
self.lines.append('{}{}\n'.format(self.indent, s))
|
||||
else:
|
||||
self.lines.append('\n')
|
||||
|
||||
def writelines(self, f=None):
|
||||
"""Write all lines to `f`."""
|
||||
|
||||
Reference in New Issue
Block a user