| ... | ... | @@ -80,7 +80,7 @@ const Action = struct { |
| 80 | 80 | const hay = mem.trim(u8, haystack, " "); |
| 81 | 81 | const phrase = mem.trim(u8, act.phrase.resolve(b, step), " "); |
| 82 | 82 | |
| 83 | | var candidate_var: ?struct { name: []const u8, value: u64 } = null; |
| 83 | var candidate_vars = std.ArrayList(struct { name: []const u8, value: u64 }).init(b.allocator); |
| 84 | 84 | var hay_it = mem.tokenizeScalar(u8, hay, ' '); |
| 85 | 85 | var needle_it = mem.tokenizeScalar(u8, phrase, ' '); |
| 86 | 86 | |
| ... | ... | @@ -92,18 +92,21 @@ const Action = struct { |
| 92 | 92 | |
| 93 | 93 | const name = needle_tok[1..closing_brace]; |
| 94 | 94 | if (name.len == 0) return error.MissingBraceValue; |
| 95 | | const value = try std.fmt.parseInt(u64, hay_tok, 16); |
| 96 | | candidate_var = .{ |
| 95 | const value = std.fmt.parseInt(u64, hay_tok, 16) catch return false; |
| 96 | try candidate_vars.append(.{ |
| 97 | 97 | .name = name, |
| 98 | 98 | .value = value, |
| 99 | | }; |
| 99 | }); |
| 100 | 100 | } else { |
| 101 | 101 | if (!mem.eql(u8, hay_tok, needle_tok)) return false; |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | | if (candidate_var) |v| try global_vars.putNoClobber(v.name, v.value); |
| 106 | | return candidate_var != null; |
| 105 | if (candidate_vars.items.len == 0) return false; |
| 106 | |
| 107 | for (candidate_vars.items) |cv| try global_vars.putNoClobber(cv.name, cv.value); |
| 108 | |
| 109 | return true; |
| 107 | 110 | } |
| 108 | 111 | |
| 109 | 112 | /// Returns true if the `phrase` is an exact match with the haystack. |
| ... | ... | @@ -1253,7 +1256,7 @@ const ElfDumper = struct { |
| 1253 | 1256 | } else if (sym.st_shndx == elf.SHN_UNDEF) { |
| 1254 | 1257 | try writer.writeAll(" UND"); |
| 1255 | 1258 | } else { |
| 1256 | | try writer.print(" {d}", .{sym.st_shndx}); |
| 1259 | try writer.print(" {x}", .{sym.st_shndx}); |
| 1257 | 1260 | } |
| 1258 | 1261 | } |
| 1259 | 1262 | |