@@ -1074,13 +1074,17 @@ mlir.Parser = class {
1074
1074
this . _current . type !== '}' &&
1075
1075
this . _current . type !== mlir . TokenType . IDENTIFIER &&
1076
1076
this . _current . type !== mlir . TokenType . STRING_LITERAL ) {
1077
- const value = this . _eat ( mlir . TokenType . VALUE_ID ) ;
1078
- if ( value ) {
1077
+ if ( this . _match ( mlir . TokenType . VALUE_ID ) ) {
1078
+ const value = this . _eat ( mlir . TokenType . VALUE_ID ) ;
1079
+ inputs . push ( value . value ) ;
1080
+ } else if ( this . _match ( mlir . TokenType . DENSE ) ) {
1081
+ const value = this . _eat ( mlir . TokenType . DENSE ) ;
1082
+ inputs . push ( value . value ) ;
1083
+ } else if ( this . _match ( mlir . TokenType . INTEGER_LITERAL ) ) {
1084
+ const value = this . _eat ( mlir . TokenType . INTEGER_LITERAL ) ;
1079
1085
inputs . push ( value . value ) ;
1080
1086
} else {
1081
- const dense = this . _eat ( mlir . TokenType . DENSE ) ;
1082
- inputs . push ( dense . value ) ;
1083
- return inputs ;
1087
+ throw new mlir . Error ( `Unexpected token '${ this . _current . type } ' ${ this . _tokenizer . location ( ) } ` ) ;
1084
1088
}
1085
1089
this . _eat ( ',' ) ;
1086
1090
}
@@ -1145,7 +1149,12 @@ mlir.Parser = class {
1145
1149
const attributes = new Map ( ) ;
1146
1150
if ( this . _eat ( '{' ) ) {
1147
1151
while ( ! this . _eat ( '}' ) ) {
1148
- const name = this . _read ( mlir . TokenType . IDENTIFIER ) . value ;
1152
+ let name = null ;
1153
+ if ( this . _match ( mlir . TokenType . IDENTIFIER ) ) {
1154
+ name = this . _read ( mlir . TokenType . IDENTIFIER ) . value ;
1155
+ } else {
1156
+ name = this . _read ( mlir . TokenType . STRING_LITERAL ) . value ;
1157
+ }
1149
1158
if ( this . _eat ( '=' ) ) {
1150
1159
let value = '' ;
1151
1160
let openingCount = 0 ;
@@ -1188,7 +1197,7 @@ mlir.Parser = class {
1188
1197
} else if ( this . _match ( mlir . TokenType . ATTRIBUTE_ALIAS ) ) {
1189
1198
args . push ( this . _eat ( mlir . TokenType . ATTRIBUTE_ALIAS ) . value ) ;
1190
1199
} else {
1191
- throw new mlir ( `Unexpected token '${ this . _current } .` ) ;
1200
+ throw new mlir . Error ( `Unexpected token '${ this . _current } .` ) ;
1192
1201
}
1193
1202
}
1194
1203
}
0 commit comments