diff options
author | Steve Reinhardt <stever@eecs.umich.edu> | 2005-10-20 14:14:59 -0400 |
---|---|---|
committer | Steve Reinhardt <stever@eecs.umich.edu> | 2005-10-20 14:14:59 -0400 |
commit | 9a881c5a8266fd36f5b3e8f5295d0416101244ed (patch) | |
tree | 7b4421eb79f0430778023199d7ac05f019af2b1f | |
parent | 9c68bde1667f9eaf9eb8ec62adc305e4573bfd3b (diff) | |
download | gem5-9a881c5a8266fd36f5b3e8f5295d0416101244ed.tar.xz |
Minor tweak to isa_parser.
arch/isa_parser.py:
Derive Stack class directly from list.
--HG--
extra : convert_revision : 4f09db4baec0bb2144d71ffad5ce53651e8c3ac6
-rwxr-xr-x | arch/isa_parser.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/arch/isa_parser.py b/arch/isa_parser.py index eaef4b798..8f4c6bce7 100755 --- a/arch/isa_parser.py +++ b/arch/isa_parser.py @@ -794,20 +794,19 @@ def defFormat(id, params, code, lineno): ############## # Stack: a simple stack object. Used for both formats (formatStack) -# and default cases (defaultStack). +# and default cases (defaultStack). Simply wraps a list to give more +# stack-like syntax and enable initialization with an argument list +# (as opposed to an argument that's a list). -class Stack: - def __init__(self, initItem): - self.stack = [ initItem ] +class Stack(list): + def __init__(self, *items): + list.__init__(self, items) def push(self, item): - self.stack.append(item); - - def pop(self): - return self.stack.pop() + self.append(item); def top(self): - return self.stack[-1] + return self[-1] # The global format stack. formatStack = Stack(NoFormat()) |