╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ migrate_langref.zig ──────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
412 413 if (target_str) |s| 414 try code.print("// target={s}\n", .{s}); 415 416 if (link_libc) try code.print("// link_libc\n", .{}); 417 if (disable_cache) try code.print("// disable_cache\n", .{}); 418 419 if (link_mode) |m| 420 try code.print("// link_mode={s}\n", .{@tagName(m)}); 421 422 for (additional_options.items) |o| { 423 try code.print("// additional_option={s}\n", .{o}); 424 } 425 try code.flush(); 426 try w.print("{{#code|{s}#}}\n", .{basename}); 427 } else { 428 const close_bracket = while (true) { 429 const next = tokenizer.next(); 430 if (next.id == .bracket_close) break next; 431 }; 432 try w.writeAll(tokenizer.buffer[token.start..close_bracket.end]); 433 } 434 }, 435 else => return parseError(tokenizer, token, "invalid token", .{}), 436 } 437 } 438 } 439 440 fn urlize(allocator: Allocator, input: []const u8) ![]u8 { 441 var buf = std.array_list.Managed(u8).init(allocator); 442 defer buf.deinit(); 443 444 const out = buf.writer(); 445 for (input) |c| { 446 switch (c) { 447 'a'...'z', 'A'...'Z', '_', '-', '0'...'9' => { 448 try out.writeByte(c); 449 }, 450 ' ' => { 451 try out.writeByte('-'); 452 }, 453 else => {}, 454 } 455 } 456 return try buf.toOwnedSlice(); 457 } 458