[pypy-svn] r14311 - pypy/branch/dist-2.4.1/pypy/interpreter/pyparser
arigo at codespeak.net
arigo at codespeak.net
Tue Jul 5 20:53:31 CEST 2005
Author: arigo
Date: Tue Jul 5 20:53:31 2005
New Revision: 14311
Modified:
pypy/branch/dist-2.4.1/pypy/interpreter/pyparser/pythonlexer.py
pypy/branch/dist-2.4.1/pypy/interpreter/pyparser/syntaxtree.py
Log:
Intermediate check-in: streamlining exceptions
Modified: pypy/branch/dist-2.4.1/pypy/interpreter/pyparser/pythonlexer.py
==============================================================================
--- pypy/branch/dist-2.4.1/pypy/interpreter/pyparser/pythonlexer.py (original)
+++ pypy/branch/dist-2.4.1/pypy/interpreter/pyparser/pythonlexer.py Tue Jul 5 20:53:31 2005
@@ -71,8 +71,8 @@
tokenmod.COMMENT = tokenmod.N_TOKENS
tokenmod.NL = tokenmod.N_TOKENS + 1
-class TokenError(SyntaxError):
- """Raised when EOF is found prematuerly"""
+class TokenError(Exception):
+ """Raised for lexer errors, e.g. when EOF is found prematurely"""
def __init__(self, msg, line, strstart, token_stack):
self.lineno, self.offset = strstart
self.text = line
@@ -312,7 +312,7 @@
def next(self):
"""Returns the next parsed token"""
if self.stack_pos >= len(self.token_stack):
- raise StopIteration("Remove me")
+ raise StopIteration
tok, line, lnum, pos = self.token_stack[self.stack_pos]
self.stack_pos += 1
self._current_line = line
Modified: pypy/branch/dist-2.4.1/pypy/interpreter/pyparser/syntaxtree.py
==============================================================================
--- pypy/branch/dist-2.4.1/pypy/interpreter/pyparser/syntaxtree.py (original)
+++ pypy/branch/dist-2.4.1/pypy/interpreter/pyparser/syntaxtree.py Tue Jul 5 20:53:31 2005
@@ -113,7 +113,7 @@
# helper function for nodes that have only one subnode:
if len(self.nodes) == 1:
return self.nodes[0].visit(visitor)
- raise RuntimeError("Unknonw Visitor for %r" % self.name)
+ raise RuntimeError("Unknown Visitor for %r" % self.name)
def expand(self):
"""expand the syntax node to its content,
More information about the Pypy-commit
mailing list