From c4913849c63bb747eeb18a15a35571abfcb37191 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Sun, 21 Nov 2010 21:55:58 +0000 Subject: [PATCH] [PATCH-YAP 3/4] ISO: Restrict binary, octal, hexadecimal integer constant indicators and exponent char to minuscules. (6.4.4) from Ulrich Neumerkel --- C/scanner.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/C/scanner.c b/C/scanner.c index c8569772b..415b74e92 100755 --- a/C/scanner.c +++ b/C/scanner.c @@ -547,7 +547,7 @@ get_num(int *chp, int *chbuffp, int inp_stream, int (*Nxtch) (int), int (*Quoted ch = Nxtch(inp_stream); } } - } else if ((ch == 'x' || ch == 'X') && base == 0) { + } else if (ch == 'x' && base == 0) { might_be_float = FALSE; if (--max_size == 0) { Yap_ErrorMessage = "Number Too Long"; @@ -571,11 +571,11 @@ get_num(int *chp, int *chbuffp, int inp_stream, int (*Nxtch) (int), int (*Quoted } *chp = ch; } - else if ((ch == 'o' || ch == 'O') && base == 0) { + else if (ch == 'o' && base == 0) { might_be_float = FALSE; base = 8; ch = Nxtch(inp_stream); - } else if ((ch == 'b' || ch == 'B') && base == 0) { + } else if (ch == 'b' && base == 0) { might_be_float = FALSE; base = 2; ch = Nxtch(inp_stream); @@ -602,7 +602,7 @@ get_num(int *chp, int *chbuffp, int inp_stream, int (*Nxtch) (int), int (*Quoted has_overflow = TRUE; ch = Nxtch(inp_stream); } - if (might_be_float && (ch == '.' || ch == 'e' || ch == 'E')) { + if (might_be_float && (ch == '.' || ch == 'e' )) { if (ch == '.') { if (--max_size == 0) { Yap_ErrorMessage = "Number Too Long"; @@ -628,7 +628,7 @@ get_num(int *chp, int *chbuffp, int inp_stream, int (*Nxtch) (int), int (*Quoted } while (chtype(ch = Nxtch(inp_stream)) == NU); } - if (ch == 'e' || ch == 'E') { + if (ch == 'e') { char *sp0 = sp; char cbuff = ch; @@ -654,15 +654,7 @@ get_num(int *chp, int *chbuffp, int inp_stream, int (*Nxtch) (int), int (*Quoted /* error */ char *sp; *chp = ch; - if (*sp0 == 'E') { - /* code the fact that we have E and not e */ - if (cbuff == '+') - *chbuffp = '='; - else - *chbuffp = '_'; - } else { - *chbuffp = cbuff; - } + *chbuffp = cbuff; *sp0 = '\0'; for (sp = s; sp < sp0; sp++) { if (*sp == '.') @@ -685,11 +677,11 @@ get_num(int *chp, int *chbuffp, int inp_stream, int (*Nxtch) (int), int (*Quoted *sp = '\0'; /* skip base */ *chp = ch; - if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) + if (s[0] == '0' && s[1] == 'x') return read_int_overflow(s+2,16,val,sign); - else if (s[0] == '0' && (s[1] == 'o' || s[1] == 'O')) + else if (s[0] == '0' && s[1] == 'o') return read_int_overflow(s+2,8,val,sign); - else if (s[0] == '0' && (s[1] == 'b' || s[1] == 'B')) + else if (s[0] == '0' && s[1] == 'b') return read_int_overflow(s+2,2,val,sign); if (s[1] == '\'') return read_int_overflow(s+2,base,val,sign);