Browse Source

Attempt to silence yacc

Reference #65
pull/66/head
Louis 10 years ago
parent
commit
5084a0b418
  1. 15
      patacrep/latex/syntax.py

15
patacrep/latex/syntax.py

@ -224,13 +224,20 @@ class Parser:
else:
symbols[0] = symbols[2].prepend(symbols[1])
def silent_yacc(*args, **kwargs):
"""Call yacc, suppressing (as far as possible) output and generated files.
"""
return yacc.yacc(
write_tables=0,
debug=0,
*args,
**kwargs
)
def tex2plain(string):
"""Parse string and return its plain text version."""
return detex(
yacc.yacc(
write_tables=0,
debug=0,
silent_yacc(
module=Parser(),
).parse(
string,
@ -241,7 +248,7 @@ def tex2plain(string):
def parsesong(string, filename=None):
"""Parse song and return its metadata."""
return detex(
yacc.yacc(module=Parser(filename)).parse(
silent_yacc(module=Parser(filename)).parse(
string,
lexer=SongLexer().lexer,
).metadata

Loading…
Cancel
Save