Code Comments
Programming Forum and web based access to our favorite programming groups.Dear all, A month or so ago, I posted to c.l.f asking about tips for writing a Fortran lexer/parser. Many thanks to all those who gave me pointers; I've made a start on the project, and I'm currently working on the code for dealing with contination lines. I've run into a little difficulty understanding how statement continuation interacts with statement termination via semicolons. Consider the following two lines of free-form code: print *,'foo'; & print *,'bar' Is this code leagal? Both the Intel and Compaq compilers complain, with the same error message: Warning: test_continuation.f90, line 3: Continuation character illegal as first non_blank in statement Now, from my reading of the standard(1), there is nothing which prohibits a statement terminator from being followed by blanks and then a continuation character. In fact, the only restriction I can find on the use of semicolons is in Section 3.3.1.3: 'A ";" shall not appear as the first nonblank character on a line.' -- clearly not the case in the code I give above. I'd appreciate any input on this matter. cheers, Rich (1) I've got a draft copy of the F2003 standard; I'm assuming that -- apart from the increase in the maximal number of continuation lines -- the specification for free-form source is the same as in F90/F95. -- Dr Richard H D Townsend Bartol Research Institute University of Delaware [ Delete VOID for valid email address ]
Post Follow-up to this messageRich Townsend wrote: ... > Consider the following two lines of free-form code: > > print *,'foo'; & > print *,'bar' > > Is this code leagal? Both the Intel and Compaq compilers complain, with > the same error message: > > Warning: test_continuation.f90, line 3: Continuation character illegal > as first non_blank in statement Well, §3.3.1.3 of the F95 standard says that the & is used to continue the current statement. Well, it could be argued that there is no current statement at the point where your & appears here. The only statement on that line has certainly been terminated already by the preceeding semicolon. I think this may be a bit too pedantic, but it could be the logic they applied. -- J. Giles "I conclude that there are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies." -- C. A. R. Hoare
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.