changeset 96:408331be8792

Accept [UL]* after integer constants.
author David A. Holland
date Mon, 10 Jun 2013 23:33:37 -0400
parents 1c0575f7dd46
children 83ad94eec98f
files eval.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
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();