diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2004-01-01 16:42:43 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2004-01-01 16:42:43 +0000 |
commit | 5a678d29f58926a5cd7db0c9121c69cb603a77f9 (patch) | |
tree | c8157238e17990d5d90f9eeb1c08506e253593bb /byterun/parsing.c | |
parent | 331b2d89c3dc4fb7e1b51276a5a9e37a6c8c8b3a (diff) |
depollution suite (PR#1914 et PR#1956)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6045 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/parsing.c')
-rw-r--r-- | byterun/parsing.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/byterun/parsing.c b/byterun/parsing.c index 3f9ac3565..68e687ffd 100644 --- a/byterun/parsing.c +++ b/byterun/parsing.c @@ -70,7 +70,7 @@ struct parser_env { /* Mirrors parser_env in ../stdlib/parsing.ml */ #define Short(tbl,n) (((short *)(tbl))[n]) #endif -int parser_trace = 0; +int caml_parser_trace = 0; /* Input codes */ /* Mirrors parser_input in ../stdlib/parsing.ml */ @@ -139,8 +139,8 @@ static void print_token(struct parser_tables *tables, int state, value tok) /* The pushdown automata */ -CAMLprim value parse_engine(struct parser_tables *tables, - struct parser_env *env, value cmd, value arg) +CAMLprim value caml_parse_engine(struct parser_tables *tables, + struct parser_env *env, value cmd, value arg) { int state; mlsize_t sp, asp; @@ -171,7 +171,7 @@ CAMLprim value parse_engine(struct parser_tables *tables, env->curr_char = Field(tables->transl_const, Int_val(arg)); caml_modify(&env->lval, Val_long(0)); } - if (parser_trace) print_token(tables, state, arg); + if (caml_parser_trace) print_token(tables, state, arg); testshift: n1 = Short(tables->sindex, state); @@ -200,13 +200,17 @@ CAMLprim value parse_engine(struct parser_tables *tables, n2 = n1 + ERRCODE; if (n1 != 0 && n2 >= 0 && n2 <= Int_val(tables->tablesize) && Short(tables->check, n2) == ERRCODE) { - if (parser_trace) + if (caml_parser_trace) fprintf(stderr, "Recovering in state %d\n", state1); goto shift_recover; } else { - if (parser_trace) fprintf(stderr, "Discarding state %d\n", state1); + if (caml_parser_trace){ + fprintf(stderr, "Discarding state %d\n", state1); + } if (sp <= Int_val(env->stackbase)) { - if (parser_trace) fprintf(stderr, "No more states to discard\n"); + if (caml_parser_trace){ + fprintf(stderr, "No more states to discard\n"); + } return RAISE_PARSE_ERROR; /* The ML code raises Parse_error */ } sp--; @@ -215,7 +219,7 @@ CAMLprim value parse_engine(struct parser_tables *tables, } else { if (Int_val(env->curr_char) == 0) return RAISE_PARSE_ERROR; /* The ML code raises Parse_error */ - if (parser_trace) fprintf(stderr, "Discarding last token read\n"); + if (caml_parser_trace) fprintf(stderr, "Discarding last token read\n"); env->curr_char = Val_int(-1); goto loop; } @@ -224,7 +228,7 @@ CAMLprim value parse_engine(struct parser_tables *tables, env->curr_char = Val_int(-1); if (errflag > 0) errflag--; shift_recover: - if (parser_trace) + if (caml_parser_trace) fprintf(stderr, "State %d: shift to state %d\n", state, Short(tables->table, n2)); state = Short(tables->table, n2); @@ -243,7 +247,7 @@ CAMLprim value parse_engine(struct parser_tables *tables, goto loop; reduce: - if (parser_trace) + if (caml_parser_trace) fprintf(stderr, "State %d: reduce by rule %d\n", state, n); m = Short(tables->len, n); env->asp = Val_int(sp); |