diff --git a/lib/sdl3/parser/src/patterns.zig b/lib/sdl3/parser/src/patterns.zig index e5f59b6..ff119d4 100644 --- a/lib/sdl3/parser/src/patterns.zig +++ b/lib/sdl3/parser/src/patterns.zig @@ -510,10 +510,22 @@ pub const Scanner = struct { const trimmed = std.mem.trim(u8, line, " \t\r"); // Track multi-line comments (both /** and /*) - if (std.mem.indexOf(u8, trimmed, "/*") != null) { - in_multiline_comment = true; - } - if (in_multiline_comment) { + // Only start tracking if /* appears without */ on the same line + if (!in_multiline_comment) { + if (std.mem.indexOf(u8, trimmed, "/*")) |start_pos| { + if (std.mem.indexOf(u8, trimmed, "*/")) |_| { + // Both /* and */ on same line - it's an inline comment, not multi-line + // If line starts with /*, skip it entirely + if (start_pos == 0) continue; + // Otherwise it contains an inline comment, process the line normally + } else { + // Found /* without */ - start of multi-line comment + in_multiline_comment = true; + continue; + } + } + } else { + // We're in a multi-line comment, look for */ if (std.mem.indexOf(u8, trimmed, "*/") != null) { in_multiline_comment = false; } @@ -590,10 +602,22 @@ pub const Scanner = struct { const trimmed = std.mem.trim(u8, line, " \t\r"); // Track multi-line comments (both /** and /*) - if (std.mem.indexOf(u8, trimmed, "/*") != null) { - in_multiline_comment = true; - } - if (in_multiline_comment) { + // Only start tracking if /* appears without */ on the same line + if (!in_multiline_comment) { + if (std.mem.indexOf(u8, trimmed, "/*")) |start_pos| { + if (std.mem.indexOf(u8, trimmed, "*/")) |_| { + // Both /* and */ on same line - it's an inline comment, not multi-line + // If line starts with /*, skip it entirely + if (start_pos == 0) continue; + // Otherwise it contains an inline comment, process the line normally + } else { + // Found /* without */ - start of multi-line comment + in_multiline_comment = true; + continue; + } + } + } else { + // We're in a multi-line comment, look for */ if (std.mem.indexOf(u8, trimmed, "*/") != null) { in_multiline_comment = false; } diff --git a/lib/sdl3/parser/src/types.zig b/lib/sdl3/parser/src/types.zig index 66ada93..8d626d7 100644 --- a/lib/sdl3/parser/src/types.zig +++ b/lib/sdl3/parser/src/types.zig @@ -42,6 +42,7 @@ pub fn convertType(c_type: []const u8, allocator: Allocator) ![]const u8 { // Common pointer types if (std.mem.eql(u8, trimmed, "const char *")) return try allocator.dupe(u8, "[*c]const u8"); + if (std.mem.eql(u8, trimmed, "const char **")) return try allocator.dupe(u8, "[*c][*c]const u8"); if (std.mem.eql(u8, trimmed, "const char * const *")) return try allocator.dupe(u8, "[*c]const [*c]const u8"); if (std.mem.eql(u8, trimmed, "char *")) return try allocator.dupe(u8, "[*c]u8"); if (std.mem.eql(u8, trimmed, "void *")) return try allocator.dupe(u8, "?*anyopaque");