X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fapc.git;a=blobdiff_plain;f=src%2Fparser.y;fp=src%2Fparser.y;h=2c74db709d4d58208bdcadb15920cdb57d33f6de;hp=5dc5fdbe9ce967e5e8114b03bbe69cff224e7d52;hb=b14fd3a9556894089856bbee50ebe727d9b64635;hpb=d6c67861eaed9dc64d8bf2c1ddd91bf7a1f458fe diff --git a/src/parser.y b/src/parser.y index 5dc5fdb..2c74db7 100644 --- a/src/parser.y +++ b/src/parser.y @@ -5,7 +5,7 @@ #include "ir.h" #include "apc.h" typedef struct class_state_t yycstate; - struct frame_spec_t { apc_facing d; int w, h; }; + struct frame_spec_t { facinglist list; int w, h; }; } %code provides { yycstate* yycstate_new(void); @@ -49,6 +49,7 @@ ir_setld ld; ir_setdata data; struct frame_spec_t frame_spec; + facinglist facinglist; } /* Operators */ %token CLOPEN //( @@ -64,10 +65,11 @@ %token FACING %token NAME /* Types */ -%type data_spec -%type set_spec -%type set_ld set_link -%type frame_spec +%type data_spec +%type set_spec +%type set_ld set_link +%type frame_spec +%type facing_list %% /* Syntax Directed Translation Scheme of the APC grammar */ progn: @@ -100,10 +102,10 @@ statement_list: ; 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); } + SS NAME frame_spec { $$ = ir_framesheet($2,$3.list,$3.w,$3.h); } +| SS frame_spec { $$ = ir_framesheet(DEFAULT_VARIANT,$2.list,$2.w,$2.h); } +| MAP NAME frame_spec { $$ = ir_mapsheet($2,$3.list,$3.w,$3.h); } +| MAP frame_spec { $$ = ir_mapsheet(DEFAULT_VARIANT,$2.list,$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); } @@ -129,11 +131,15 @@ set_ld: | REF { $$ = ir_setld_from_ref($1); } ; +facing_list: + facing_list FACING { $$ = ir_facinglist_push($1,$2); } +| FACING { $$ = ir_facinglist($1); } + 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}; } + NUM NUM { $$ = (struct frame_spec_t) {NULL,$1,$2}; } +| facing_list { $$ = (struct frame_spec_t) {$1,0,0}; } +| facing_list NUM NUM { $$ = (struct frame_spec_t) {$1,$2,$3}; } +| %empty { $$ = (struct frame_spec_t) {NULL,0,0}; } ; %%