-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Codechange: Vendor in latest ply version #342
base: master
Are you sure you want to change the base?
Conversation
import sys | ||
import types | ||
import copy | ||
import os |
Check notice
Code scanning / CodeQL
Unused import Note
return | ||
|
||
if not tokens: | ||
self.log.error('tokens is empty') |
Check warning
Code scanning / CodeQL
Unreachable code Warning
module = inspect.getmodule(f) | ||
self.modules.add(module) | ||
|
||
tokname = self.toknames[fname] |
Check warning
Code scanning / CodeQL
Variable defined multiple times Warning
redefined
global lexer | ||
|
||
ldict = None | ||
stateinfo = {'INITIAL': 'inclusive'} |
Check warning
Code scanning / CodeQL
Variable defined multiple times Warning
redefined
# Create global versions of the token() and input() functions | ||
token = lexobj.token | ||
input = lexobj.input | ||
lexer = lexobj |
Check notice
Code scanning / CodeQL
Unused global variable Note
for f in self.pfuncs: | ||
if f[3]: | ||
parts.append(f[3]) | ||
except (TypeError, ValueError): |
Check notice
Code scanning / CodeQL
Empty except Note
return | ||
|
||
if not tokens: | ||
self.log.error('tokens is empty') |
Check warning
Code scanning / CodeQL
Unreachable code Warning
if doc[1] == ':': | ||
self.log.warning('%s:%d: Possible grammar rule %r defined without p_ prefix', | ||
v.__code__.co_filename, v.__code__.co_firstlineno, n) | ||
except IndexError: |
Check notice
Code scanning / CodeQL
Empty except Note
if debuglog is None: | ||
if debug: | ||
try: | ||
debuglog = PlyLogger(open(debugfile, 'w')) |
Check warning
Code scanning / CodeQL
File is not always closed Warning
lr.bind_callables(pinfo.pdict) | ||
parser = LRParser(lr, pinfo.error_func) | ||
|
||
parse = parser.parse |
Check notice
Code scanning / CodeQL
Unused global variable Note
Given it removes commandline options, this feels like more than just a "Codechange" |
According to https://github.com/dabeaz/ply/blob/master/CHANGES, the latest version will never be available via
pip
, and the preferred way to useply
is to vendor it.Latest ply version removes caching of lexer/parser tables, and as a side effect fixes #332.