X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fapc.git;a=blobdiff_plain;f=src%2Fparser.y;h=1677c6cd42ef27955c8929ca1abb1bc55487724e;hp=2ff1638abab1281b232629ec566b6119df8263e6;hb=8b56606a960d7cbd61dd3031a3ee74b9a61bde31;hpb=c3d950725db2d94ba5a91caebf7a36bfa159e2a4 diff --git a/src/parser.y b/src/parser.y index 2ff1638..1677c6c 100644 --- a/src/parser.y +++ b/src/parser.y @@ -31,16 +31,18 @@ /* Stack-based class handler */ #define yyclass(CS) (*(CS->csp)) #define yyclassld(CS) (ir_classld_from_class(yyclass(CS))) + #define DEFAULT_VARIANT (uint8_t*)"default" } %define parse.error verbose +%define parse.lac full %define lr.type ielr %define api.pure full %define api.push-pull push %parse-param {yycstate* cs} %union { - long long ref; + uint32_t ref; int val; - apc_facing face; + apc_facing face; uint8_t* str; ir_class class; ir_set set; @@ -98,7 +100,9 @@ statement: data_spec: SS NAME frame_spec { $$ = ir_framesheet($2,$3.d,$3.w,$3.h); } +| SS frame_spec { $$ = ir_framesheet(DEFAULT_VARIANT,$2.d,$2.w,$2.h); } | MAP NAME frame_spec { $$ = ir_mapsheet($2,$3.d,$3.w,$3.h); } +| MAP frame_spec { $$ = ir_mapsheet(DEFAULT_VARIANT,$2.d,$2.w,$2.h); } | AUDIO NAME { $$ = ir_audio($2); } | LINK set_ld { $$ = ir_link(OLINK, $2, NULL); } | LINK set_ld MAP { $$ = ir_link(MLINK, $2,NULL); } @@ -128,6 +132,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 +142,15 @@ void yyerror ( yycstate* cs, char const *s ) -{ fprintf(stderr, "%s\n", s); } +{ ir_class* iter; + fprintf(stderr, "[class->"); + for (iter = cs->class_stack; iter <= cs->csp; iter++) + fprintf(stderr, "%s/", ir_class_name(*iter)); + if (strstr(s,"unexpected CLCLOSE") != NULL) + yyclass_pop(cs); + fprintf(stderr, "]\n\t"); + fprintf(stderr, "%s\n", s); +} yycstate* yycstate_new ( void ) @@ -155,7 +168,7 @@ yycstate* yycstate_new static inline ir_class yyclass_pop ( yycstate* cs ) -{ return *((cs->csp)--); } +{ return *cs->csp--; } static inline ir_class yyclass_push