aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2006-01-06 01:21:56 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2006-01-06 01:21:56 +0000
commit0540fc3a81f37d65bf2df9cac9d84c200acca325 (patch)
treefd11fbf08f0a3ff1b1225d5d87b413aab1514994
parent742bb86582877f2cb436b1fa72441cea01e8b8f7 (diff)
2006-01-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/24268 * io.c (next_char_not_space): New function that returns the next character that is not white space. (format_lex): Use the new function to skip whitespace within a format string. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@109402 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/io.c38
2 files changed, 32 insertions, 14 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 38781ee1172..2b47dc876ae 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2006-01-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/24268
+ * io.c (next_char_not_space): New function that returns the next
+ character that is not white space.
+ (format_lex): Use the new function to skip whitespace within
+ a format string.
+
2006-01-05 Erik Edelmann <eedelman@gcc.gnu.org>
PR fortran/23675
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index 7ca000ae138..e72fe5d01ca 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -154,6 +154,20 @@ unget_char (void)
use_last_char = 1;
}
+/* Eat up the spaces and return a character. */
+
+static char
+next_char_not_space(void)
+{
+ char c;
+ do
+ {
+ c = next_char (0);
+ }
+ while (gfc_is_whitespace (c));
+ return c;
+}
+
static int value = 0;
/* Simple lexical analyzer for getting the next token in a FORMAT
@@ -174,19 +188,15 @@ format_lex (void)
return token;
}
- do
- {
- c = next_char (0);
- }
- while (gfc_is_whitespace (c));
-
+ c = next_char_not_space ();
+
negative_flag = 0;
switch (c)
{
case '-':
negative_flag = 1;
case '+':
- c = next_char (0);
+ c = next_char_not_space ();
if (!ISDIGIT (c))
{
token = FMT_UNKNOWN;
@@ -197,7 +207,7 @@ format_lex (void)
do
{
- c = next_char (0);
+ c = next_char_not_space ();
if(ISDIGIT (c))
value = 10 * value + c - '0';
}
@@ -227,13 +237,13 @@ format_lex (void)
do
{
- c = next_char (0);
+ c = next_char_not_space ();
if (c != '0')
zflag = 0;
if (ISDIGIT (c))
value = 10 * value + c - '0';
}
- while (ISDIGIT (c) || gfc_is_whitespace(c));
+ while (ISDIGIT (c));
unget_char ();
token = zflag ? FMT_ZERO : FMT_POSINT;
@@ -260,7 +270,7 @@ format_lex (void)
break;
case 'T':
- c = next_char (0);
+ c = next_char_not_space ();
if (c != 'L' && c != 'R')
unget_char ();
@@ -280,7 +290,7 @@ format_lex (void)
break;
case 'S':
- c = next_char (0);
+ c = next_char_not_space ();
if (c != 'P' && c != 'S')
unget_char ();
@@ -288,7 +298,7 @@ format_lex (void)
break;
case 'B':
- c = next_char (0);
+ c = next_char_not_space ();
if (c == 'N' || c == 'Z')
token = FMT_BLANK;
else
@@ -350,7 +360,7 @@ format_lex (void)
break;
case 'E':
- c = next_char (0);
+ c = next_char_not_space ();
if (c == 'N' || c == 'S')
token = FMT_EXT;
else