[flang] Allow explicit '+' in NAMELIST input subscripts
Array subscripts and substring limits in NAMELIST input are allowed to bear an explicit plus sign. Differential Revision: https://reviews.llvm.org/D117818
This commit is contained in:
parent
cfae2c65db
commit
922c29ccf1
|
@ -99,7 +99,7 @@ static std::optional<SubscriptValue> GetSubscriptValue(IoStatementState &io) {
|
|||
std::optional<SubscriptValue> value;
|
||||
std::optional<char32_t> ch{io.GetCurrentChar()};
|
||||
bool negate{ch && *ch == '-'};
|
||||
if (negate) {
|
||||
if ((ch && *ch == '+') || negate) {
|
||||
io.HandleRelativePosition(1);
|
||||
ch = io.GetCurrentChar();
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ TEST(NamelistTests, Subscripts) {
|
|||
aDesc->GetDimension(1).SetBounds(-1, 1);
|
||||
const NamelistGroup::Item items[]{{"a", *aDesc}};
|
||||
const NamelistGroup group{"justa", 1, items};
|
||||
static char t1[]{"&justa A(0,1:-1:-2)=1 2/"};
|
||||
static char t1[]{"&justa A(0,+1:-1:-2)=1 2/"};
|
||||
StaticDescriptor<1, true> statDesc;
|
||||
Descriptor &internalDesc{statDesc.descriptor()};
|
||||
internalDesc.Establish(TypeCode{CFI_type_char},
|
||||
|
@ -223,7 +223,7 @@ TEST(NamelistTypes, ArraySubstring) {
|
|||
std::vector<std::string>{"abcdefgh", "ijklmnop"}, 8)};
|
||||
const NamelistGroup::Item items[]{{"a", *scDesc}};
|
||||
const NamelistGroup group{"justa", 1, items};
|
||||
static char t1[]{"&justa A(:)(2:5)='BCDE' 'JKLM'/"};
|
||||
static char t1[]{"&justa A(:)(2:+5)='BCDE' 'JKLM'/"};
|
||||
StaticDescriptor<1, true> statDesc;
|
||||
Descriptor &internalDesc{statDesc.descriptor()};
|
||||
internalDesc.Establish(TypeCode{CFI_type_char},
|
||||
|
|
Loading…
Reference in a new issue