From: Peter Johnson Date: Mon, 19 Nov 2001 05:23:00 +0000 (-0000) Subject: Fix hexidecimal number handling. It was only allowing numbers starting with 0. X-Git-Tag: v0.1.0~183 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d894c27cca3cdc164a263f971a47217eca79f76b;p=yasm Fix hexidecimal number handling. It was only allowing numbers starting with 0. svn path=/trunk/yasm/; revision=347 --- diff --git a/modules/parsers/nasm/token.l.in b/modules/parsers/nasm/token.l.in index a24da44e..a3b086e1 100644 --- a/modules/parsers/nasm/token.l.in +++ b/modules/parsers/nasm/token.l.in @@ -100,14 +100,14 @@ WS [ \t\r] } /* 0AAh form of hexidecimal number */ -0{HEXDIGIT}+h { +{DIGIT}{HEXDIGIT}+h { yytext[strlen(yytext)-1] = '\0'; /* strip off 'h' */ yylval.intn = intnum_new_hex(yytext); return INTNUM; } /* $0AA and 0xAA forms of hexidecimal number */ -(\$0|0x){HEXDIGIT}+ { +(\${DIGIT}|0x){HEXDIGIT}+ { if (yytext[1] == 'x') yylval.intn = intnum_new_hex(yytext+2); /* 0x format, skip 0 and x */ else diff --git a/src/parsers/nasm/token.l.in b/src/parsers/nasm/token.l.in index a24da44e..a3b086e1 100644 --- a/src/parsers/nasm/token.l.in +++ b/src/parsers/nasm/token.l.in @@ -100,14 +100,14 @@ WS [ \t\r] } /* 0AAh form of hexidecimal number */ -0{HEXDIGIT}+h { +{DIGIT}{HEXDIGIT}+h { yytext[strlen(yytext)-1] = '\0'; /* strip off 'h' */ yylval.intn = intnum_new_hex(yytext); return INTNUM; } /* $0AA and 0xAA forms of hexidecimal number */ -(\$0|0x){HEXDIGIT}+ { +(\${DIGIT}|0x){HEXDIGIT}+ { if (yytext[1] == 'x') yylval.intn = intnum_new_hex(yytext+2); /* 0x format, skip 0 and x */ else