X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=assembler%2Fscanner.l;h=5013d0e94e4e0a430fcab9f357624686cd2a7888;hb=c2202e82a4da7ec25c1d5866f617b644bdcbb73e;hp=ab4821c751659a17f274c0a3c5fcf28b91c13d1b;hpb=7fd69f575e0f5a517651016513be6006db279c17;p=b43-tools.git diff --git a/assembler/scanner.l b/assembler/scanner.l index ab4821c..5013d0e 100644 --- a/assembler/scanner.l +++ b/assembler/scanner.l @@ -48,13 +48,13 @@ NEWLINE ((\r)|(\n)|(\r\n)) {WS}+ { update_lineinfo(); /* whitespace */ } {NEWLINE} { cur_lineinfo.lineno++; update_lineinfo(); } -;.*$ { update_lineinfo(); /* comment */ } ^{WS}*"%"{WS}*arch { update_lineinfo(); return ASM_ARCH; } ^{WS}*"%"{WS}*start { update_lineinfo(); return ASM_START; } +"%"{WS}*assert { update_lineinfo(); return ASM_ASSERT; } -^{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; } @@ -62,11 +62,16 @@ off/[0-6] { update_lineinfo(); return OFFR; } lr/[0-3] { update_lineinfo(); return LR; } , { update_lineinfo(); return COMMA; } +; { update_lineinfo(); return SEMICOLON; } \[ { update_lineinfo(); return BRACK_OPEN; } \] { update_lineinfo(); return BRACK_CLOSE; } \( { update_lineinfo(); return PAREN_OPEN; } \) { update_lineinfo(); return PAREN_CLOSE; } +== { update_lineinfo(); return EQUAL; } +!= { update_lineinfo(); return NOT_EQUAL; } +\|\| { update_lineinfo(); return LOGICAL_OR; } +\&\& { update_lineinfo(); return LOGICAL_AND; } \+ { update_lineinfo(); return PLUS; } \- { update_lineinfo(); return MINUS; } \* { update_lineinfo(); return MULTIPLY; } @@ -149,6 +154,7 @@ shm32 { update_lineinfo(); return IVAL_SHM32; } %% struct lineinfo cur_lineinfo; +//FIXME The linenumber sometimes is wrong. static void interpret_cppinfo(const char *str) { @@ -175,7 +181,7 @@ static void interpret_cppinfo(const char *str) memset(tmp, 0, sizeof(tmp)); memcpy(tmp, str, min(sizeof(tmp) - 1, (int)(found - str))); - cur_lineinfo.lineno = strtoul(tmp, NULL, 10); + cur_lineinfo.lineno = strtoul(tmp, NULL, 10) - 1; str = found; str++; @@ -193,9 +199,6 @@ static void interpret_cppinfo(const char *str) min(sizeof(cur_lineinfo.file) - 1, (int)(found - str))); - if (strcmp(cur_lineinfo.file, "") == 0) - strcpy(cur_lineinfo.file, "Input File"); - return; error: fprintf(stderr, "Invalid CPP line directive: %s\n", orig);