#88 parser java exception on format string

rejects-valid
closed-fixed
lexer (27)
5
2014-08-16
2011-09-23
Jean Utke
No

The attached example fails with:
> openFortranParser --verbose form1.f90
*******************************************
args[1]: form1.f90
R -2:start-of-file: filename=form1.f90 path=/sandbox/Argonne/hg/ForTests/OFP_tests/form1.f90
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 235
at java.lang.String.charAt(String.java:694)
at fortran.ofp.parser.java.FortranLexicalPrepass.getCharString(FortranLexicalPrepass.java:1477)
at fortran.ofp.parser.java.FortranLexicalPrepass.getCharStringEditDesc(FortranLexicalPrepass.java:1522)
at fortran.ofp.parser.java.FortranLexicalPrepass.parseFormatString(FortranLexicalPrepass.java:1539)
at fortran.ofp.parser.java.FortranLexicalPrepass.parseFormatString(FortranLexicalPrepass.java:1651)
at fortran.ofp.parser.java.FortranLexicalPrepass.fixupFormatStmt(FortranLexicalPrepass.java:1785)
at fortran.ofp.parser.java.FortranLexicalPrepass.matchIOStmt(FortranLexicalPrepass.java:1869)
at fortran.ofp.parser.java.FortranLexicalPrepass.matchLine(FortranLexicalPrepass.java:2517)
at fortran.ofp.parser.java.FortranLexicalPrepass.performPrepass(FortranLexicalPrepass.java:2774)
at fortran.ofp.FrontEnd.call(FrontEnd.java:339)
at fortran.ofp.FrontEnd.main(FrontEnd.java:299)

tested on:
commit b7386ffa41c941201ad75a5f51f17f8495fde33f
Author: rasmussn <rasmussn@y-128-165-148-117.lanl.gov>
Date: Wed Sep 14 16:47:21 2011 -0600

Discussion

  • Jean Utke
    Jean Utke
    2011-09-23

    test example producing the exception

     
    Attachments
    • assigned_to: nobody --> rasmussn
     
    • labels: --> lexer
    • milestone: --> rejects-valid
    • status: open --> closed-fixed
     
  • Fixed getCharString in FortranLexicalPrepass.java to treat the second character in consecutive quote chars as the start of a new string.