Mercurial > ~dholland > hg > tradcpp > index.cgi
comparison 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 |
comparison
equal
deleted
inserted
replaced
95:1c0575f7dd46 | 96:408331be8792 |
---|---|
611 char *t; | 611 char *t; |
612 | 612 |
613 if (word[0] >= '0' && word[0] <= '9') { | 613 if (word[0] >= '0' && word[0] <= '9') { |
614 errno = 0; | 614 errno = 0; |
615 val = strtoul(word, &t, 0); | 615 val = strtoul(word, &t, 0); |
616 if (errno || *t != '\0') { | 616 if (errno) { |
617 complain(p, "Invalid integer constant"); | 617 complain(p, "Invalid integer constant"); |
618 complain_fail(); | |
619 return 0; | |
620 } | |
621 while (*t == 'U' || *t == 'L') { | |
622 t++; | |
623 } | |
624 if (*t != '\0') { | |
625 complain(p, "Trailing garbage after integer constant"); | |
618 complain_fail(); | 626 complain_fail(); |
619 return 0; | 627 return 0; |
620 } | 628 } |
621 if (val > INT_MAX) { | 629 if (val > INT_MAX) { |
622 complain(p, "Integer constant too large"); | 630 complain(p, "Integer constant too large"); |