X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=sidebyside;f=assembler%2Fparser.y;h=f00b2da4dec31266d2e64b6e6599514525ace4e8;hb=be06ecf2322ad87005e2d3f18eb6dbb08da7e92c;hp=753be084c1d98925335a3fc4cbec1cfe30750beb;hpb=b9e19faa25ad9e1b24f08dc77267760df1b98504;p=b43-tools.git diff --git a/assembler/parser.y b/assembler/parser.y index 753be08..f00b2da 100644 --- a/assembler/parser.y +++ b/assembler/parser.y @@ -50,17 +50,19 @@ extern struct initvals_sect *cur_initvals_sect; %% -line : /* empty */ - | line statement { +line : line_terminator { + /* empty */ + } + | line statement line_terminator { struct statement *s = $2; if (section != SECTION_TEXT) yyerror("Microcode text instruction in non .text section"); memcpy(&s->info, &cur_lineinfo, sizeof(struct lineinfo)); list_add_tail(&s->list, &infile.sl); } - | line section_switch { + | line section_switch line_terminator { } - | line ivals_write { + | line ivals_write line_terminator { struct initval_op *io = $2; if (section != SECTION_IVALS) yyerror("InitVals write in non .initvals section"); @@ -70,6 +72,10 @@ line : /* empty */ } ; +/* Allow terminating lines with the "|" char */ +line_terminator : /* Nothing */ + | BITW_OR line_terminator + section_switch : SECTION_TEXT { section = SECTION_TEXT; } @@ -487,8 +493,11 @@ statement : asmdir { ; /* ASM directives */ -asmdir : asmarch { - $$ = $1; +asmdir : ASM_ARCH hexnum_decnum { + struct asmdir *ad = xmalloc(sizeof(struct asmdir)); + ad->type = ADIR_ARCH; + ad->u.arch = (unsigned int)(unsigned long)$2; + $$ = ad; } | ASM_START identifier { struct asmdir *ad = xmalloc(sizeof(struct asmdir)); @@ -501,20 +510,6 @@ asmdir : asmarch { } ; -asmarch : ASM_ARCH ARCH_NEWWORLD { - struct asmdir *ad = xmalloc(sizeof(struct asmdir)); - ad->type = ADIR_ARCH; - ad->u.arch = NEWWORLD; - $$ = ad; - } - | ASM_ARCH ARCH_OLDWORLD { - struct asmdir *ad = xmalloc(sizeof(struct asmdir)); - ad->type = ADIR_ARCH; - ad->u.arch = OLDWORLD; - $$ = ad; - } - ; - label : LABEL { struct label *label = xmalloc(sizeof(struct label)); char *l; @@ -1008,11 +1003,11 @@ extended_operlist : decnum COMMA decnum COMMA operand COMMA operand COMMA operan } ; -external_jump_operands : hexnum COMMA operand COMMA operand COMMA labelref { +external_jump_operands : imm COMMA operand COMMA operand COMMA labelref { struct operlist *ol = xmalloc(sizeof(struct operlist)); struct operand *cond = xmalloc(sizeof(struct operand)); - cond->type = OPER_RAW; - cond->u.raw = (unsigned long)$1; + cond->type = OPER_IMM; + cond->u.imm = $1; ol->oper[0] = cond; ol->oper[1] = $3; ol->oper[2] = $5;