Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [photran] Syntax Error - Unable to recognize '*' in column 1 as comment

Hi,

well, it looks like you are talking about different things. Berhards code is Fortran 77 fixed form.

Daniel is talking about Fortran 90 or newer free form.

Maybe this helps a bit ...

Cheerio,
Luis

On 08/01/2013 14:26, Scholz, Bernhard (GE Global Research) wrote:
Thanks Daniel for getting back to me. I goofed on my question. I meant
to ask why an asterisk in column 1 was not recognized as a start of a
comment and instead flagged as an error.

The “Writing Code” section of the Photran User’s Guide

(http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.photran.doc.user%2Fhtml%2Fbasic%2FWritingCode.html&cp=50_1_3)

implies  that asterisks can also be used in column 1 to mark a comment:

Photran supports both fixed-form and free-form Fortran code. Photran
also supports C preprocessor directives, such as #define, #ifdef,
#include, __FILE__, and __LINE__ in Fortran code.

/Fixed form is an older form designed for punch cards. It is more common
in Fortran 77 and earlier programs, although it is still part of Fortran
2003. In fixed form, a "c", "C", "*", or "!" in column 1 indicates a
comment; columns 1 through 5 are used for a statement label; a character
in column 6 indicates a continuation line; and program statements are
contained in columns 7 through 72. Anything after column 72 is ignored. /

The Intel compiler I am using seems OK with it.

I also noticed that Photran seems unhappy with a “&” character used in
column 6 as a continuation line. Actually it does not seem to like any
character as a continuation character in column 6.

--Bernie

*From:*photran-bounces@xxxxxxxxxxx [mailto:photran-bounces@xxxxxxxxxxx]
*On Behalf Of *Daniel Harenberg
*Sent:* Tuesday, January 08, 2013 2:55 AM
*To:* Photran Information
*Subject:* Re: [photran] Syntax Error - Unable to recognize '*' in
column 1 as comment

(snip)

 > Why isn’t an asterisk (‘*’) in column 1 not recognized as an error?

(snip)

I might not get your question right, but it IS recognized as an error by
the syntax parser (just as you correctly point out). The star * is not
valid, so it complains with 'Unexpected *'. When you add the exclamation
mark, it becomes a comment, and the error disappears. So all seems to
work fine, and I do not quite get what your question is.

I'll try some further comments that might help:
- Exclamation mark ('!') is the only Fortran 90/95 comment symbol,
though the Fortran 77 symbol 'C' continues to be supported. 'C' can only
appear in the first column, '!' can appear anywhere.
- The syntax parser is part of Photran, not of the compiler. If you'd
try to compile your code snippet without exclamation marks, the compiler
would throw an error and abort compilation. With the exclamation marks
it would compile fine.

Regarding your second question
(snip)

 > Is this something I can change in the configuration?

(snip)
Again I am not sure I get your question, but I'll try an answer: Since
comment symbols are part of the (official) Fortran Standard, they can't
be changed.


Hope that helps.

Best

Daniel

On 01/07/2013 10:34 PM, Scholz, Bernhard (GE Global Research) wrote:

    Folks,

    I’m brand-new to using Photran and I seem to have a problem right
    off the bat. It seems that the syntax parser does not like the
    format of comments in my code.

    A sample snippet is as follows:

    **********************************************************************

    *      Copyright 2013                                                *

    **********************************************************************

    *

           program bernie

           implicit none

           print *,'Hello World'

           end program Bernie

    In the “Outline” window I see a Syntax Exception listed. The Text of
    the exception is:

    SyntaxException: Syntax error: Unexpected * (/Ez5_code/bl/bernie.f,
    line 2, column 1).  Expected one of the following: block, close,
    contains, abstract, class, identifier, return, interface, call, end
    of statement, go, print, subroutine, stop, allocatable, end,
    private, doubleprecision, all, implicit, if, end of input,
    dimension, goto, write, data, submodule, where, recursive,
    blockdata, select, allstop, codimension, import, use, intent, pause,
    backspace, endfile, selectcase, open, associate, elemental,
    character, nullify, rewind, bind, do, pointer, syncall, program,
    syncimages, syncmemory, wait, unlock, optional, double, module,
    read, allocate, equivalence, integer, entry, real, cycle, procedure,
    pure, integer constant, lock, intrinsic, format, namelist,
    asynchronous, critical, value, logical, forall, save, sync, inquire,
    assign, external, volatile, complex, protected, common, endprogram,
    public, enddo, contiguous, impure, enum, parameter, target,
    doublecomplex, type, deallocate, function, continue, exit

    When I add an exclamation point as the first character fir the first
    4 lines th syntax error disappears:

    !**********************************************************************

    !*      Copyright 2013                                                *

    !**********************************************************************

    !*

           program bernie

           implicit none

           print *,'Hello World'

           end program Bernie

    Why isn’t an asterisk (‘*’) in column 1 not recognized as an error?
    Is this something I can change in the configuration?

    Thanks!

    --Bernie Scholz




    _______________________________________________

    photran mailing list

    photran@xxxxxxxxxxx  <mailto:photran@xxxxxxxxxxx>

    https://dev.eclipse.org/mailman/listinfo/photran



_______________________________________________
photran mailing list
photran@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/photran



--
                             \\\\\\
                             (-0^0-)
--------------------------oOO--(_)--OOo-----------------------------

 Luis Kornblueh                           Tel. : +49-40-41173289
 Max-Planck-Institute for Meteorology     Fax. : +49-40-41173298
 Bundesstr. 53
 D-20146 Hamburg                   Email: luis.kornblueh@xxxxxxx
 Federal Republic of Germany

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Back to the top