From b831129123dbb4bfba49824ae893448b05398f27 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Fri, 22 May 2020 02:48:09 +0100 Subject: Fix debug output in PEG parser generator (GH-20308) --- Tools/peg_generator/pegen/c_generator.py | 6 +++--- 1 file 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]};") -- cgit v0.12