What I ended up with was disabling optimization. I went through the source of PLY 3.4 and I found this little nugget in lexer code:
# If in optimize mode, we write the lextab if lextab and optimize: lexobj.writetab(lextab,outputdir) return lexobj
After changing the code that the lexer and parser creates, do the following:
self.lexer = lex.lex(module=self, optimize=False, debug=False, **kwargs)
and
self.lexer = lex.lex(module=self, optimize=False, debug=False, **kwargs)
I avoided all file lists. The debugger writes the .out files to the directory, and the Python files are the result of the optimize flag.
While this works, I cannot say that I am completely satisfied with this approach. Presumably, having some way to keep the optimization and, at the same time, keep the working directory clean will be an excellent solution, which will lead to better performance. If anyone has a better methodology, I am more than open to it.
source share