diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2020-05-22 01:48:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-22 01:48:09 (GMT) |
commit | b831129123dbb4bfba49824ae893448b05398f27 (patch) | |
tree | 1e4eaaa89b17e104b3070d353baa0d585986344f | |
parent | ae145833025b0156ee2a28219e3370f3b27b2a36 (diff) | |
download | cpython-b831129123dbb4bfba49824ae893448b05398f27.zip cpython-b831129123dbb4bfba49824ae893448b05398f27.tar.gz cpython-b831129123dbb4bfba49824ae893448b05398f27.tar.bz2 |
Fix debug output in PEG parser generator (GH-20308)
-rw-r--r-- | Tools/peg_generator/pegen/c_generator.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py index 586f28c..362698b 100644 --- a/Tools/peg_generator/pegen/c_generator.py +++ b/Tools/peg_generator/pegen/c_generator.py @@ -487,7 +487,7 @@ class CParserGenerator(ParserGenerator, GrammarVisitor): rhs, is_loop=False, is_gather=node.is_gather(), rulename=node.name, ) if self.debug: - self.print('fprintf(stderr, "Fail at %d: {node.name}\\n", p->mark);') + self.print(f'fprintf(stderr, "Fail at %d: {node.name}\\n", p->mark);') self.print("_res = NULL;") self.print(" done:") with self.indent(): @@ -613,7 +613,7 @@ class CParserGenerator(ParserGenerator, GrammarVisitor): else: if self.debug: self.print( - f'fprintf(stderr, "Hit without action [%d:%d]: %s\\n", mark, p->mark, "{node}");' + f'fprintf(stderr, "Hit without action [%d:%d]: %s\\n", _mark, p->mark, "{node}");' ) self.print( f"_res = _PyPegen_dummy_name(p, {', '.join(self.local_variable_names)});" @@ -621,7 +621,7 @@ class CParserGenerator(ParserGenerator, GrammarVisitor): else: if self.debug: self.print( - f'fprintf(stderr, "Hit with default action [%d:%d]: %s\\n", mark, p->mark, "{node}");' + f'fprintf(stderr, "Hit with default action [%d:%d]: %s\\n", _mark, p->mark, "{node}");' ) self.print(f"_res = {self.local_variable_names[0]};") |