[pypy-svn] r66399 - in pypy/branch/parser-compiler/pypy: config doc/config interpreter module/dyngram
benjamin at codespeak.net
benjamin at codespeak.net
Sat Jul 18 23:10:58 CEST 2009
Author: benjamin
Date: Sat Jul 18 23:10:58 2009
New Revision: 66399
Removed:
pypy/branch/parser-compiler/pypy/doc/config/objspace.usemodules.dyngram.txt
pypy/branch/parser-compiler/pypy/module/dyngram/
Modified:
pypy/branch/parser-compiler/pypy/config/pypyoption.py
pypy/branch/parser-compiler/pypy/interpreter/pycompiler.py
Log:
remove dynamic grammar code
Modified: pypy/branch/parser-compiler/pypy/config/pypyoption.py
==============================================================================
--- pypy/branch/parser-compiler/pypy/config/pypyoption.py (original)
+++ pypy/branch/parser-compiler/pypy/config/pypyoption.py Sat Jul 18 23:10:58 2009
@@ -26,7 +26,7 @@
working_modules.update(dict.fromkeys(
["_socket", "unicodedata", "mmap", "fcntl",
"rctime" , "select", "zipimport", "_lsprof",
- "crypt", "signal", "dyngram", "_rawffi", "termios", "zlib",
+ "crypt", "signal", "_rawffi", "termios", "zlib",
"struct", "md5", "sha", "bz2", "_minimal_curses", "cStringIO",
"thread", "itertools", "pyexpat", "_ssl"]
))
Modified: pypy/branch/parser-compiler/pypy/interpreter/pycompiler.py
==============================================================================
--- pypy/branch/parser-compiler/pypy/interpreter/pycompiler.py (original)
+++ pypy/branch/parser-compiler/pypy/interpreter/pycompiler.py Sat Jul 18 23:10:58 2009
@@ -252,45 +252,3 @@
assert isinstance(code, PyCode)
space.timer.stop("PythonAST compile")
return code
-
- # interface for pypy.module.recparser
- def get_parser(self):
- return self.parser
-
- def source2ast(self, source, mode='exec'):
- from pypy.interpreter.pyparser.astbuilder import AstBuilder
- builder = AstBuilder(self.parser, self.grammar_version,
- space=self.space)
- self.parser.parse_source(source, mode, builder)
- return builder.rule_stack[-1]
-
-
-def install_compiler_hook(space, w_callable):
-# if not space.get( w_callable ):
-# raise OperationError( space.w_TypeError( space.wrap( "must have a callable" ) )
- space.default_compiler.w_compile_hook = w_callable
-
-def insert_grammar_rule(space, w_rule, w_buildfuncs):
- """inserts new grammar rules to the default compiler"""
- from pypy.interpreter import function
- rule = space.str_w(w_rule)
- #buildfuncs_w = w_buildfuncs.content
- buildfuncs = {}
- #for w_name, w_func in buildfuncs_w.iteritems():
- # buildfuncs[space.str_w(w_name)] = space.unwrap(w_func)
- w_iter = space.iter(w_buildfuncs)
- while 1:
- try:
- w_key = space.next(w_iter)
- w_func = space.getitem(w_buildfuncs, w_key)
- buildfuncs[space.str_w(w_key)] = space.interp_w(function.Function, w_func)
- except OperationError, e:
- if not e.match(space, space.w_StopIteration):
- raise
- break
- space.default_compiler.additional_rules = buildfuncs
- space.default_compiler.parser.insert_rule(rule)
-
-# XXX cyclic import
-#from pypy.interpreter.baseobjspace import ObjSpace
-#insert_grammar_rule.unwrap_spec = [ObjSpace, str, dict]
More information about the Pypy-commit
mailing list