From be06ecf2322ad87005e2d3f18eb6dbb08da7e92c Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Sat, 26 Jan 2008 01:03:47 +0100 Subject: [PATCH] b43-asm: Allow terminating lines with | This improves macro handling Signed-off-by: Michael Buesch --- assembler/parser.y | 14 ++++++++++---- assembler/scanner.l | 4 ++-- assembler/test.asm | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/assembler/parser.y b/assembler/parser.y index e55c2b7..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; } diff --git a/assembler/scanner.l b/assembler/scanner.l index 346cbe6..1fa83d5 100644 --- a/assembler/scanner.l +++ b/assembler/scanner.l @@ -53,8 +53,8 @@ NEWLINE ((\r)|(\n)|(\r\n)) ^{WS}*"%"{WS}*arch { update_lineinfo(); return ASM_ARCH; } ^{WS}*"%"{WS}*start { update_lineinfo(); return ASM_START; } -^{WS}*\.text{WS}*$ { update_lineinfo(); return SECTION_TEXT; } -^{WS}*\.initvals/\({IDENTIFIER}\){WS}*{NEWLINE} { update_lineinfo(); return SECTION_IVALS; } +^{WS}*\.text{WS}*$ { update_lineinfo(); return SECTION_TEXT; } +^{WS}*\.initvals/\({IDENTIFIER}\) { update_lineinfo(); return SECTION_IVALS; } spr[0-9a-fA-F]{3,3} { update_lineinfo(); return SPR; } r/([0-9]|([1-5][0-9])|(6[0-3])) { update_lineinfo(); return GPR; } diff --git a/assembler/test.asm b/assembler/test.asm index bfd3a08..8f78893 100644 --- a/assembler/test.asm +++ b/assembler/test.asm @@ -163,6 +163,7 @@ function_b: or spr06c,0,spr06c ; Can have one spr input and one spr output or [0],0,[0] ; Can have one mem input and one mem output mov testlabel, r0 ; Can use label as immediate value + mov r0,r1|mov r2, r3 ; | does also seperate instructions ; The .initvals section generates an "Initial Values" file -- 2.31.1