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

(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
https://dev.eclipse.org/mailman/listinfo/photran


Back to the top