[MLIR] Add `KeywordOrString` handling to AsmParser
This adds a new parser and printer for text which may be a keyword or a string. When printing, it will attempt to print the text as a keyword, but if it has any special or non-printable characters, it will be printed as an escaped string. When parsing, it will parse either a valid keyword or a potentially escaped string. The printer allows for an empty string, in which case it prints `""`. This new function is used for printing the name in NamedAttributes, and for printing the symbol name after the `@`. In CIRCT we are using this to print module port names, which are conceptually similar to named function arguments. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D111683
Loading
Please sign in to comment