|
13 | 13 | with NML; if not, write to the Free Software Foundation, Inc., |
14 | 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.""" |
15 | 15 |
|
16 | | -import ply.yacc as yacc |
| 16 | +from .ply import yacc |
17 | 17 |
|
18 | 18 | from nml import expression, generic, nmlop, tokens, unit |
19 | 19 | from nml.actions import actionD, real_sprite |
@@ -59,24 +59,14 @@ class NMLParser: |
59 | 59 | @type parser: L{ply.yacc} |
60 | 60 | """ |
61 | 61 |
|
62 | | - def __init__(self, rebuild=False, debug=False): |
63 | | - if debug: |
64 | | - try: |
65 | | - import os |
66 | | - |
67 | | - os.remove(os.path.normpath(os.path.join(os.path.dirname(__file__), "generated", "parsetab.py"))) |
68 | | - except FileNotFoundError: |
69 | | - # Tried to remove a non existing file |
70 | | - pass |
| 62 | + def __init__(self, debug=False): |
71 | 63 | self.lexer = tokens.NMLLexer() |
72 | | - self.lexer.build(rebuild or debug) |
| 64 | + self.lexer.build() |
73 | 65 | self.tokens = self.lexer.tokens |
74 | 66 | self.parser = yacc.yacc( |
75 | 67 | module=self, |
76 | 68 | debug=debug, |
77 | | - optimize=not (rebuild or debug), |
78 | | - write_tables=not debug, |
79 | | - tabmodule="nml.generated.parsetab", |
| 69 | + optimize=not debug, |
80 | 70 | ) |
81 | 71 |
|
82 | 72 | def parse(self, text, input_filename): |
|
0 commit comments