From 98a57f4fac42bfd688fcb0b739a2157361f04525 Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 16 Dec 1999 01:20:17 +0000 Subject: [PATCH] Handle blanks after b is binary numbers --- lexor.lex | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lexor.lex b/lexor.lex index 18bf652b8..7950fbd38 100644 --- a/lexor.lex +++ b/lexor.lex @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: lexor.lex,v 1.38 1999/11/23 02:49:04 steve Exp $" +#ident "$Id: lexor.lex,v 1.39 1999/12/16 01:20:17 steve Exp $" #endif //# define YYSTYPE lexval @@ -315,19 +315,17 @@ static verinum*make_binary_with_size(unsigned size, bool fixed, const char*ptr) assert(tolower(*ptr) == 'b'); verinum::V*bits = new verinum::V[size]; + ptr += 1; while (*ptr && ((*ptr == ' ') || (*ptr == '\t'))) ptr += 1; unsigned idx = 0; const char*eptr = ptr + strlen(ptr) - 1; - while ((eptr > ptr) && (idx < size)) { - - if (*eptr == '_') { - eptr -= 1; - continue; - } + while ((eptr >= ptr) && (idx < size)) { switch (*eptr) { + case '_': + break; case '0': bits[idx++] = verinum::V0; break; @@ -349,7 +347,7 @@ static verinum*make_binary_with_size(unsigned size, bool fixed, const char*ptr) // Zero-extend binary number, except that z or x is extended // if it is the highest supplied digit. while (idx < size) { - switch (ptr[1]) { + switch (ptr[0]) { case '0': case '1': bits[idx++] = verinum::V0;