Skip to content

Commit d946be4

Browse files
committed
update of ply.yacc for faster compilation. Thanks to Sam Skalicky for your suggestion!
1 parent e727f35 commit d946be4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pyverilog/vparser/ply/yacc.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,16 +1818,19 @@ def __init__(self):
18181818
self.lr_productions = None
18191819
self.lr_method = None
18201820

1821-
def read_table(self,module):
1821+
def read_table(self,module,outputdir)
18221822
if isinstance(module,types.ModuleType):
18231823
parsetab = module
18241824
else:
1825+
old_path = sys.path
1826+
sys.path = [outputdir]
18251827
if sys.version_info[0] < 3:
18261828
exec("import %s as parsetab" % module)
18271829
else:
18281830
env = { }
18291831
exec("import %s as parsetab" % module, env, env)
18301832
parsetab = env['parsetab']
1833+
sys.path = old_path
18311834

18321835
if parsetab._tabversion != __tabversion__:
18331836
raise VersionError("yacc table file version is out of date")
@@ -3070,7 +3073,7 @@ def yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, star
30703073
if picklefile:
30713074
read_signature = lr.read_pickle(picklefile)
30723075
else:
3073-
read_signature = lr.read_table(tabmodule)
3076+
read_signature = lr.read_table(tabmodule,outputdir)
30743077
if optimize or (read_signature == signature):
30753078
try:
30763079
lr.bind_callables(pinfo.pdict)

0 commit comments

Comments
 (0)