10000 bpo-35808: Retire pgen and use pgen2 to generate the parser by pablogsal · Pull Request #11814 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-35808: Retire pgen and use pgen2 to generate the parser #11814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

10000 Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename pgen2 -> pgen
  • Loading branch information
pablogsal committed Feb 21, 2019
commit 7e3beaf50a0f6c253045b87a7f7ecb471f161b0d
2 changes: 1 addition & 1 deletion Include/graminit.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -783,12 +783,11 @@ Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile
$(IO_OBJS): $(IO_H)

.PHONY: regen-grammar
regen-grammar:
regen-grammar: regen-token
# Regenerate Include/graminit.h and Python/graminit.c
# from Grammar/Grammar using pgen2
# from Grammar/Grammar using pgen
@$(MKDIR_P) Include
$(PYTHON_FOR_REGEN) -m Parser.pgen $(srcdir)/Grammar/Grammar \
$(srcdir)/Grammar/Tokens \
$(srcdir)/Include/graminit.h.new \
$(srcdir)/Python/graminit.c.new
$(UPDATE_FILE) $(srcdir)/Include/graminit.h $(srcdir)/Include/graminit.h.new
Expand Down
4 changes: 2 additions & 2 deletions Parser/pgen/grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
class Grammar(grammar.Grammar):

def produce_graminit_h(self, writer):
writer("/* Generated by Parser/pgen2 */\n\n")
writer("/* Generated by Parser/pgen */\n\n")
for number, symbol in self.number2symbol.items():
writer("#define {} {}\n".format(symbol, number))

def produce_graminit_c(self, writer):
writer("/* Generated by Parser/pgen2 */\n\n")
writer("/* Generated by Parser/pgen */\n\n")

writer('#include "pgenheaders.h"\n')
writer('#include "grammar.h"\n')
Expand Down
2 changes: 1 addition & 1 deletion Python/graminit.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Parser/pgen2 */
/* Generated by Parser/pgen */

#include "pgenheaders.h"
#include "grammar.h"
Expand Down
0