[pypy-svn] r45448 - pypy/dist/pypy/lang/scheme
jlg at codespeak.net
jlg at codespeak.net
Wed Aug 1 16:47:41 CEST 2007
Author: jlg
Date: Wed Aug 1 16:47:40 2007
New Revision: 45448
Modified:
pypy/dist/pypy/lang/scheme/object.py
Log:
scheme translation repaired
Modified: pypy/dist/pypy/lang/scheme/object.py
==============================================================================
--- pypy/dist/pypy/lang/scheme/object.py (original)
+++ pypy/dist/pypy/lang/scheme/object.py Wed Aug 1 16:47:40 2007
@@ -861,11 +861,15 @@
#closes template in syntactic enviroment at the point of definition
return W_Transformer(syntax_lst, ctx)
-class Ellipsis(Exception):
+class Ellipsis(W_Root):
def __init__(self, expr, level):
self.expr = expr
self.level = level
+class EllipsisException(SchemeException):
+ def __init__(self, ellipsis):
+ self.expr = ellipsis.expr
+
class SyntaxRule(object):
def __init__(self, pattern, template, literals):
self.pattern = pattern
@@ -1008,7 +1012,7 @@
return PairClosure(ctx, w_sub)
if isinstance(w_sub, Ellipsis):
- raise w_sub
+ raise EllipsisException(w_sub)
return w_sub
@@ -1018,7 +1022,7 @@
try:
w_pair = W_Pair(self.substitute(ctx, sexpr.car, match_dict),
self.substitute(ctx, sexpr.cdr, match_dict))
- except Ellipsis, e:
+ except EllipsisException, e:
scdr = sexpr.cdr
if isinstance(scdr, W_Pair) and scdr.car is w_ellipsis:
return e.expr
@@ -1027,6 +1031,8 @@
w_paircar = w_pair.car
if isinstance(w_paircar, W_Symbol):
+ #XXX what if we have here SymbolClosure?
+ # can happen when recursive macro
try:
w_macro = ctx.get(w_paircar.name)
@@ -1036,18 +1042,6 @@
except UnboundVariable:
pass
- elif isinstance(w_paircar, SymbolClosure):
- try:
- #ops, which context?
- w_macro = ctx.get(w_paircar.sexpr.to_string())
-
- # recursive macro expansion
- if isinstance(w_macro, W_DerivedMacro):
- return w_macro.expand(ctx, w_pair)
-
- except UnboundVariable:
- pass
-
return w_pair
return sexpr
More information about the Pypy-commit
mailing list