changeset b324639974f6 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=b324639974f6
description:
        ISA parser: Don't look for operands in strings.

diffstat:

 src/arch/isa_parser.py |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 00df5058a557 -r b324639974f6 src/arch/isa_parser.py
--- a/src/arch/isa_parser.py    Thu Sep 08 03:20:05 2011 -0700
+++ b/src/arch/isa_parser.py    Thu Sep 08 03:21:14 2011 -0700
@@ -687,8 +687,9 @@
     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 @@
     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 @@
                     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]*)($)?',
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to