|
MLIR 24.0.0git
|
This class provides the implementation of the generic parser methods within AsmParser. More...
#include "AsmParser/AsmParserImpl.h"
Public Types | |
| using | Delimiter = AsmParser::Delimiter |
Public Member Functions | |
| AsmParserImpl (SMLoc nameLoc, Parser &parser) | |
| ~AsmParserImpl () override=default | |
| SMLoc | getNameLoc () const override |
| Return the location of the original name token. | |
| bool | didEmitError () const |
| Return if any errors were emitted during parsing. | |
| InFlightDiagnostic | emitError (SMLoc loc, const Twine &message) override |
| Emit a diagnostic at the specified location and return failure. | |
| Builder & | getBuilder () const override |
| Return a builder which provides useful access to MLIRContext, global objects like types and attributes. | |
| SMLoc | getCurrentLocation () override |
| Get the location of the next token and store it into the argument. | |
| Location | getEncodedSourceLoc (SMLoc loc) override |
| Re-encode the given source location as an MLIR location and return it. | |
| ParseResult | parseArrow () override |
| Parse a -> token. | |
| ParseResult | parseOptionalArrow () override |
| Parses a -> if present. | |
| ParseResult | parseLBrace () override |
| Parse a '{' token. | |
| ParseResult | parseOptionalLBrace () override |
| Parse a '{' token if present. | |
| ParseResult | parseRBrace () override |
| Parse a } token. | |
| ParseResult | parseOptionalRBrace () override |
| Parse a } token if present. | |
| ParseResult | parseColon () override |
| Parse a : token. | |
| ParseResult | parseOptionalColon () override |
| Parse a : token if present. | |
| ParseResult | parseComma () override |
| Parse a , token. | |
| ParseResult | parseOptionalComma () override |
| Parse a , token if present. | |
| ParseResult | parseEllipsis () override |
| Parses a .... | |
| ParseResult | parseOptionalEllipsis () override |
| Parses a ... if present. | |
| ParseResult | parseEqual () override |
| Parse a = token. | |
| ParseResult | parseOptionalEqual () override |
| Parse a = token if present. | |
| ParseResult | parseLess () override |
| Parse a '<' token. | |
| ParseResult | parseOptionalLess () override |
| Parse a < token if present. | |
| ParseResult | parseGreater () override |
| Parse a '>' token. | |
| ParseResult | parseOptionalGreater () override |
| Parse a > token if present. | |
| ParseResult | parseLParen () override |
| Parse a ( token. | |
| ParseResult | parseOptionalLParen () override |
| Parses a '(' if present. | |
| ParseResult | parseRParen () override |
| Parse a ) token. | |
| ParseResult | parseOptionalRParen () override |
| Parses a ')' if present. | |
| ParseResult | parseLSquare () override |
| Parse a [ token. | |
| ParseResult | parseOptionalLSquare () override |
| Parses a '[' if present. | |
| ParseResult | parseRSquare () override |
| Parse a ] token. | |
| ParseResult | parseOptionalRSquare () override |
| Parses a ']' if present. | |
| ParseResult | parseQuestion () override |
| Parses a '?' token. | |
| ParseResult | parseOptionalQuestion () override |
| Parses a '?' if present. | |
| ParseResult | parseSlash () override |
| Parses a '/' token. | |
| ParseResult | parseOptionalSlash () override |
| Parses a '/' if present. | |
| ParseResult | parseStar () override |
| Parses a '*' token. | |
| ParseResult | parseOptionalStar () override |
| Parses a '*' if present. | |
| ParseResult | parsePlus () override |
| Parses a '+' token. | |
| ParseResult | parseOptionalPlus () override |
| Parses a '+' token if present. | |
| ParseResult | parseMinus () override |
| Parses a '-' token. | |
| ParseResult | parseOptionalMinus () override |
| Parses a '-' token if present. | |
| ParseResult | parseVerticalBar () override |
| Parse a '|' token. | |
| ParseResult | parseOptionalVerticalBar () override |
| Parse a '|' token if present. | |
| ParseResult | parseOptionalString (std::string *string) override |
| Parses a quoted string token if present. | |
| ParseResult | parseBase64Bytes (std::vector< char > *bytes) override |
| Parses a Base64 encoded string of bytes. | |
| ParseResult | parseFloat (const llvm::fltSemantics &semantics, APFloat &result) override |
| Parse a floating point value with given semantics from the stream. | |
| ParseResult | parseFloat (double &result) override |
| Parse a floating point value from the stream. | |
| OptionalParseResult | parseOptionalInteger (APInt &result) override |
| Parse an optional integer value from the stream. | |
| OptionalParseResult | parseOptionalDecimalInteger (APInt &result) override |
| Parse an optional integer value from the stream. | |
| ParseResult | parseCommaSeparatedList (Delimiter delimiter, function_ref< ParseResult()> parseElt, StringRef contextMessage) override |
| Parse a list of comma-separated items with an optional delimiter. | |
| ParseResult | parseKeyword (StringRef keyword, const Twine &msg) override |
| ParseResult | parseOptionalKeyword (StringRef keyword) override |
| Parse the given keyword if present. | |
| ParseResult | parseOptionalKeyword (StringRef *keyword) override |
| Parse a keyword, if present, into 'keyword'. | |
| ParseResult | parseOptionalKeyword (StringRef *keyword, ArrayRef< StringRef > allowedKeywords) override |
| Parse a keyword if it is one of the 'allowedKeywords'. | |
| ParseResult | parseOptionalString (std::string *result, ArrayRef< StringRef > allowedKeywords) override |
| Parse a string if it is one of the 'allowedKeywords'. | |
| ParseResult | parseOptionalKeywordOrString (std::string *result) override |
| Parse an optional keyword or string and set instance into 'result'.`. | |
| ParseResult | parseOptionalKeywordOrString (std::string *result, ArrayRef< StringRef > allowedValues) override |
| ParseResult | parseAttribute (Attribute &result, Type type) override |
| Parse an arbitrary attribute and return it in result. | |
| ParseResult | parseCustomAttributeWithFallback (Attribute &result, Type type, function_ref< ParseResult(Attribute &result, Type type)> parseAttribute) override |
| Parse a custom attribute with the provided callback, unless the next token is #, in which case the generic parser is invoked. | |
| ParseResult | parseCustomTypeWithFallback (Type &result, function_ref< ParseResult(Type &result)> parseType) override |
| Parse a custom attribute with the provided callback, unless the next token is #, in which case the generic parser is invoked. | |
| OptionalParseResult | parseOptionalAttribute (Attribute &result, Type type) override |
| OptionalParseResult | parseOptionalAttribute (ArrayAttr &result, Type type) override |
| OptionalParseResult | parseOptionalAttribute (StringAttr &result, Type type) override |
| OptionalParseResult | parseOptionalAttribute (SymbolRefAttr &result, Type type) override |
| ParseResult | parseOptionalAttrDict (NamedAttrList &result) override |
| Parse a named dictionary into 'result' if it is present. | |
| ParseResult | parseOptionalAttrDictWithKeyword (NamedAttrList &result) override |
| Parse a named dictionary into 'result' if the attributes keyword is present. | |
| ParseResult | parseAffineMap (AffineMap &map) override |
| Parse an affine map instance into 'map'. | |
| ParseResult | parseAffineExpr (ArrayRef< std::pair< StringRef, AffineExpr > > symbolSet, AffineExpr &expr) override |
| Parse an affine expr instance into 'expr' using the already computed mapping from symbols to affine expressions in 'symbolSet'. | |
| ParseResult | parseIntegerSet (IntegerSet &set) override |
| Parse an integer set instance into 'set'. | |
| ParseResult | parseOptionalSymbolName (StringAttr &result) override |
| Parse an optional -identifier and store it (without the '@' symbol) in a string attribute named 'attrName'. | |
| FailureOr< AsmDialectResourceHandle > | parseResourceHandle (Dialect *dialect) override |
| Parse a handle to a resource within the assembly format. | |
| ParseResult | parseType (Type &result) override |
| Parse a type. | |
| OptionalParseResult | parseOptionalType (Type &result) override |
| Parse an optional type. | |
| ParseResult | parseArrowTypeList (SmallVectorImpl< Type > &result) override |
| Parse an arrow followed by a type list. | |
| ParseResult | parseOptionalArrowTypeList (SmallVectorImpl< Type > &result) override |
| Parse an optional arrow followed by a type list. | |
| ParseResult | parseColonType (Type &result) override |
| Parse a colon followed by a type. | |
| ParseResult | parseColonTypeList (SmallVectorImpl< Type > &result) override |
| Parse a colon followed by a type list, which must have at least one type. | |
| ParseResult | parseOptionalColonTypeList (SmallVectorImpl< Type > &result) override |
| Parse an optional colon followed by a type list, which if present must have at least one type. | |
| ParseResult | parseDimensionList (SmallVectorImpl< int64_t > &dimensions, bool allowDynamic, bool withTrailingX) override |
| ParseResult | parseXInDimensionList () override |
| LogicalResult | pushCyclicParsing (const void *opaquePointer) override |
| void | popCyclicParsing () override |
| ParseResult | parseKeywordOrCompletion (StringRef *keyword) override |
| Parse a keyword, or an empty string if the current location signals a code completion. | |
| void | codeCompleteExpectedTokens (ArrayRef< StringRef > tokens) override |
| Signal the code completion of a set of expected tokens. | |
| ParseResult | parseKeyword (StringRef keyword) |
| Parse a given keyword. | |
| ParseResult | parseKeyword (StringRef *keyword) |
| Parse a keyword into 'keyword'. | |
Protected Attributes | |
| SMLoc | nameLoc |
| The source location of the dialect symbol. | |
| Parser & | parser |
| The main parser. | |
| bool | emittedError = false |
| A flag that indicates if any errors were emitted during parsing. | |
This class provides the implementation of the generic parser methods within AsmParser.
Definition at line 28 of file AsmParserImpl.h.
| using mlir::detail::AsmParserImpl< BaseT >::Delimiter = AsmParser::Delimiter |
Definition at line 67 of file AsmParserImpl.h.
|
inline |
Definition at line 30 of file AsmParserImpl.h.
|
overridedefault |
|
inlineoverride |
Signal the code completion of a set of expected tokens.
Definition at line 631 of file AsmParserImpl.h.
References mlir::Token::getSpelling(), mlir::Token::isCodeCompletion(), and parser.
|
inline |
Return if any errors were emitted during parsing.
Definition at line 42 of file AsmParserImpl.h.
References emittedError.
|
inlineoverride |
Emit a diagnostic at the specified location and return failure.
Definition at line 45 of file AsmParserImpl.h.
References emittedError, and parser.
Referenced by parseBase64Bytes(), and parseKeyword().
|
inlineoverride |
Return a builder which provides useful access to MLIRContext, global objects like types and attributes.
Definition at line 52 of file AsmParserImpl.h.
References parser.
Referenced by parseOptionalSymbolName().
|
inlineoverride |
Get the location of the next token and store it into the argument.
This always succeeds.
Definition at line 56 of file AsmParserImpl.h.
References parser.
Referenced by parseBase64Bytes(), and parseKeyword().
|
inlineoverride |
Re-encode the given source location as an MLIR location and return it.
Definition at line 59 of file AsmParserImpl.h.
References parser.
|
inlineoverride |
Return the location of the original name token.
Definition at line 35 of file AsmParserImpl.h.
References nameLoc.
|
inlineoverride |
Parse an affine expr instance into 'expr' using the already computed mapping from symbols to affine expressions in 'symbolSet'.
Definition at line 496 of file AsmParserImpl.h.
References parser.
|
inlineoverride |
Parse an affine map instance into 'map'.
Definition at line 489 of file AsmParserImpl.h.
References parser.
|
inlineoverride |
Parse a -> token.
Definition at line 70 of file AsmParserImpl.h.
References parser.
Referenced by parseArrowTypeList().
|
inlineoverride |
Parse an arrow followed by a type list.
Definition at line 560 of file AsmParserImpl.h.
References parseArrow(), parser, result, and success().
|
inlineoverride |
Parse an arbitrary attribute and return it in result.
Definition at line 428 of file AsmParserImpl.h.
References parser, result, and success().
Referenced by parseCustomAttributeWithFallback().
|
inlineoverride |
Parses a Base64 encoded string of bytes.
Definition at line 265 of file AsmParserImpl.h.
References emitError(), getCurrentLocation(), parser, success(), and mlir::toString().
|
inlineoverride |
|
inlineoverride |
Parse a colon followed by a type.
Definition at line 575 of file AsmParserImpl.h.
|
inlineoverride |
Parse a colon followed by a type list, which must have at least one type.
Definition at line 581 of file AsmParserImpl.h.
|
inlineoverride |
|
inlineoverride |
Parse a list of comma-separated items with an optional delimiter.
If a delimiter is provided, then an empty list is allowed. If not, then at least one element will be parsed.
Definition at line 325 of file AsmParserImpl.h.
References parser.
|
inlineoverride |
Parse a custom attribute with the provided callback, unless the next token is #, in which case the generic parser is invoked.
Definition at line 435 of file AsmParserImpl.h.
References parseAttribute(), parser, result, and success().
|
inlineoverride |
Parse a custom attribute with the provided callback, unless the next token is #, in which case the generic parser is invoked.
Definition at line 447 of file AsmParserImpl.h.
References parser, parseType(), result, and success().
|
inlineoverride |
Definition at line 596 of file AsmParserImpl.h.
References parser.
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
Parse a floating point value with given semantics from the stream.
The literal is parsed directly using the requested semantics, avoiding range or precision loss from an intermediate double conversion.
Definition at line 289 of file AsmParserImpl.h.
References parser, result, and success().
Referenced by parseFloat().
|
inlineoverride |
Parse a floating point value from the stream.
Definition at line 303 of file AsmParserImpl.h.
References parseFloat(), result, and success().
|
inlineoverride |
|
inlineoverride |
Parse an integer set instance into 'set'.
Definition at line 502 of file AsmParserImpl.h.
References parser.
|
inline |
Parse a keyword into 'keyword'.
Definition at line 941 of file OpImplementation.h.
|
inline |
Parse a given keyword.
Definition at line 935 of file OpImplementation.h.
|
inlineoverride |
Definition at line 335 of file AsmParserImpl.h.
References emitError(), getCurrentLocation(), parseOptionalKeyword(), parser, and success().
Referenced by parseKeywordOrCompletion().
|
inlineoverride |
Parse a keyword, or an empty string if the current location signals a code completion.
Definition at line 621 of file AsmParserImpl.h.
References mlir::Token::getSpelling(), mlir::Token::isCodeCompletion(), parseKeyword(), parser, and success().
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
Parses a -> if present.
Definition at line 75 of file AsmParserImpl.h.
|
inlineoverride |
Parse an optional arrow followed by a type list.
Definition at line 568 of file AsmParserImpl.h.
|
inlineoverride |
Parse a named dictionary into 'result' if it is present.
Definition at line 474 of file AsmParserImpl.h.
|
inlineoverride |
Parse a named dictionary into 'result' if the attributes keyword is present.
Definition at line 482 of file AsmParserImpl.h.
References parseOptionalKeyword(), parser, result, and success().
|
inlineoverride |
Definition at line 460 of file AsmParserImpl.h.
References ArrayAttr(), parser, and result.
|
inlineoverride |
Definition at line 456 of file AsmParserImpl.h.
|
inlineoverride |
Definition at line 464 of file AsmParserImpl.h.
|
inlineoverride |
Definition at line 468 of file AsmParserImpl.h.
|
inlineoverride |
Parse a : token if present.
Definition at line 105 of file AsmParserImpl.h.
|
inlineoverride |
Parse an optional colon followed by a type list, which if present must have at least one type.
Definition at line 590 of file AsmParserImpl.h.
|
inlineoverride |
Parse a , token if present.
Definition at line 115 of file AsmParserImpl.h.
|
inlineoverride |
Parse an optional integer value from the stream.
Definition at line 318 of file AsmParserImpl.h.
|
inlineoverride |
Parses a ... if present.
Definition at line 125 of file AsmParserImpl.h.
|
inlineoverride |
Parse a = token if present.
Definition at line 135 of file AsmParserImpl.h.
|
inlineoverride |
Parse a > token if present.
Definition at line 155 of file AsmParserImpl.h.
|
inlineoverride |
Parse an optional integer value from the stream.
Definition at line 313 of file AsmParserImpl.h.
|
inlineoverride |
Parse a keyword, if present, into 'keyword'.
Definition at line 360 of file AsmParserImpl.h.
References parser.
|
inlineoverride |
Parse a keyword if it is one of the 'allowedKeywords'.
Definition at line 366 of file AsmParserImpl.h.
|
inlineoverride |
Parse the given keyword if present.
Definition at line 347 of file AsmParserImpl.h.
References parser, and success().
Referenced by parseKeyword(), parseOptionalAttrDictWithKeyword(), and parseOptionalKeywordOrString().
|
inlineoverride |
Parse an optional keyword or string and set instance into 'result'.`.
Definition at line 407 of file AsmParserImpl.h.
|
inlineoverride |
Definition at line 412 of file AsmParserImpl.h.
References parseOptionalKeyword(), parseOptionalString(), result, and success().
|
inlineoverride |
Parse a '{' token if present.
Definition at line 85 of file AsmParserImpl.h.
|
inlineoverride |
Parse a < token if present.
Definition at line 145 of file AsmParserImpl.h.
|
inlineoverride |
Parses a '(' if present.
Definition at line 165 of file AsmParserImpl.h.
|
inlineoverride |
Parses a '[' if present.
Definition at line 185 of file AsmParserImpl.h.
|
inlineoverride |
Parses a '-' token if present.
Definition at line 245 of file AsmParserImpl.h.
|
inlineoverride |
Parses a '+' token if present.
Definition at line 235 of file AsmParserImpl.h.
|
inlineoverride |
Parses a '?' if present.
Definition at line 205 of file AsmParserImpl.h.
|
inlineoverride |
Parse a } token if present.
Definition at line 95 of file AsmParserImpl.h.
|
inlineoverride |
Parses a ')' if present.
Definition at line 175 of file AsmParserImpl.h.
|
inlineoverride |
Parses a ']' if present.
Definition at line 195 of file AsmParserImpl.h.
|
inlineoverride |
Parses a '/' if present.
Definition at line 215 of file AsmParserImpl.h.
|
inlineoverride |
Parses a '*' if present.
Definition at line 225 of file AsmParserImpl.h.
|
inlineoverride |
Parse a string if it is one of the 'allowedKeywords'.
Definition at line 387 of file AsmParserImpl.h.
|
inlineoverride |
Parses a quoted string token if present.
Definition at line 260 of file AsmParserImpl.h.
References parser.
Referenced by parseOptionalKeywordOrString().
|
inlineoverride |
Parse an optional -identifier and store it (without the '@' symbol) in a string attribute named 'attrName'.
Definition at line 512 of file AsmParserImpl.h.
References getBuilder(), mlir::Token::getLocRange(), mlir::Builder::getStringAttr(), mlir::Token::getSymbolReference(), mlir::Token::isNot(), parser, result, and success().
|
inlineoverride |
Parse an optional type.
Definition at line 555 of file AsmParserImpl.h.
|
inlineoverride |
Parse a '|' token if present.
Definition at line 255 of file AsmParserImpl.h.
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
Parse a handle to a resource within the assembly format.
Definition at line 535 of file AsmParserImpl.h.
References mlir::Dialect::getNamespace(), and parser.
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
Parse a type.
Definition at line 550 of file AsmParserImpl.h.
References parser, and result.
Referenced by parseCustomTypeWithFallback().
|
inlineoverride |
|
inlineoverride |
Definition at line 603 of file AsmParserImpl.h.
References parser.
|
inlineoverride |
Definition at line 611 of file AsmParserImpl.h.
References parser.
|
inlineoverride |
Definition at line 607 of file AsmParserImpl.h.
|
protected |
A flag that indicates if any errors were emitted during parsing.
Definition at line 645 of file AsmParserImpl.h.
Referenced by didEmitError(), and emitError().
|
protected |
The source location of the dialect symbol.
Definition at line 639 of file AsmParserImpl.h.
Referenced by AsmParserImpl(), and getNameLoc().
|
protected |
The main parser.
Definition at line 642 of file AsmParserImpl.h.
Referenced by AsmParserImpl(), codeCompleteExpectedTokens(), emitError(), getBuilder(), getCurrentLocation(), getEncodedSourceLoc(), parseAffineExpr(), parseAffineMap(), parseArrow(), parseArrowTypeList(), parseAttribute(), parseBase64Bytes(), parseColon(), parseColonType(), parseColonTypeList(), parseComma(), parseCommaSeparatedList(), parseCustomAttributeWithFallback(), parseCustomTypeWithFallback(), parseDimensionList(), parseEllipsis(), parseEqual(), parseFloat(), parseGreater(), parseIntegerSet(), parseKeyword(), parseKeywordOrCompletion(), parseLBrace(), parseLess(), parseLParen(), parseLSquare(), parseMinus(), parseOptionalArrow(), parseOptionalArrowTypeList(), parseOptionalAttrDict(), parseOptionalAttrDictWithKeyword(), parseOptionalAttribute(), parseOptionalAttribute(), parseOptionalAttribute(), parseOptionalAttribute(), parseOptionalColon(), parseOptionalColonTypeList(), parseOptionalComma(), parseOptionalDecimalInteger(), parseOptionalEllipsis(), parseOptionalEqual(), parseOptionalGreater(), parseOptionalInteger(), parseOptionalKeyword(), parseOptionalKeyword(), parseOptionalKeyword(), parseOptionalKeywordOrString(), parseOptionalLBrace(), parseOptionalLess(), parseOptionalLParen(), parseOptionalLSquare(), parseOptionalMinus(), parseOptionalPlus(), parseOptionalQuestion(), parseOptionalRBrace(), parseOptionalRParen(), parseOptionalRSquare(), parseOptionalSlash(), parseOptionalStar(), parseOptionalString(), parseOptionalString(), parseOptionalSymbolName(), parseOptionalType(), parseOptionalVerticalBar(), parsePlus(), parseQuestion(), parseRBrace(), parseResourceHandle(), parseRParen(), parseRSquare(), parseSlash(), parseStar(), parseType(), parseVerticalBar(), parseXInDimensionList(), popCyclicParsing(), and pushCyclicParsing().