[flang] Change parsing of ambiguous array-spec

An array-spec like `(:,:)` (with one or more colons) is either a
deferred-shape-spec-list or an assumed-shape-spec-list and they
can only be distinguished by context that the parser doesn't have.

We were parsing these as assumed-shape-spec-list but they are easier
to deal with if we parse them as deferred-shape-spec-list because
anything that is the latter is also one of the former.

Original-commit: flang-compiler/f18@78c3f3b96f
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tree-same-pre-rewrite: false
This commit is contained in:
Tim Keith 2019-08-06 10:20:16 -07:00
parent 80678685a3
commit 73738d8bba
1 changed files with 1 additions and 1 deletions

View File

@ -1088,9 +1088,9 @@ TYPE_PARSER(construct<ExplicitCoshapeSpec>(
// a need for forced look-ahead. // a need for forced look-ahead.
TYPE_PARSER( TYPE_PARSER(
construct<ArraySpec>(parenthesized(nonemptyList(explicitShapeSpec))) || construct<ArraySpec>(parenthesized(nonemptyList(explicitShapeSpec))) ||
construct<ArraySpec>(parenthesized(deferredShapeSpecList)) ||
construct<ArraySpec>( construct<ArraySpec>(
parenthesized(nonemptyList(Parser<AssumedShapeSpec>{}))) || parenthesized(nonemptyList(Parser<AssumedShapeSpec>{}))) ||
construct<ArraySpec>(parenthesized(deferredShapeSpecList)) ||
construct<ArraySpec>(parenthesized(Parser<AssumedSizeSpec>{})) || construct<ArraySpec>(parenthesized(Parser<AssumedSizeSpec>{})) ||
construct<ArraySpec>(parenthesized(Parser<ImpliedShapeSpec>{})) || construct<ArraySpec>(parenthesized(Parser<ImpliedShapeSpec>{})) ||
construct<ArraySpec>(parenthesized(Parser<AssumedRankSpec>{}))) construct<ArraySpec>(parenthesized(Parser<AssumedRankSpec>{})))