diff eval.c @ 96:408331be8792

Accept [UL]* after integer constants.
author David A. Holland
date Mon, 10 Jun 2013 23:33:37 -0400
parents b127a69061b2
children 33954a07d013
line wrap: on
line diff
--- a/eval.c	Mon Jun 10 23:33:15 2013 -0400
+++ b/eval.c	Mon Jun 10 23:33:37 2013 -0400
@@ -613,11 +613,19 @@
 	if (word[0] >= '0' && word[0] <= '9') {
 		errno = 0;
 		val = strtoul(word, &t, 0);
-		if (errno || *t != '\0') {
+		if (errno) {
 			complain(p, "Invalid integer constant");
 			complain_fail();
 			return 0;
 		}
+		while (*t == 'U' || *t == 'L') {
+			t++;
+		}
+		if (*t != '\0') {
+			complain(p, "Trailing garbage after integer constant");
+			complain_fail();
+			return 0;
+		}
 		if (val > INT_MAX) {
 			complain(p, "Integer constant too large");
 			complain_fail();