* src/SDCCutil.c: fixed a bug in (get_pragma_token)
[fw/sdcc] / src / SDCCutil.c
index 4fd505801e7b6e0c8fdee224fc870638c1488951..34db23dab44fcadfeddf2bf9d944c1555484fd62 100644 (file)
@@ -342,39 +342,39 @@ get_pragma_token(const char *s, struct pragma_token_s *token)
   dbuf_set_size(&token->dbuf, 0);
 
   /* skip leading spaces */
-  while (*s != '\n' && isspace(*s))
+  while ('\n' != *s && isspace(*s))
     ++s;
 
   if ('\0' == *s || '\n' == *s)
     {
       token->type = TOKEN_EOL;
     }
-  else if (isdigit(*s))
+  else
     {
       char *end;
 
       long val = strtol(s, &end, 0);
 
-      if (end != s && ('\0' == *end || isspace(*s)))
+      if (end != s && ('\0' == *end || isspace(*end)))
         {
           token->val.int_val = val;
           token->type = TOKEN_INT;
           dbuf_append(&token->dbuf, s, end - s);
+          s = end;
         }
-      s = end;
-    }
-  else
-    {
-      while ('\0' != *s && !isspace(*s))
+      else
         {
-          dbuf_append(&token->dbuf, s, 1);
-          ++s;
-        }
+          while ('\0' != *s && !isspace(*s))
+            {
+              dbuf_append(&token->dbuf, s, 1);
+              ++s;
+            }
 
-      token->type = TOKEN_STR;
+          token->type = TOKEN_STR;
+        }
     }
 
-    return (char *)s;
+  return (char *)s;
 }
 
 const char *