#16 pFUnitParser.py has trouble with some test subroutine definitions

v2.x
closed-fixed
None
5
2014-07-14
2013-12-26
No

pFUnitParser.py assumes that empty subroutine argument lists have parentheses:

@Test
subroutine foo()

However, it is legal in Fortran to omit the parentheses in this case. So the following should be equivalent to the above, but pFUnitParser.py can't handle it:

@Test
subroutine foo

(Note that the parentheses are mandatory for functions, but optional for subroutines that have no argument list; this is true for both definitions and procedure calls.)

Discussion

  • Tom Clune

    Tom Clune - 2013-12-30

    I agree that the standard permits the omission of () in these very limited circumstances, and it should be easy enough to correct the preprocessor to allow it.

    To some extent this reflects my personal distaste for omitting the (). Consistency of style without loss of generality and all that. Also note, there are many other standard ways of declaring a subroutine that are not (and will not be supported). E.g.,

    subroutine &
    & foo

    (And let's not even go down the fixed-format path …)

    Cheers,

    • Tom
     
  • Sean Patrick Santos

    Actually, that reminds me of something that might be more important in the long run. I had a user omit the parens, but that wasn't the problem so much as the fact that the result was a generic "NoneType has no attribute x" python error. The only thing that saved us from really having to dive into the python script was a lucky guess on my part.

    Anyway, the point is that if the line following @Test is not recognized as a subroutine declaration, the script should probably throw an exception with a message to that effect. That, way when someone inevitably does do something like put a line continuation in a weird place...

     
    • Tom Clune

      Tom Clune - 2013-12-30

      On Dec 30, 2013, at 11:39 AM, Sean Patrick Santos quantheory@users.sf.net wrote:

      Actually, that reminds me of something that might be more important in the long run. I had a user omit the parens, but that wasn't the problem so much as the fact that the result was a generic "NoneType has no attribute x" python error. The only thing that saved us from really having to dive into the python script was a lucky guess on my part.

      Anyway, the point is that if the line following @Test is not recognized as a subroutine declaration, the script should probably throw an exception with a message to that effect. That, way when someone inevitably does do something like put a line continuation in a weird place...

      I definitely agree that an exception should be thrown. I'll try to do that today. I was going to also allow blank lines and comments, so seems a good time to look at that bit of logic.

      • Tom

      [bugs:#16] pFUnitParser.py has trouble with some test subroutine definitions

      Status: open
      Created: Thu Dec 26, 2013 08:31 PM UTC by Sean Patrick Santos
      Last Updated: Mon Dec 30, 2013 02:42 PM UTC
      Owner: nobody

      pFUnitParser.py assumes that empty subroutine argument lists have parentheses:

      @Test
      subroutine foo()

      However, it is legal in Fortran to omit the parentheses in this case. So the following should be equivalent to the above, but pFUnitParser.py can't handle it:

      @Test
      subroutine foo

      (Note that the parentheses are mandatory for functions, but optional for subroutines that have no argument list; this is true for both definitions and procedure calls.)

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/pfunit/bugs/16/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

      Thomas Clune, Ph. D. Thomas.L.Clune@nasa.gov
      Chief, Software Systems Support Office Code 610.3
      NASA GSFC 301-286-4635
      MS 610.8 B33-C128 http://ssso.gsfc.nasa.gov
      Greenbelt, MD 20771

       
  • Tom Clune

    Tom Clune - 2013-12-30
    • status: open --> closed-fixed
    • assigned_to: Tom Clune
     
  • Tom Clune

    Tom Clune - 2013-12-30

    I have extended the parser to accept "no-parens" test procedures.

    Also has more ability to ignore user comments. (More testing is needed for this though.)

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks