From 3e86eda18c3781ab63fbe47eb48bf931a8af4a48 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Wed, 7 Oct 2020 16:07:10 -0700 Subject: [PATCH] [flang] Allow "name: value" in compiler directives Some legacy compiler directives use colons rather than equals signs. Differential revision: https://reviews.llvm.org/D89017 --- flang/lib/Parser/Fortran-parsers.cpp | 10 +++++----- flang/test/Parser/compiler-directives.f90 | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/flang/lib/Parser/Fortran-parsers.cpp b/flang/lib/Parser/Fortran-parsers.cpp index 19b1893..4bb45fc 100644 --- a/flang/lib/Parser/Fortran-parsers.cpp +++ b/flang/lib/Parser/Fortran-parsers.cpp @@ -1172,11 +1172,11 @@ constexpr auto endDirective{space >> endOfLine}; constexpr auto ignore_tkr{ "DIR$ IGNORE_TKR" >> optionalList(construct( defaulted(parenthesized(some("tkr"_ch))), name))}; -TYPE_PARSER( - beginDirective >> sourced(construct(ignore_tkr) || - construct("DIR$" >> - many(construct( - name, maybe("=" >> digitString64))))) / +TYPE_PARSER(beginDirective >> + sourced(construct(ignore_tkr) || + construct( + "DIR$" >> many(construct(name, + maybe(("="_tok || ":"_tok) >> digitString64))))) / endDirective) TYPE_PARSER(extension(construct( diff --git a/flang/test/Parser/compiler-directives.f90 b/flang/test/Parser/compiler-directives.f90 index c916b16..f29d6fe 100644 --- a/flang/test/Parser/compiler-directives.f90 +++ b/flang/test/Parser/compiler-directives.f90 @@ -9,4 +9,8 @@ module m !dir$ integer implicit integer(a-z) !dir$ integer + !dir$ integer=64 + !dir$ integer = 64 + !dir$ optimize:1 + !dir$ optimize : 1 end -- 2.7.4