X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fapc.git;a=blobdiff_plain;f=src%2Fparser.y;h=d7a02cded9f1c3214412ac47714736f5b1830dd8;hp=2ff1638abab1281b232629ec566b6119df8263e6;hb=7dae7dc73dfbabdc895a78738f550f56561da644;hpb=c3d950725db2d94ba5a91caebf7a36bfa159e2a4 diff --git a/src/parser.y b/src/parser.y index 2ff1638..d7a02cd 100644 --- a/src/parser.y +++ b/src/parser.y @@ -33,6 +33,7 @@ #define yyclassld(CS) (ir_classld_from_class(yyclass(CS))) } %define parse.error verbose +%define parse.lac full %define lr.type ielr %define api.pure full %define api.push-pull push @@ -128,6 +129,7 @@ frame_spec: NUM NUM { $$ = (struct frame_spec_t) {SFACE,$1,$2}; } | FACING { $$ = (struct frame_spec_t) {$1,0,0}; } | FACING NUM NUM { $$ = (struct frame_spec_t) {$1,$2,$3}; } +| %empty { $$ = (struct frame_spec_t) {SFACE,0,0}; } ; %% @@ -137,7 +139,12 @@ void yyerror ( yycstate* cs, char const *s ) -{ fprintf(stderr, "%s\n", s); } +{ ir_class* iter; + for (iter = cs->class_stack; iter < cs->csp; iter++) + fprintf(stderr, "%s/", ir_class_name(*iter)); + fprintf(stderr, "\n\t"); + fprintf(stderr, "%s\n", s); +} yycstate* yycstate_new ( void ) @@ -155,7 +162,9 @@ yycstate* yycstate_new static inline ir_class yyclass_pop ( yycstate* cs ) -{ return *((cs->csp)--); } +{ cs->csp--; + return *(cs->csp + 1); +} static inline ir_class yyclass_push