Expose parseXInDimensionList() to the `DialectAsmParser`

This allows custom types and attribute to parse a dimension list that
isn't necessarily terminated with `xtype`, for example something like:

#tf.shape<4x5>

Differential Revision: https://reviews.llvm.org/D100432
This commit is contained in:
Mehdi Amini 2021-04-14 01:25:07 +00:00
parent 00c8be3f93
commit 597207a3c3
2 changed files with 9 additions and 0 deletions

View File

@ -361,6 +361,11 @@ public:
/// static-dimension-list ::= (integer `x`)*
virtual ParseResult parseDimensionList(SmallVectorImpl<int64_t> &dimensions,
bool allowDynamic = true) = 0;
/// Parse an 'x' token in a dimension list, handling the case where the x is
/// juxtaposed with an element type, as in "xf32", leaving the "f32" as the
/// next token.
virtual ParseResult parseXInDimensionList() = 0;
};
} // end namespace mlir

View File

@ -308,6 +308,10 @@ public:
return parser.parseDimensionListRanked(dimensions, allowDynamic);
}
ParseResult parseXInDimensionList() override {
return parser.parseXInDimensionList();
}
OptionalParseResult parseOptionalType(Type &result) override {
return parser.parseOptionalType(result);
}