From: Peter Johnson Date: Thu, 11 Oct 2001 18:59:13 +0000 (-0000) Subject: Fix handling of numeric constants ending in a single character (h,q,b). X-Git-Tag: v0.1.0~257 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=079c17a068c27254934d65cfa5f39605df015aee;p=yasm Fix handling of numeric constants ending in a single character (h,q,b). svn path=/trunk/yasm/; revision=273 --- diff --git a/modules/parsers/nasm/token.l.in b/modules/parsers/nasm/token.l.in index 17c4a996..d5dc46af 100644 --- a/modules/parsers/nasm/token.l.in +++ b/modules/parsers/nasm/token.l.in @@ -96,21 +96,21 @@ WS [ \t\r] /* 10010011b - binary number */ {BINDIGIT}+b { - yytext[strlen(yytext)] = '\0'; /* strip off 'b' */ + yytext[strlen(yytext)-1] = '\0'; /* strip off 'b' */ yylval.intn = intnum_new_bin(yytext); return INTNUM; } /* 777q - octal number */ {OCTDIGIT}+q { - yytext[strlen(yytext)] = '\0'; /* strip off 'q' */ + yytext[strlen(yytext)-1] = '\0'; /* strip off 'q' */ yylval.intn = intnum_new_oct(yytext); return INTNUM; } /* 0AAh form of hexidecimal number */ 0{HEXDIGIT}+h { - yytext[strlen(yytext)] = '\0'; /* strip off 'h' */ + yytext[strlen(yytext)-1] = '\0'; /* strip off 'h' */ yylval.intn = intnum_new_hex(yytext); return INTNUM; } diff --git a/src/parsers/nasm/token.l.in b/src/parsers/nasm/token.l.in index 17c4a996..d5dc46af 100644 --- a/src/parsers/nasm/token.l.in +++ b/src/parsers/nasm/token.l.in @@ -96,21 +96,21 @@ WS [ \t\r] /* 10010011b - binary number */ {BINDIGIT}+b { - yytext[strlen(yytext)] = '\0'; /* strip off 'b' */ + yytext[strlen(yytext)-1] = '\0'; /* strip off 'b' */ yylval.intn = intnum_new_bin(yytext); return INTNUM; } /* 777q - octal number */ {OCTDIGIT}+q { - yytext[strlen(yytext)] = '\0'; /* strip off 'q' */ + yytext[strlen(yytext)-1] = '\0'; /* strip off 'q' */ yylval.intn = intnum_new_oct(yytext); return INTNUM; } /* 0AAh form of hexidecimal number */ 0{HEXDIGIT}+h { - yytext[strlen(yytext)] = '\0'; /* strip off 'h' */ + yytext[strlen(yytext)-1] = '\0'; /* strip off 'h' */ yylval.intn = intnum_new_hex(yytext); return INTNUM; }