summaryrefslogtreecommitdiff
path: root/src/python/m5/util/grammar.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/m5/util/grammar.py')
-rw-r--r--src/python/m5/util/grammar.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/python/m5/util/grammar.py b/src/python/m5/util/grammar.py
index 07702cfad..bb3429866 100644
--- a/src/python/m5/util/grammar.py
+++ b/src/python/m5/util/grammar.py
@@ -37,18 +37,17 @@ class ParseError(Exception):
class Grammar(object):
def setupLexerFactory(self, **kwargs):
if 'module' in kwargs:
- raise AttributeError, "module is an illegal attribute"
+ raise AttributeError("module is an illegal attribute")
self.lex_kwargs = kwargs
def setupParserFactory(self, **kwargs):
if 'module' in kwargs:
- raise AttributeError, "module is an illegal attribute"
+ raise AttributeError("module is an illegal attribute")
if 'output' in kwargs:
dir,tab = os.path.split(output)
if not tab.endswith('.py'):
- raise AttributeError, \
- 'The output file must end with .py'
+ raise AttributeError('The output file must end with .py')
kwargs['outputdir'] = dir
kwargs['tabmodule'] = tab[:-3]
@@ -90,13 +89,13 @@ class Grammar(object):
return -1
return self.current_lexer.lineno
- raise AttributeError, \
- "'%s' object has no attribute '%s'" % (type(self), attr)
+ raise AttributeError(
+ "'%s' object has no attribute '%s'" % (type(self), attr))
def parse_string(self, data, source='<string>', debug=None, tracking=0):
if not isinstance(data, basestring):
- raise AttributeError, \
- "argument must be a string, was '%s'" % type(f)
+ raise AttributeError(
+ "argument must be a string, was '%s'" % type(f))
import new
lexer = self.lex.clone()
@@ -120,8 +119,8 @@ class Grammar(object):
elif isinstance(f, file):
source = f.name
else:
- raise AttributeError, \
- "argument must be either a string or file, was '%s'" % type(f)
+ raise AttributeError(
+ "argument must be either a string or file, was '%s'" % type(f))
return self.parse_string(f.read(), source, **kwargs)