@@ -460,7 +460,7 @@ TYPE_PARSER(construct<ComponentAttrSpec>(accessSpec) ||
460460 construct<ComponentAttrSpec>(allocatable) ||
461461 construct<ComponentAttrSpec>(" CODIMENSION" >> coarraySpec) ||
462462 construct<ComponentAttrSpec>(contiguous) ||
463- construct<ComponentAttrSpec>(" DIMENSION" >> Parser<ComponentArraySpec>{} ) ||
463+ construct<ComponentAttrSpec>(" DIMENSION" >> componentArraySpec ) ||
464464 construct<ComponentAttrSpec>(pointer) ||
465465 extension<LanguageFeature::CUDA>(
466466 construct<ComponentAttrSpec>(Parser<common::CUDADataAttr>{})) ||
@@ -471,17 +471,23 @@ TYPE_PARSER(construct<ComponentAttrSpec>(accessSpec) ||
471471
472472// R739 component-decl ->
473473// component-name [( component-array-spec )]
474- // [lbracket coarray-spec rbracket] [* char-length]
475- // [component-initialization]
474+ // [lbracket coarray-spec rbracket] [* char-length]
475+ // [component-initialization] |
476+ // (ext.) component-name *char-length [(component-array-spec)]
477+ // [lbracket coarray-spec rbracket] [* char-length]
478+ // [component-initialization]
476479TYPE_CONTEXT_PARSER(" component declaration" _en_US,
477- construct<ComponentDecl>(name, maybe(Parser<ComponentArraySpec>{}),
478- maybe(coarraySpec), maybe(" *" >> charLength), maybe(initialization)))
480+ construct<ComponentDecl>(name, " *" >> charLength, maybe(componentArraySpec),
481+ maybe(coarraySpec), maybe(initialization)) ||
482+ construct<ComponentDecl>(name, maybe(componentArraySpec),
483+ maybe(coarraySpec), maybe(" *" >> charLength),
484+ maybe(initialization)))
479485// The source field of the Name will be replaced with a distinct generated name.
480486TYPE_CONTEXT_PARSER(" %FILL item" _en_US,
481487 extension<LanguageFeature::DECStructures>(
482488 " nonstandard usage: %FILL" _port_en_US,
483489 construct<FillDecl>(space >> sourced (" %FILL" >> construct<Name>()),
484- maybe(Parser<ComponentArraySpec>{} ), maybe(" *" >> charLength))))
490+ maybe(componentArraySpec ), maybe(" *" >> charLength))))
485491TYPE_PARSER(construct<ComponentOrFill>(Parser<ComponentDecl>{}) ||
486492 construct<ComponentOrFill>(Parser<FillDecl>{}))
487493
@@ -658,9 +664,13 @@ TYPE_PARSER(recovery("END ENUM"_tok, constructEndStmtErrorRecovery) >>
658664
659665// R801 type-declaration-stmt ->
660666// declaration-type-spec [[, attr-spec]... ::] entity-decl-list
661- constexpr auto entityDeclWithoutEqInit{construct<EntityDecl>(name,
662- maybe (arraySpec), maybe (coarraySpec), maybe (" *" >> charLength),
663- !" =" _tok >> maybe (initialization))}; // old-style REAL A/0/ still works
667+ constexpr auto entityDeclWithoutEqInit{
668+ construct<EntityDecl>(name, " *" >> charLength, maybe (arraySpec),
669+ maybe (coarraySpec), !" =" _tok >> maybe (initialization)) ||
670+ construct<EntityDecl>(name, maybe (arraySpec), maybe (coarraySpec),
671+ maybe (" *" >> charLength),
672+ !" =" _tok >>
673+ maybe (initialization) /* old-style REAL A/0/ still works */ )};
664674TYPE_PARSER (
665675 construct<TypeDeclarationStmt>(declarationTypeSpec,
666676 defaulted (" ," >> nonemptyList (Parser<AttrSpec>{})) / "::",
@@ -720,9 +730,13 @@ constexpr auto objectName{name};
720730// R803 entity-decl ->
721731// object-name [( array-spec )] [lbracket coarray-spec rbracket]
722732// [* char-length] [initialization] |
723- // function-name [* char-length]
724- TYPE_PARSER (construct<EntityDecl>(objectName, maybe(arraySpec),
725- maybe(coarraySpec), maybe(" *" >> charLength), maybe(initialization)))
733+ // function-name [* char-length] |
734+ // (ext.) object-name *char-length [(array-spec)]
735+ // [lbracket coarray-spec rbracket] [initialization]
736+ TYPE_PARSER (construct<EntityDecl>(objectName, " *" >> charLength,
737+ maybe (arraySpec), maybe(coarraySpec), maybe(initialization)) ||
738+ construct<EntityDecl>(objectName, maybe(arraySpec), maybe(coarraySpec),
739+ maybe(" *" >> charLength), maybe(initialization)))
726740
727741// R806 null-init -> function-reference ... which must resolve to NULL()
728742TYPE_PARSER(lookAhead(name / " ( )" ) >> construct<NullInit>(expr))
0 commit comments