diff options
author | tyomitch <tyomitch@gmail.com> | 2019-04-23 09:29:57 (GMT) |
---|---|---|
committer | Inada Naoki <songofacandy@gmail.com> | 2019-04-23 09:29:57 (GMT) |
commit | 84b4784f12d4b8aab2b4cc5a4f5b64f45ec3e5d4 (patch) | |
tree | b58b4e4464c3ecbf1256f6263b2175d5a06bfd2d /Parser | |
parent | fb8c7d53326d137785ca311bfc48c8284da46770 (diff) | |
download | cpython-84b4784f12d4b8aab2b4cc5a4f5b64f45ec3e5d4.zip cpython-84b4784f12d4b8aab2b4cc5a4f5b64f45ec3e5d4.tar.gz cpython-84b4784f12d4b8aab2b4cc5a4f5b64f45ec3e5d4.tar.bz2 |
use `const` in graminit.c (GH-12713)
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/pgen/grammar.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Parser/pgen/grammar.py b/Parser/pgen/grammar.py index 1ab9434..5cd6524 100644 --- a/Parser/pgen/grammar.py +++ b/Parser/pgen/grammar.py @@ -76,7 +76,7 @@ class Grammar: def print_labels(self, writer): writer( - "static label labels[{n_labels}] = {{\n".format(n_labels=len(self.labels)) + "static const label labels[{n_labels}] = {{\n".format(n_labels=len(self.labels)) ) for label, name in self.labels: label_name = '"{}"'.format(name) if name is not None else 0 @@ -89,7 +89,7 @@ class Grammar: def print_dfas(self, writer): self.print_states(writer) - writer("static dfa dfas[{}] = {{\n".format(len(self.dfas))) + writer("static const dfa dfas[{}] = {{\n".format(len(self.dfas))) for dfaindex, dfa_elem in enumerate(self.dfas.items()): symbol, (dfa, first_sets) = dfa_elem writer( @@ -131,7 +131,7 @@ class Grammar: for stateindex, state in enumerate(states): narcs = len(state) write( - "static arc arcs_{dfa_index}_{state_index}[{n_arcs}] = {{\n".format( + "static const arc arcs_{dfa_index}_{state_index}[{n_arcs}] = {{\n".format( dfa_index=dfaindex, state_index=stateindex, n_arcs=narcs ) ) |