X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fapc.git;a=blobdiff_plain;f=src%2Fparser.y;h=ff2d25715cd485b99183e1323a6a0e91b0e1e0d2;hp=db8e30b442b0fc5f561792365851b9150c3f46ac;hb=7896cfff4745b3999850dd301a296de71f7356eb;hpb=25a23e5134b1d9649f0279a4028b887c9deb9987 diff --git a/src/parser.y b/src/parser.y index db8e30b..ff2d257 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 @@ -80,13 +81,7 @@ class_list: ; class: -NAME CLOPEN { printf("new class\n"); - printf("class name: %s\n", $1); - printf("current class head: %s\n", ir_class_name(yyclass(cs))); - yyclass_push(cs,ir_class_addchild(yyclass(cs), $1)); - printf("Pushed class\n"); - printf("current class head: %s\n", ir_class_name(yyclass(cs))); -} + NAME CLOPEN { yyclass_push(cs,ir_class_addchild(yyclass(cs), $1)); } progn CLCLOSE { yyclass_pop(cs); } ; @@ -143,7 +138,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 ) @@ -161,7 +161,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