mirror of git://gcc.gnu.org/git/gcc.git
re PR fortran/41075 ([F2008] Implement unlimited format item)
2009-08-17 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/41075 * io/io.h (enum format_token): Add FMT_STAR. * io/format.c (format_lex): Add case for FMT_STAR. (parse_format_list): Parse FMT_STAR and check for left paren after. (next_format0): Modify helper function to check for unimited format and return the repeated format node. Update comments to clarify. From-SVN: r150844
This commit is contained in:
parent
b823d9ebdf
commit
e2cec2c358
|
@ -1,3 +1,13 @@
|
||||||
|
2009-08-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||||
|
|
||||||
|
PR fortran/41075
|
||||||
|
* io/io.h (enum format_token): Add FMT_STAR.
|
||||||
|
* io/format.c (format_lex): Add case for FMT_STAR.
|
||||||
|
(parse_format_list): Parse FMT_STAR and check for left paren
|
||||||
|
after. (next_format0): Modify helper function to check for
|
||||||
|
unimited format and return the repeated format node. Update
|
||||||
|
comments to clarify.
|
||||||
|
|
||||||
2009-08-15 Kai Tietz <kai.tietz@onevision.com>
|
2009-08-15 Kai Tietz <kai.tietz@onevision.com>
|
||||||
|
|
||||||
* intrinsics/string_intrinsics_inc.c (string_len_trim): Use
|
* intrinsics/string_intrinsics_inc.c (string_len_trim): Use
|
||||||
|
|
|
@ -313,6 +313,10 @@ format_lex (format_data *fmt)
|
||||||
|
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
|
case '*':
|
||||||
|
token = FMT_STAR;
|
||||||
|
break;
|
||||||
|
|
||||||
case '(':
|
case '(':
|
||||||
token = FMT_LPAREN;
|
token = FMT_LPAREN;
|
||||||
break;
|
break;
|
||||||
|
@ -595,6 +599,21 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok)
|
||||||
format_item_1:
|
format_item_1:
|
||||||
switch (t)
|
switch (t)
|
||||||
{
|
{
|
||||||
|
case FMT_STAR:
|
||||||
|
t = format_lex (fmt);
|
||||||
|
if (t != FMT_LPAREN)
|
||||||
|
{
|
||||||
|
fmt->error = "Left parenthesis required after '*'";
|
||||||
|
goto finished;
|
||||||
|
}
|
||||||
|
get_fnode (fmt, &head, &tail, FMT_LPAREN);
|
||||||
|
tail->repeat = -2; /* Signifies unlimited format. */
|
||||||
|
tail->u.child = parse_format_list (dtp, &saveit);
|
||||||
|
if (fmt->error != NULL)
|
||||||
|
goto finished;
|
||||||
|
|
||||||
|
goto between_desc;
|
||||||
|
|
||||||
case FMT_POSINT:
|
case FMT_POSINT:
|
||||||
repeat = fmt->value;
|
repeat = fmt->value;
|
||||||
|
|
||||||
|
@ -1252,8 +1271,23 @@ next_format0 (fnode * f)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Deal with a parenthesis node */
|
/* Deal with a parenthesis node with unlimited format. */
|
||||||
|
|
||||||
|
if (f->repeat == -2) /* -2 signifies unlimited. */
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
if (f->current == NULL)
|
||||||
|
f->current = f->u.child;
|
||||||
|
|
||||||
|
for (; f->current != NULL; f->current = f->current->next)
|
||||||
|
{
|
||||||
|
r = next_format0 (f->current);
|
||||||
|
if (r != NULL)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Deal with a parenthesis node with specific repeat count. */
|
||||||
for (; f->count < f->repeat; f->count++)
|
for (; f->count < f->repeat; f->count++)
|
||||||
{
|
{
|
||||||
if (f->current == NULL)
|
if (f->current == NULL)
|
||||||
|
|
|
@ -654,7 +654,7 @@ typedef enum
|
||||||
FMT_LPAREN, FMT_RPAREN, FMT_X, FMT_S, FMT_SS, FMT_SP, FMT_STRING,
|
FMT_LPAREN, FMT_RPAREN, FMT_X, FMT_S, FMT_SS, FMT_SP, FMT_STRING,
|
||||||
FMT_BADSTRING, FMT_P, FMT_I, FMT_B, FMT_BN, FMT_BZ, FMT_O, FMT_Z, FMT_F,
|
FMT_BADSTRING, FMT_P, FMT_I, FMT_B, FMT_BN, FMT_BZ, FMT_O, FMT_Z, FMT_F,
|
||||||
FMT_E, FMT_EN, FMT_ES, FMT_G, FMT_L, FMT_A, FMT_D, FMT_H, FMT_END, FMT_DC,
|
FMT_E, FMT_EN, FMT_ES, FMT_G, FMT_L, FMT_A, FMT_D, FMT_H, FMT_END, FMT_DC,
|
||||||
FMT_DP
|
FMT_DP, FMT_STAR
|
||||||
}
|
}
|
||||||
format_token;
|
format_token;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue