* ext/racc/cparse/cparse.c: reduce goto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2002-08-06 23:42:04 +00:00
parent fc2a1ad79f
commit 30bc60cfe4
2 changed files with 50 additions and 46 deletions

View File

@ -1,3 +1,7 @@
Wed Aug 7 08:44:32 2002 Minero Aoki <aamine@loveruby.net>
* ext/racc/cparse/cparse.c: reduce goto.
Tue Aug 6 15:19:39 2002 NAKAMURA Usaku <usa@ruby-lang.org> Tue Aug 6 15:19:39 2002 NAKAMURA Usaku <usa@ruby-lang.org>
* string.c (rb_str_rindex): must return -1 if unmatched. * string.c (rb_str_rindex): must return -1 if unmatched.

View File

@ -1,4 +1,4 @@
/* vi:set sw=4: /*
cparse.c cparse.c
@ -519,7 +519,8 @@ parse_main(v, tok, val, resume)
} }
else if (act == -(v->reduce_n)) { else if (act == -(v->reduce_n)) {
goto error; goto error;
error_return: ; error_return:
; /* goto label requires stmt */
} }
else if (act == v->shift_n) { else if (act == v->shift_n) {
D(puts("accept")); D(puts("accept"));
@ -566,7 +567,7 @@ parse_main(v, tok, val, resume)
/* check if we can shift/reduce error token */ /* check if we can shift/reduce error token */
D(printf("(err) k1=%ld\n", v->curstate)); D(printf("(err) k1=%ld\n", v->curstate));
D(printf("(err) k2=%d (error)\n", ERROR_TOKEN)); D(printf("(err) k2=%d (error)\n", ERROR_TOKEN));
e_lookup: while (1) {
tmp = AREF(v->action_pointer, v->curstate); tmp = AREF(v->action_pointer, v->curstate);
if (NIL_P(tmp)) goto e_notfound; if (NIL_P(tmp)) goto e_notfound;
D(puts("(err) pointer[k1] true")); D(puts("(err) pointer[k1] true"));
@ -594,7 +595,7 @@ parse_main(v, tok, val, resume)
D(puts("(err) found: can handle error token")); D(puts("(err) found: can handle error token"));
act = NUM2LONG(vact); act = NUM2LONG(vact);
goto e_handle_act; break;
e_notfound: e_notfound:
D(puts("(err) not found: can't handle error token; pop")); D(puts("(err) not found: can't handle error token; pop"));
@ -612,9 +613,8 @@ parse_main(v, tok, val, resume)
rb_funcall(v->parser, id_d_e_pop, rb_funcall(v->parser, id_d_e_pop,
3, v->state, v->tstack, v->vstack); 3, v->state, v->tstack, v->vstack);
} }
goto e_lookup; }
e_handle_act:
/* shift/reduce error token */ /* shift/reduce error token */
if (act > 0 && act < v->shift_n) { if (act > 0 && act < v->shift_n) {
D(puts("e shift")); D(puts("e shift"));