| ... | @@ -19,8 +19,6 @@ const nio = @import("nio"); | ... | @@ -19,8 +19,6 @@ const nio = @import("nio"); |
| 19 | const tokenize = @import("./tokenize.zig"); | 19 | const tokenize = @import("./tokenize.zig"); |
| 20 | const astgen = @import("./astgen.zig"); | 20 | const astgen = @import("./astgen.zig"); |
| 21 | | 21 | |
| 22 | const callconv_inline: std.builtin.CallingConvention = if (builtin.mode == .Debug) .auto else .@"inline"; | | |
| 23 | | | |
| 24 | pub fn parse(comptime input: string) astgen.Value { | 22 | pub fn parse(comptime input: string) astgen.Value { |
| 25 | return astgen.Value{ .element = astgen.do(tokenize.do(input, &.{ '[', '=', ']', '(', ')', '{', '}', '#', '/', '.', '<', '>' })) }; | 23 | return astgen.Value{ .element = astgen.do(tokenize.do(input, &.{ '[', '=', ']', '(', ')', '{', '}', '#', '/', '.', '<', '>' })) }; |
| 26 | } | 24 | } |
| ... | @@ -44,7 +42,7 @@ pub fn compileInner(alloc: std.mem.Allocator, writer: anytype, comptime value: a | ... | @@ -44,7 +42,7 @@ pub fn compileInner(alloc: std.mem.Allocator, writer: anytype, comptime value: a |
| 44 | | 42 | |
| 45 | pub const Writer = std.ArrayList(u8).Writer; | 43 | pub const Writer = std.ArrayList(u8).Writer; |
| 46 | | 44 | |
| 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 | fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype, comptime opts: DoOptions) anyerror!void { |
| 48 | comptime var skipindent = false; | 46 | comptime var skipindent = false; |
| 49 | if (value == .element and comptime std.mem.eql(u8, value.element.name, "pre")) skipindent = true; | 47 | if (value == .element and comptime std.mem.eql(u8, value.element.name, "pre")) skipindent = true; |
| 50 | return doInner(alloc, writer, value, data, ctx, .{ | 48 | return doInner(alloc, writer, value, data, ctx, .{ |
| ... | @@ -55,7 +53,7 @@ fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, d | ... | @@ -55,7 +53,7 @@ fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, d |
| 55 | .escaped = opts.escaped, | 53 | .escaped = opts.escaped, |
| 56 | }); | 54 | }); |
| 57 | } | 55 | } |
| 58 | fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype, comptime opts: DoOptions) callconv(callconv_inline) anyerror!void { | 56 | fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype, comptime opts: DoOptions) anyerror!void { |
| 59 | switch (comptime value) { | 57 | switch (comptime value) { |
| 60 | .element => |v| { | 58 | .element => |v| { |
| 61 | const hastext = comptime for (v.children) |x| { | 59 | const hastext = comptime for (v.children) |x| { |