diff --git a/src/calmjs/parse/parsers/es5.py b/src/calmjs/parse/parsers/es5.py index f2db89c..042510c 100644 --- a/src/calmjs/parse/parsers/es5.py +++ b/src/calmjs/parse/parsers/es5.py @@ -42,8 +42,10 @@ asttypes = AstTypesFactory(pretty_print, ReprWalker()) -# The default values for the `Parser` constructor, passed on to ply; they must -# be strings +# These default values for the `Parser` constructor, passed on to ply; +# they must be strings; these values are for reference only as +# modifications to this value will not change what's been set up as +# the Parser's default. lextab, yacctab = generate_tab_names(__name__) diff --git a/src/calmjs/parse/parsers/optimize.py b/src/calmjs/parse/parsers/optimize.py index ec2f569..acc6e74 100644 --- a/src/calmjs/parse/parsers/optimize.py +++ b/src/calmjs/parse/parsers/optimize.py @@ -115,12 +115,15 @@ def optimize_build(module_name, assume_ply_version=True): if assume_ply_version: kws['_version'] = _assume_ply_version() - paths, missing = validate_imports(*generate_tab_names(module_name, **kws)) + lextab, yacctab = generate_tab_names(module_name, **kws) + paths, missing = validate_imports(lextab, yacctab) if missing: # only import, purge and regenerate if any are missing. unlink_modules(verify_paths(paths)) module = import_module(module_name) - module.Parser() + # use whatever assumed version or otherwise as set up by + # the local generation function. + module.Parser(lextab=lextab, yacctab=yacctab) def reoptimize_all(monkey_patch=False, first_build=False): diff --git a/src/calmjs/parse/tests/test_parsers_optimize.py b/src/calmjs/parse/tests/test_parsers_optimize.py index 4cad624..9532035 100644 --- a/src/calmjs/parse/tests/test_parsers_optimize.py +++ b/src/calmjs/parse/tests/test_parsers_optimize.py @@ -121,7 +121,7 @@ def test_reoptimize_monkey_patched(self): def test_optimize_build(self): called = [] - def sentinel(): + def sentinel(*a, **kw): called.append(True) fake_es5 = ModuleType('fake_namespace.fake_es5') @@ -227,7 +227,7 @@ def test_optimize_build_assume_broken_ply(self): optimize.ply_dist = None called = [] - def sentinel(): + def sentinel(*a, **kw): called.append(True) fake_es5 = ModuleType('fake_namespace.fake_es5')