| ... | ... | @@ -19,8 +19,6 @@ const nio = @import("nio"); |
| 19 | 19 | const tokenize = @import("./tokenize.zig"); |
| 20 | 20 | const astgen = @import("./astgen.zig"); |
| 21 | 21 | |
| 22 | | const callconv_inline: std.builtin.CallingConvention = if (builtin.mode == .Debug) .auto else .@"inline"; |
| 23 | | |
| 24 | 22 | pub fn parse(comptime input: string) astgen.Value { |
| 25 | 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 | 42 | |
| 45 | 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 | 46 | comptime var skipindent = false; |
| 49 | 47 | if (value == .element and comptime std.mem.eql(u8, value.element.name, "pre")) skipindent = true; |
| 50 | 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 | 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 | 57 | switch (comptime value) { |
| 60 | 58 | .element => |v| { |
| 61 | 59 | const hastext = comptime for (v.children) |x| { |