flang-compiler / f18

F18 is a front-end for Fortran intended to replace the existing front-end in the Flang compiler
230 stars 48 forks source link

Fix parsing bug on DATA statement #1012

Closed tskeith closed 4 years ago

tskeith commented 4 years ago

This DATA statement was getting a parsing error: data x /a(i)%b/

The parser was expecting the ending '/' where the '%' was. The problem was parsing a(i) as a structure constructor. Instead, move the constant subobject case before structure constructor, but match it only if not followed by '('. That is because in data x /a(1)(2)/, a(1) is a valid structure constructor.

Also, remove the NamedConstant alternative from DataStmtRepeat. A named constant is always parsed as a ConstantSubobject so it can never occur.