isa_parser.py (8538:b324639974f6) isa_parser.py (8588:ef28ed90449d)
1# Copyright (c) 2003-2005 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 1837 unchanged lines hidden (view full) ---

1846 # <cls_name> as a subclass of <base_cls> with the attributes
1847 # in tmp_dict, just as if we evaluated a class declaration.
1848 operand_name[op_name] = type(cls_name, (base_cls,), tmp_dict)
1849
1850 self.operandNameMap = operand_name
1851
1852 # Define operand variables.
1853 operands = user_dict.keys()
1# Copyright (c) 2003-2005 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 1837 unchanged lines hidden (view full) ---

1846 # <cls_name> as a subclass of <base_cls> with the attributes
1847 # in tmp_dict, just as if we evaluated a class declaration.
1848 operand_name[op_name] = type(cls_name, (base_cls,), tmp_dict)
1849
1850 self.operandNameMap = operand_name
1851
1852 # Define operand variables.
1853 operands = user_dict.keys()
1854 extensions = self.operandTypeMap.keys()
1854
1855
1855 operandsREString = (r'''
1856 (?<![\w\.]) # neg. lookbehind assertion: prevent partial matches
1857 ((%s)(?:\.(\w+))?) # match: operand with optional '.' then suffix
1858 (?![\w\.]) # neg. lookahead assertion: prevent partial matches
1859 '''
1860 % string.join(operands, '|'))
1856 operandsREString = r'''
1857 (?<!\w) # neg. lookbehind assertion: prevent partial matches
1858 ((%s)(?:_(%s))?) # match: operand with optional '_' then suffix
1859 (?!\w) # neg. lookahead assertion: prevent partial matches
1860 ''' % (string.join(operands, '|'), string.join(extensions, '|'))
1861
1862 self.operandsRE = re.compile(operandsREString, re.MULTILINE|re.VERBOSE)
1863
1864 # Same as operandsREString, but extension is mandatory, and only two
1865 # groups are returned (base and ext, not full name as above).
1866 # Used for subtituting '_' for '.' to make C++ identifiers.
1861
1862 self.operandsRE = re.compile(operandsREString, re.MULTILINE|re.VERBOSE)
1863
1864 # Same as operandsREString, but extension is mandatory, and only two
1865 # groups are returned (base and ext, not full name as above).
1866 # Used for subtituting '_' for '.' to make C++ identifiers.
1867 operandsWithExtREString = (r'(?<![\w\.])(%s)\.(\w+)(?![\w\.])'
1868 % string.join(operands, '|'))
1867 operandsWithExtREString = r'(?<!\w)(%s)_(%s)(?!\w)' \
1868 % (string.join(operands, '|'), string.join(extensions, '|'))
1869
1870 self.operandsWithExtRE = \
1871 re.compile(operandsWithExtREString, re.MULTILINE)
1872
1873 def substMungedOpNames(self, code):
1874 '''Munge operand names in code string to make legal C++
1875 variable names. This means getting rid of the type extension
1876 if any. Will match base_name attribute of Operand object.)'''

--- 132 unchanged lines hidden ---
1869
1870 self.operandsWithExtRE = \
1871 re.compile(operandsWithExtREString, re.MULTILINE)
1872
1873 def substMungedOpNames(self, code):
1874 '''Munge operand names in code string to make legal C++
1875 variable names. This means getting rid of the type extension
1876 if any. Will match base_name attribute of Operand object.)'''

--- 132 unchanged lines hidden ---