From 070d9082231a2cac416cf10010ddd7342162ce4a Mon Sep 17 00:00:00 2001 From: peter klausler Date: Mon, 9 Apr 2018 12:53:11 -0700 Subject: [PATCH] [flang] Tweak recent disambiguations after more testing. Original-commit: flang-compiler/f18@82fb9838b98da2215513477f83657058aca515d1 Reviewed-on: https://github.com/flang-compiler/f18/pull/48 Tree-same-pre-rewrite: false --- flang/lib/parser/grammar.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/flang/lib/parser/grammar.h b/flang/lib/parser/grammar.h index 274c65f..d1e92cd 100644 --- a/flang/lib/parser/grammar.h +++ b/flang/lib/parser/grammar.h @@ -1037,14 +1037,16 @@ TYPE_PARSER(construct{}( TYPE_PARSER(construct{}(maybe(keyword / "="), typeParamValue)) // R756 structure-constructor -> derived-type-spec ( [component-spec-list] ) -TYPE_PARSER(construct{}(derivedTypeSpec, - parenthesized(optionalList(Parser{}))) || - // This alternative corrects misrecognition of the component-spec-list as - // the type-param-spec-list in derived-type-spec. - construct{}( - construct{}( - name, construct>{}), - parenthesized(optionalList(Parser{})))) +TYPE_PARSER((construct{}(derivedTypeSpec, + parenthesized(optionalList(Parser{}))) || + // This alternative corrects misrecognition of the + // component-spec-list as the type-param-spec-list in + // derived-type-spec. + construct{}( + construct{}( + name, construct>{}), + parenthesized(optionalList(Parser{})))) / + !"("_tok) // R757 component-spec -> [keyword =] component-data-source TYPE_PARSER(construct{}( @@ -1175,7 +1177,7 @@ TYPE_PARSER(construct{}(objectName, maybe(arraySpec), // R806 null-init -> function-reference // TODO: confirm in semantics that NULL still intrinsic in this scope -TYPE_PARSER("NULL ( )" >> construct{}) +TYPE_PARSER("NULL ( )" >> construct{} / !"("_tok) // R807 access-spec -> PUBLIC | PRIVATE TYPE_PARSER( @@ -1351,14 +1353,16 @@ TYPE_PARSER(construct{}(intLiteralConstant) || // scalar-constant | scalar-constant-subobject | // signed-int-literal-constant | signed-real-literal-constant | // null-init | initial-data-target | structure-constructor -TYPE_PARSER(construct{}(Parser{}) || - construct{}(scalar(Parser{})) || +// TODO: Some structure constructors can be misrecognized as array +// references into constant subobjects. +TYPE_PARSER(construct{}(scalar(Parser{})) || + construct{}(nullInit) || + construct{}(Parser{}) || construct{}(scalar(constantSubobject)) || construct{}(signedRealLiteralConstant) || construct{}(signedIntLiteralConstant) || extension(construct{}( Parser{})) || - construct{}(nullInit) || construct{}(initialDataTarget)) // R848 dimension-stmt -> -- 2.7.4