| ... | ... | @@ -591,9 +591,13 @@ fn parseValueEnum(self: *Assembler, kind: spec.OperandKind) !void { |
| 591 | 591 | try self.expectToken(.value); |
| 592 | 592 | |
| 593 | 593 | const text = self.tokenText(tok); |
| 594 | const int_value = std.fmt.parseInt(u32, text, 0) catch null; |
| 594 | 595 | const enumerant = for (kind.enumerants()) |enumerant| { |
| 595 | | if (std.mem.eql(u8, enumerant.name, text)) |
| 596 | | break enumerant; |
| 596 | if (int_value) |v| { |
| 597 | if (v == enumerant.value) break enumerant; |
| 598 | } else { |
| 599 | if (std.mem.eql(u8, enumerant.name, text)) break enumerant; |
| 600 | } |
| 597 | 601 | } else { |
| 598 | 602 | return self.fail(tok.start, "'{s}' is not a valid value for enumeration {s}", .{ text, @tagName(kind) }); |
| 599 | 603 | }; |