Browse Source

Allow integer literals in FOLD rules.

Workaround before refactoring conversion ops.
Mike Pall 14 years ago
parent
commit
36fed9f3e1
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/buildvm_fold.c

+ 5 - 0
src/buildvm_fold.c

@@ -110,6 +110,11 @@ static uint32_t nexttoken(char **pp, int allowlit, int allowany)
       for (i = 0; ircall_names[i]; i++)
       for (i = 0; ircall_names[i]; i++)
 	if (!strcmp(ircall_names[i], p+7))
 	if (!strcmp(ircall_names[i], p+7))
 	  return i;
 	  return i;
+    } else if (allowlit && *p >= '0' && *p <= '9') {
+      for (i = 0; *p >= '0' && *p <= '9'; p++)
+	i = i*10 + (*p - '0');
+      if (*p == '\0')
+	return i;
     } else if (allowany && !strcmp("any", p)) {
     } else if (allowany && !strcmp("any", p)) {
       return 0xff;
       return 0xff;
     } else {
     } else {