summaryrefslogtreecommitdiffstats
path: root/Parser/acceler.c
diff options
context:
space:
mode:
Diffstat (limited to 'Parser/acceler.c')
-rw-r--r--Parser/acceler.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/Parser/acceler.c b/Parser/acceler.c
index e515833..9b14263 100644
--- a/Parser/acceler.c
+++ b/Parser/acceler.c
@@ -10,21 +10,22 @@
are not part of the static data structure written on graminit.[ch]
by the parser generator. */
-#include "Python.h"
+#include "pgenheaders.h"
#include "grammar.h"
#include "node.h"
#include "token.h"
#include "parser.h"
/* Forward references */
-static void fixdfa(grammar *, const dfa *);
+static void fixdfa(grammar *, dfa *);
static void fixstate(grammar *, state *);
void
PyGrammar_AddAccelerators(grammar *g)
{
+ dfa *d;
int i;
- const dfa *d = g->g_dfa;
+ d = g->g_dfa;
for (i = g->g_ndfas; --i >= 0; d++)
fixdfa(g, d);
g->g_accel = 1;
@@ -33,9 +34,10 @@ PyGrammar_AddAccelerators(grammar *g)
void
PyGrammar_RemoveAccelerators(grammar *g)
{
+ dfa *d;
int i;
g->g_accel = 0;
- const dfa *d = g->g_dfa;
+ d = g->g_dfa;
for (i = g->g_ndfas; --i >= 0; d++) {
state *s;
int j;
@@ -49,7 +51,7 @@ PyGrammar_RemoveAccelerators(grammar *g)
}
static void
-fixdfa(grammar *g, const dfa *d)
+fixdfa(grammar *g, dfa *d)
{
state *s;
int j;
@@ -61,7 +63,7 @@ fixdfa(grammar *g, const dfa *d)
static void
fixstate(grammar *g, state *s)
{
- const arc *a;
+ arc *a;
int k;
int *accel;
int nl = g->g_ll.ll_nlabels;
@@ -76,14 +78,14 @@ fixstate(grammar *g, state *s)
a = s->s_arc;
for (k = s->s_narcs; --k >= 0; a++) {
int lbl = a->a_lbl;
- const label *l = &g->g_ll.ll_label[lbl];
+ label *l = &g->g_ll.ll_label[lbl];
int type = l->lb_type;
if (a->a_arrow >= (1 << 7)) {
printf("XXX too many states!\n");
continue;
}
if (ISNONTERMINAL(type)) {
- const dfa *d1 = PyGrammar_FindDFA(g, type);
+ dfa *d1 = PyGrammar_FindDFA(g, type);
int ibit;
if (type - NT_OFFSET >= (1 << 7)) {
printf("XXX too high nonterminal number!\n");