| ... | @@ -13,10 +13,13 @@ const htmlentities = @import("htmlentities"); | ... | @@ -13,10 +13,13 @@ const htmlentities = @import("htmlentities"); |
| 13 | const root = @import("root"); | 13 | const root = @import("root"); |
| 14 | const tracer = @import("tracer"); | 14 | const tracer = @import("tracer"); |
| 15 | const extras = @import("extras"); | 15 | const extras = @import("extras"); |
| | 16 | const builtin = @import("builtin"); |
| 16 | | 17 | |
| 17 | const tokenize = @import("./tokenize.zig"); | 18 | const tokenize = @import("./tokenize.zig"); |
| 18 | const astgen = @import("./astgen.zig"); | 19 | const astgen = @import("./astgen.zig"); |
| 19 | | 20 | |
| | 21 | const callconv_inline: std.builtin.CallingConvention = if (builtin.mode == .Debug) .auto else .@"inline"; |
| | 22 | |
| 20 | pub fn parse(comptime input: string) astgen.Value { | 23 | pub fn parse(comptime input: string) astgen.Value { |
| 21 | return astgen.Value{ .element = astgen.do(tokenize.do(input, &.{ '[', '=', ']', '(', ')', '{', '}', '#', '/', '.', '<', '>' })) }; | 24 | return astgen.Value{ .element = astgen.do(tokenize.do(input, &.{ '[', '=', ']', '(', ')', '{', '}', '#', '/', '.', '<', '>' })) }; |
| 22 | } | 25 | } |
| ... | @@ -41,7 +44,7 @@ pub fn compileInner(alloc: std.mem.Allocator, writer: anytype, comptime value: a | ... | @@ -41,7 +44,7 @@ pub fn compileInner(alloc: std.mem.Allocator, writer: anytype, comptime value: a |
| 41 | | 44 | |
| 42 | pub const Writer = std.ArrayList(u8).Writer; | 45 | pub const Writer = std.ArrayList(u8).Writer; |
| 43 | | 46 | |
| 44 | inline fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype, comptime opts: DoOptions) anyerror!void { | 47 | fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype, comptime opts: DoOptions) callconv(callconv_inline) anyerror!void { |
| 45 | switch (comptime value) { | 48 | switch (comptime value) { |
| 46 | .element => |v| { | 49 | .element => |v| { |
| 47 | const hastext = comptime for (v.children) |x| { | 50 | const hastext = comptime for (v.children) |x| { |