@@ -337,6 +337,7 @@ class Parser {
337
337
FailureOr<ast::Expr *> parseMemberAccessExpr (ast::Expr *parentExpr);
338
338
FailureOr<ast::Expr *> parseNegatedExpr ();
339
339
FailureOr<ast::Expr *> parseIntegerExpr ();
340
+ FailureOr<ast::Expr *> parseStringExpr ();
340
341
FailureOr<ast::OpNameDecl *> parseOperationName (bool allowEmptyName = false );
341
342
FailureOr<ast::OpNameDecl *> parseWrappedOperationName (bool allowEmptyName);
342
343
FailureOr<ast::Expr *>
@@ -1901,6 +1902,9 @@ FailureOr<ast::Expr *> Parser::parseExpr() {
1901
1902
case Token::integer:
1902
1903
lhsExpr = parseIntegerExpr ();
1903
1904
break ;
1905
+ case Token::string:
1906
+ lhsExpr = parseStringExpr ();
1907
+ break ;
1904
1908
case Token::string_block:
1905
1909
return emitError (" expected expression. If you are trying to create an "
1906
1910
" ArrayAttr, use a space between `[` and `{`." );
@@ -2164,6 +2168,13 @@ FailureOr<ast::Expr *> Parser::parseIntegerExpr() {
2164
2168
return ast::AttributeExpr::create (ctx, loc, allocated);
2165
2169
}
2166
2170
2171
+ FailureOr<ast::Expr *> Parser::parseStringExpr () {
2172
+ SMRange loc = curToken.getLoc ();
2173
+ StringRef value = curToken.getSpelling ();
2174
+ consumeToken ();
2175
+ return ast::AttributeExpr::create (ctx, loc, value);
2176
+ }
2177
+
2167
2178
FailureOr<ast::OpNameDecl *> Parser::parseOperationName (bool allowEmptyName) {
2168
2179
SMRange loc = curToken.getLoc ();
2169
2180
0 commit comments