rspivak / slimit

SlimIt - a JavaScript minifier/parser in Python
MIT License
551 stars 94 forks source link

Consider adding keyword argument `errorlog` to ply lexer #80

Open dmwyatt opened 9 years ago

dmwyatt commented 9 years ago

ply spews some Warnings to stderr even if you have debug=False.

if you instantiate ply.lex.lex and ply.yacc.yacc with errorlog=ply.lex.NullLogger() you can suppress these warnings.

Optionally make this configurable.

chonigman commented 9 years ago

Having trouble figuring out how exactly you instantiate these things. Would you mind sharing the code?

Can this be done without recompiling the package? Really like this parser but can't use if it's spitting out all these warnings.

chadawagner commented 9 years ago
def quiet(*args, **kwargs):
    pass
from ply import yacc, lex
yacc.PlyLogger.warning = quiet
lex.PlyLogger.warning = quiet