also looking at this
Port to latest zig-master
#2
53 files
+1149
-1017
| @@ -5,7 +5,7 @@ const Regex = @import("regex").Regex; | ||
| 5 | 5 | |
| 6 | 6 | test "iterator: basic iteration" { |
| 7 | 7 | const allocator = std.testing.allocator; |
| 8 | var regex = try Regex.compile(allocator, "\\d+"); | |
| 8 | var regex = try Regex.compile(allocator, std.testing.io, "\\d+"); | |
| 9 | 9 | defer regex.deinit(); |
| 10 | 10 | |
| 11 | 11 | const text = "123 abc 456 def 789"; |
| @@ -29,7 +29,7 @@ test "iterator: basic iteration" { | ||
| 29 | 29 | |
| 30 | 30 | test "iterator: empty input" { |
| 31 | 31 | const allocator = std.testing.allocator; |
| 32 | var regex = try Regex.compile(allocator, "\\d+"); | |
| 32 | var regex = try Regex.compile(allocator, std.testing.io, "\\d+"); | |
| 33 | 33 | defer regex.deinit(); |
| 34 | 34 | |
| 35 | 35 | const text = ""; |
| @@ -41,7 +41,7 @@ test "iterator: empty input" { | ||
| 41 | 41 | |
| 42 | 42 | test "iterator: no matches" { |
| 43 | 43 | const allocator = std.testing.allocator; |
| 44 | var regex = try Regex.compile(allocator, "\\d+"); | |
| 44 | var regex = try Regex.compile(allocator, std.testing.io, "\\d+"); | |
| 45 | 45 | defer regex.deinit(); |
| 46 | 46 | |
| 47 | 47 | const text = "abc def"; |
| @@ -53,7 +53,7 @@ test "iterator: no matches" { | ||
| 53 | 53 | |
| 54 | 54 | test "iterator: reset functionality" { |
| 55 | 55 | const allocator = std.testing.allocator; |
| 56 | var regex = try Regex.compile(allocator, "\\w+"); | |
| 56 | var regex = try Regex.compile(allocator, std.testing.io, "\\w+"); | |
| 57 | 57 | defer regex.deinit(); |
| 58 | 58 | |
| 59 | 59 | const text = "hello world"; |
| @@ -72,7 +72,7 @@ test "iterator: reset functionality" { | ||
| 72 | 72 | |
| 73 | 73 | test "iterator: captures in iteration" { |
| 74 | 74 | const allocator = std.testing.allocator; |
| 75 | var regex = try Regex.compile(allocator, "(\\w+)@(\\w+)"); | |
| 75 | var regex = try Regex.compile(allocator, std.testing.io, "(\\w+)@(\\w+)"); | |
| 76 | 76 | defer regex.deinit(); |
| 77 | 77 | |
| 78 | 78 | const text = "user@example and admin@test"; |
| @@ -94,7 +94,7 @@ test "iterator: captures in iteration" { | ||
| 94 | 94 | |
| 95 | 95 | test "iterator: large input streaming" { |
| 96 | 96 | const allocator = std.testing.allocator; |
| 97 | var regex = try Regex.compile(allocator, "\\d+"); | |
| 97 | var regex = try Regex.compile(allocator, std.testing.io, "\\d+"); | |
| 98 | 98 | defer regex.deinit(); |
| 99 | 99 | |
| 100 | 100 | // Simulate processing large input without loading all matches |
| @@ -115,7 +115,7 @@ test "iterator: large input streaming" { | ||
| 115 | 115 | |
| 116 | 116 | test "iterator: manual loop pattern" { |
| 117 | 117 | const allocator = std.testing.allocator; |
| 118 | var regex = try Regex.compile(allocator, "[a-z]+"); | |
| 118 | var regex = try Regex.compile(allocator, std.testing.io, "[a-z]+"); | |
| 119 | 119 | defer regex.deinit(); |
| 120 | 120 | |
| 121 | 121 | const text = "hello world test"; |
| @@ -146,7 +146,7 @@ test "iterator: manual loop pattern" { | ||
| 146 | 146 | |
| 147 | 147 | test "iterator: memory efficiency" { |
| 148 | 148 | const allocator = std.testing.allocator; |
| 149 | var regex = try Regex.compile(allocator, "\\w+"); | |
| 149 | var regex = try Regex.compile(allocator, std.testing.io, "\\w+"); | |
| 150 | 150 | defer regex.deinit(); |
| 151 | 151 | |
| 152 | 152 | // Iterator should not allocate all matches at once |
| @@ -171,7 +171,7 @@ test "iterator: memory efficiency" { | ||
| 171 | 171 | |
| 172 | 172 | test "iterator: overlapping matches prevention" { |
| 173 | 173 | const allocator = std.testing.allocator; |
| 174 | var regex = try Regex.compile(allocator, "\\w\\w"); | |
| 174 | var regex = try Regex.compile(allocator, std.testing.io, "\\w\\w"); | |
| 175 | 175 | defer regex.deinit(); |
| 176 | 176 | |
| 177 | 177 | const text = "abcd"; |