b43-asm: Terminate instructions with ; instead of |
[b43-tools.git] / assembler / parser.y
index f00b2da4dec31266d2e64b6e6599514525ace4e8..5e256abb45506d5d57dea26385af676e9c4eddc5 100644 (file)
@@ -38,7 +38,7 @@ extern struct initvals_sect *cur_initvals_sect;
 
 %token SECTION_TEXT SECTION_IVALS
 
-%token ASM_ARCH ASM_START SPR GPR OFFR LR COMMA BRACK_OPEN BRACK_CLOSE PAREN_OPEN PAREN_CLOSE HEXNUM DECNUM ARCH_NEWWORLD ARCH_OLDWORLD LABEL IDENT LABELREF
+%token ASM_ARCH ASM_START SPR GPR OFFR LR COMMA SEMICOLON BRACK_OPEN BRACK_CLOSE PAREN_OPEN PAREN_CLOSE HEXNUM DECNUM ARCH_NEWWORLD ARCH_OLDWORLD LABEL IDENT LABELREF
 
 %token PLUS MINUS MULTIPLY DIVIDE BITW_OR BITW_AND BITW_XOR BITW_NOT LEFTSHIFT RIGHTSHIFT
 
@@ -72,9 +72,10 @@ line : line_terminator {
          }
        ;
 
-/* Allow terminating lines with the "|" char */
+/* Allow terminating lines with the ";" char */
 line_terminator : /* Nothing */
-               | BITW_OR line_terminator
+               | SEMICOLON line_terminator
+               ;
 
 section_switch : SECTION_TEXT {
                        section = SECTION_TEXT;
@@ -1083,27 +1084,26 @@ reg             : GPR regnr {
                  }
                ;
 
-mem            : BRACK_OPEN hexnum_decnum BRACK_CLOSE {
+mem            : BRACK_OPEN imm BRACK_CLOSE {
                        struct memory *mem = xmalloc(sizeof(struct memory));
+                       struct immediate *offset_imm = $2;
                        mem->type = MEM_DIRECT;
-                       mem->offset = (unsigned long)$2;
+                       mem->offset = offset_imm->imm;
+                       free(offset_imm);
                        $$ = mem;
                  }
-               | BRACK_OPEN hexnum_decnum COMMA OFFR regnr BRACK_CLOSE {
+               | BRACK_OPEN imm COMMA OFFR regnr BRACK_CLOSE {
                        struct memory *mem = xmalloc(sizeof(struct memory));
+                       struct immediate *offset_imm = $2;
                        mem->type = MEM_INDIRECT;
-                       mem->offset = (unsigned long)$2;
+                       mem->offset = offset_imm->imm;
+                       free(offset_imm);
                        mem->offr_nr = (unsigned long)$5;
                        $$ = mem;
                  }
                ;
 
-imm            : hexnum {
-                       struct immediate *imm = xmalloc(sizeof(struct immediate));
-                       imm->imm = (unsigned long)$1;
-                       $$ = imm;
-                 }
-               | decnum {
+imm            : hexnum_decnum {
                        struct immediate *imm = xmalloc(sizeof(struct immediate));
                        imm->imm = (unsigned long)$1;
                        $$ = imm;