summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2011-09-08 03:21:14 -0700
committerGabe Black <gblack@eecs.umich.edu>2011-09-08 03:21:14 -0700
commitf370ac5c186d063bd169c07ea89e1792617264cd (patch)
tree6259823f7dc3ebbc16cf5153321a8f019e044d5f
parentf4dc64655f5ff3e0c33be7a9129ee423809e7a19 (diff)
downloadgem5-f370ac5c186d063bd169c07ea89e1792617264cd.tar.xz
ISA parser: Don't look for operands in strings.
-rwxr-xr-xsrc/arch/isa_parser.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/arch/isa_parser.py b/src/arch/isa_parser.py
index e7598ffe8..863c7c70e 100755
--- a/src/arch/isa_parser.py
+++ b/src/arch/isa_parser.py
@@ -687,8 +687,9 @@ class OperandList(object):
def __init__(self, parser, code):
self.items = []
self.bases = {}
- # delete comments so we don't match on reg specifiers inside
- code = commentRE.sub('', code)
+ # delete strings and comments so we don't match on operands inside
+ for regEx in (stringRE, commentRE):
+ code = regEx.sub('', code)
# search for operands
next_pos = 0
while 1:
@@ -802,8 +803,9 @@ class SubOperandList(OperandList):
def __init__(self, parser, code, master_list):
self.items = []
self.bases = {}
- # delete comments so we don't match on reg specifiers inside
- code = commentRE.sub('', code)
+ # delete strings and comments so we don't match on operands inside
+ for regEx in (stringRE, commentRE):
+ code = regEx.sub('', code)
# search for operands
next_pos = 0
while 1:
@@ -854,6 +856,9 @@ class SubOperandList(OperandList):
error("Code block has more than one memory operand.")
self.memOperand = op_desc
+# Regular expression object to match C++ strings
+stringRE = re.compile(r'"([^"\\]|\\.)*"')
+
# Regular expression object to match C++ comments
# (used in findOperands())
commentRE = re.compile(r'(^)?[^\S\n]*/(?:\*(.*?)\*/[^\S\n]*|/[^\n]*)($)?',