diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-05-22 02:05:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-22 02:05:20 (GMT) |
commit | 427c696400414d4b286c10c6708bfef4787c5fff (patch) | |
tree | 3ce1ab7ffb816ad06f8fe80ee80d847811cb5363 | |
parent | 55c89235247d9dbe8a4463c9c64edc7e48826a44 (diff) | |
download | cpython-427c696400414d4b286c10c6708bfef4787c5fff.zip cpython-427c696400414d4b286c10c6708bfef4787c5fff.tar.gz cpython-427c696400414d4b286c10c6708bfef4787c5fff.tar.bz2 |
Fix debug output in PEG parser generator (GH-20308)
(cherry picked from commit b831129123dbb4bfba49824ae893448b05398f27)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
-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]};") |