dev/sdl3-parser #1
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in New Issue