| ... | @@ -72,13 +72,18 @@ fn do(comptime Ctx: type, alloc: std.mem.Allocator, writer: anytype, comptime va | ... | @@ -72,13 +72,18 @@ fn do(comptime Ctx: type, alloc: std.mem.Allocator, writer: anytype, comptime va |
| 72 | .string => |v| { | 72 | .string => |v| { |
| 73 | try writer.writeAll(v[1 .. v.len - 1]); | 73 | try writer.writeAll(v[1 .. v.len - 1]); |
| 74 | }, | 74 | }, |
| 75 | .replacement => |v| { | 75 | .replacement => |repl| { |
| | 76 | const v = repl.arms; |
| 76 | const x = if (comptime std.mem.eql(u8, v[0], "this")) search(v[1..], data) else search(v, ctx); | 77 | const x = if (comptime std.mem.eql(u8, v[0], "this")) search(v[1..], data) else search(v, ctx); |
| 77 | const TO = @TypeOf(x); | 78 | const TO = @TypeOf(x); |
| 78 | const TI = @typeInfo(TO); | 79 | const TI = @typeInfo(TO); |
| 79 | | 80 | |
| 80 | if (comptime std.meta.trait.isZigString(TO)) { | 81 | if (comptime std.meta.trait.isZigString(TO)) { |
| 81 | const s: []const u8 = x; | 82 | if (repl.raw) { |
| | 83 | try writer.writeAll(x); |
| | 84 | return; |
| | 85 | } |
| | 86 | const s: string = x; |
| 82 | for (s) |c| { | 87 | for (s) |c| { |
| 83 | if (entityLookupBefore(&[_]u8{c})) |ent| { | 88 | if (entityLookupBefore(&[_]u8{c})) |ent| { |
| 84 | try writer.writeAll(ent.entity); | 89 | try writer.writeAll(ent.entity); |
| ... | @@ -170,7 +175,7 @@ fn do(comptime Ctx: type, alloc: std.mem.Allocator, writer: anytype, comptime va | ... | @@ -170,7 +175,7 @@ fn do(comptime Ctx: type, alloc: std.mem.Allocator, writer: anytype, comptime va |
| 170 | const field_name = comptime std.fmt.comptimePrint("{d}", .{i + 2}); | 175 | const field_name = comptime std.fmt.comptimePrint("{d}", .{i + 2}); |
| 171 | @field(args, field_name) = if (comptime std.mem.eql(u8, arg[0], "this")) search(arg[1..], data) else search(arg, ctx); | 176 | @field(args, field_name) = if (comptime std.mem.eql(u8, arg[0], "this")) search(arg[1..], data) else search(arg, ctx); |
| 172 | } | 177 | } |
| 173 | const repvalue = astgen.Value{ .replacement = &.{"this"} }; | 178 | const repvalue = astgen.Value{ .replacement = .{ .arms = &.{"this"} } }; |
| 174 | try @call(.{}, func, args); | 179 | try @call(.{}, func, args); |
| 175 | try do(Ctx, alloc, writer, repvalue, list.toOwnedSlice(), ctx, indent, flag1); | 180 | try do(Ctx, alloc, writer, repvalue, list.toOwnedSlice(), ctx, indent, flag1); |
| 176 | return; | 181 | return; |