diff options
author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-17 14:27:29 +0000 |
---|---|---|
committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-17 14:27:29 +0000 |
commit | 9bda71487a9be465010d1dc0e68b35e074186b92 (patch) | |
tree | e4baebb01b801215d43ed14855d9d8b7c3a6a102 /libgfortran | |
parent | 4f2763e22c52f905dd42a77a98845c5e4612f549 (diff) | |
download | gcc-9bda71487a9be465010d1dc0e68b35e074186b92.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150844 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 10 | ||||
-rw-r--r-- | libgfortran/io/format.c | 36 | ||||
-rw-r--r-- | libgfortran/io/io.h | 2 |
3 files changed, 46 insertions, 2 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index f441049f036..abeac8a9525 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -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> * intrinsics/string_intrinsics_inc.c (string_len_trim): Use diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c index e40adb9b2a1..e888a2eba3f 100644 --- a/libgfortran/io/format.c +++ b/libgfortran/io/format.c @@ -313,6 +313,10 @@ format_lex (format_data *fmt) switch (c) { + case '*': + token = FMT_STAR; + break; + case '(': token = FMT_LPAREN; break; @@ -595,6 +599,21 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok) format_item_1: 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: repeat = fmt->value; @@ -1252,8 +1271,23 @@ next_format0 (fnode * f) 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++) { if (f->current == NULL) diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index 2a077629a6d..9ca6d387480 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -654,7 +654,7 @@ typedef enum 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_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; |