@@ -326,6 +326,7 @@ class Parser {
326
326
FailureOr<ast::Expr *> parseMemberAccessExpr (ast::Expr *parentExpr);
327
327
FailureOr<ast::Expr *> parseNegatedExpr ();
328
328
FailureOr<ast::Expr *> parseIntegerExpr ();
329
+ FailureOr<ast::Expr *> parseStringExpr ();
329
330
FailureOr<ast::OpNameDecl *> parseOperationName (bool allowEmptyName = false );
330
331
FailureOr<ast::OpNameDecl *> parseWrappedOperationName (bool allowEmptyName);
331
332
FailureOr<ast::Expr *>
@@ -1838,6 +1839,9 @@ FailureOr<ast::Expr *> Parser::parseExpr() {
1838
1839
case Token::integer:
1839
1840
lhsExpr = parseIntegerExpr ();
1840
1841
break ;
1842
+ case Token::string:
1843
+ lhsExpr = parseStringExpr ();
1844
+ break ;
1841
1845
case Token::string_block:
1842
1846
return emitError (" expected expression. If you are trying to create an "
1843
1847
" ArrayAttr, use a space between `[` and `{`." );
@@ -2100,6 +2104,13 @@ FailureOr<ast::Expr *> Parser::parseIntegerExpr() {
2100
2104
return ast::AttributeExpr::create (ctx, loc, allocated);
2101
2105
}
2102
2106
2107
+ FailureOr<ast::Expr *> Parser::parseStringExpr () {
2108
+ SMRange loc = curToken.getLoc ();
2109
+ StringRef value = curToken.getSpelling ();
2110
+ consumeToken ();
2111
+ return ast::AttributeExpr::create (ctx, loc, value);
2112
+ }
2113
+
2103
2114
FailureOr<ast::OpNameDecl *> Parser::parseOperationName (bool allowEmptyName) {
2104
2115
SMRange loc = curToken.getLoc ();
2105
2116
0 commit comments