summaryrefslogtreecommitdiffstats
path: root/Makefile.pre.in
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2019-03-25 22:01:12 (GMT)
committerGitHub <noreply@github.com>2019-03-25 22:01:12 (GMT)
commit91759d98015e1d6d5e1367cff60592ab548e7806 (patch)
tree903553ec0677b1fc9c3531799ce890fd7a019069 /Makefile.pre.in
parent027b09c5a13aac9e14a3b43bb385298d549c3833 (diff)
downloadcpython-91759d98015e1d6d5e1367cff60592ab548e7806.zip
cpython-91759d98015e1d6d5e1367cff60592ab548e7806.tar.gz
cpython-91759d98015e1d6d5e1367cff60592ab548e7806.tar.bz2
bpo-36143: Regenerate Lib/keyword.py from the Grammar and Tokens file using pgen (GH-12456)
Now that the parser generator is written in Python (Parser/pgen) we can make use of it to regenerate the Lib/keyword file that contains the language keywords instead of parsing the autogenerated grammar files. This also allows checking in the CI that the autogenerated files are up to date.
Diffstat (limited to 'Makefile.pre.in')
-rw-r--r--Makefile.pre.in11
1 files changed, 10 insertions, 1 deletions
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 8042e8e..174b12c 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -724,7 +724,7 @@ regen-importlib: Programs/_freeze_importlib
# Regenerate all generated files
regen-all: regen-opcode regen-opcode-targets regen-typeslots regen-grammar \
- regen-token regen-symbol regen-ast regen-importlib clinic
+ regen-token regen-keyword regen-symbol regen-ast regen-importlib clinic
############################################################################
# Special rules for object files
@@ -843,6 +843,15 @@ regen-token:
$(srcdir)/Grammar/Tokens \
$(srcdir)/Lib/token.py
+.PHONY: regen-keyword
+regen-keyword:
+ # Regenerate Lib/keyword.py from Grammar/Grammar and Grammar/Tokens
+ # using Parser/pgen
+ $(PYTHON_FOR_REGEN) -m Parser.pgen.keywordgen $(srcdir)/Grammar/Grammar \
+ $(srcdir)/Grammar/Tokens \
+ $(srcdir)/Lib/keyword.py.new
+ $(UPDATE_FILE) $(srcdir)/Lib/keyword.py $(srcdir)/Lib/keyword.py.new
+
.PHONY: regen-symbol
regen-symbol: $(srcdir)/Include/graminit.h
# Regenerate Lib/symbol.py from Include/graminit.h