@@ -460,7 +460,7 @@ TYPE_PARSER(construct<ComponentAttrSpec>(accessSpec) ||
460
460
construct<ComponentAttrSpec>(allocatable) ||
461
461
construct<ComponentAttrSpec>(" CODIMENSION" >> coarraySpec) ||
462
462
construct<ComponentAttrSpec>(contiguous) ||
463
- construct<ComponentAttrSpec>(" DIMENSION" >> Parser<ComponentArraySpec>{} ) ||
463
+ construct<ComponentAttrSpec>(" DIMENSION" >> componentArraySpec ) ||
464
464
construct<ComponentAttrSpec>(pointer) ||
465
465
extension<LanguageFeature::CUDA>(
466
466
construct<ComponentAttrSpec>(Parser<common::CUDADataAttr>{})) ||
@@ -471,17 +471,23 @@ TYPE_PARSER(construct<ComponentAttrSpec>(accessSpec) ||
471
471
472
472
// R739 component-decl ->
473
473
// 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]
476
479
TYPE_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)))
479
485
// The source field of the Name will be replaced with a distinct generated name.
480
486
TYPE_CONTEXT_PARSER(" %FILL item" _en_US,
481
487
extension<LanguageFeature::DECStructures>(
482
488
" nonstandard usage: %FILL" _port_en_US,
483
489
construct<FillDecl>(space >> sourced (" %FILL" >> construct<Name>()),
484
- maybe(Parser<ComponentArraySpec>{} ), maybe(" *" >> charLength))))
490
+ maybe(componentArraySpec ), maybe(" *" >> charLength))))
485
491
TYPE_PARSER(construct<ComponentOrFill>(Parser<ComponentDecl>{}) ||
486
492
construct<ComponentOrFill>(Parser<FillDecl>{}))
487
493
@@ -658,9 +664,13 @@ TYPE_PARSER(recovery("END ENUM"_tok, constructEndStmtErrorRecovery) >>
658
664
659
665
// R801 type-declaration-stmt ->
660
666
// 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 */ )};
664
674
TYPE_PARSER (
665
675
construct<TypeDeclarationStmt>(declarationTypeSpec,
666
676
defaulted (" ," >> nonemptyList (Parser<AttrSpec>{})) / "::",
@@ -720,9 +730,13 @@ constexpr auto objectName{name};
720
730
// R803 entity-decl ->
721
731
// object-name [( array-spec )] [lbracket coarray-spec rbracket]
722
732
// [* 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)))
726
740
727
741
// R806 null-init -> function-reference ... which must resolve to NULL()
728
742
TYPE_PARSER(lookAhead(name / " ( )" ) >> construct<NullInit>(expr))
0 commit comments