@voxgig/sdkgen 4.8.3 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/package.json +1 -1
  3. package/project/.sdk/model/target/zig.aon +9 -0
  4. package/project/.sdk/src/cmp/zig/Package_zig.ts +15 -11
  5. package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +3 -3
  6. package/project/.sdk/src/cmp/zig/fragment/EntityListOp.fragment.zig +3 -3
  7. package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +3 -3
  8. package/project/.sdk/src/cmp/zig/utility_zig.ts +50 -1
  9. package/project/.sdk/tm/c/tests/vendor/omni/json.c +2 -2
  10. package/project/.sdk/tm/c/tests/vendor/omni/omni.h +2 -2
  11. package/project/.sdk/tm/c/tests/vendor/omni/runner.c +2 -2
  12. package/project/.sdk/tm/c/tests/vendor/omni/util.c +2 -2
  13. package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/json.clj +2 -2
  14. package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/runner.clj +2 -2
  15. package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/util.clj +2 -2
  16. package/project/.sdk/tm/cpp/test/vendor/omni/json.hpp +2 -2
  17. package/project/.sdk/tm/cpp/test/vendor/omni/omni.hpp +2 -2
  18. package/project/.sdk/tm/cpp/test/vendor/omni/util.hpp +2 -2
  19. package/project/.sdk/tm/csharp/test/vendor/omni/Runner.cs +2 -2
  20. package/project/.sdk/tm/csharp/test/vendor/omni/Util.cs +2 -2
  21. package/project/.sdk/tm/csharp/utility/struct/Struct.cs +1 -1
  22. package/project/.sdk/tm/dart/test/vendor/omni/omni.dart +2 -2
  23. package/project/.sdk/tm/dart/test/vendor/omni/runner.dart +2 -2
  24. package/project/.sdk/tm/dart/test/vendor/omni/util.dart +2 -2
  25. package/project/.sdk/tm/elixir/test/vendor/omni/json.ex +2 -2
  26. package/project/.sdk/tm/elixir/test/vendor/omni/runner.ex +2 -2
  27. package/project/.sdk/tm/elixir/test/vendor/omni/util.ex +2 -2
  28. package/project/.sdk/tm/go/feature/secrets/plugin/capability.go +1 -1
  29. package/project/.sdk/tm/go/feature/secrets/plugin/catalog.go +1 -1
  30. package/project/.sdk/tm/go/feature/secrets/plugin/config.go +1 -1
  31. package/project/.sdk/tm/go/feature/secrets/plugin/depend.go +1 -1
  32. package/project/.sdk/tm/go/feature/secrets/plugin/env.go +1 -1
  33. package/project/.sdk/tm/go/feature/secrets/plugin/export.go +1 -1
  34. package/project/.sdk/tm/go/feature/secrets/plugin/graph.go +1 -1
  35. package/project/.sdk/tm/go/feature/secrets/plugin/host.go +1 -1
  36. package/project/.sdk/tm/go/feature/secrets/plugin/order.go +1 -1
  37. package/project/.sdk/tm/go/feature/secrets/plugin/point.go +1 -1
  38. package/project/.sdk/tm/go/feature/secrets/plugin/ref.go +1 -1
  39. package/project/.sdk/tm/go/feature/secrets/plugin/resolve.go +1 -1
  40. package/project/.sdk/tm/go/feature/secrets/plugin/types.go +1 -1
  41. package/project/.sdk/tm/go/feature/secrets/plugin/util.go +1 -1
  42. package/project/.sdk/tm/go/feature/secrets/plugin/version.go +1 -1
  43. package/project/.sdk/tm/go/feature/secrets/plugins/aws/aws.go +4 -4
  44. package/project/.sdk/tm/go/feature/secrets/plugins/aws/sigv4.go +2 -2
  45. package/project/.sdk/tm/go/feature/secrets/plugins/azuresecrets/azuresecrets.go +2 -2
  46. package/project/.sdk/tm/go/feature/secrets/plugins/boru/boru.go +2 -2
  47. package/project/.sdk/tm/go/feature/secrets/plugins/doppler/doppler.go +2 -2
  48. package/project/.sdk/tm/go/feature/secrets/plugins/gcpsecrets/gcpsecrets.go +2 -2
  49. package/project/.sdk/tm/go/feature/secrets/plugins/hashicorp/hashicorp.go +4 -5
  50. package/project/.sdk/tm/go/feature/secrets/plugins/httpjson/httpjson.go +3 -3
  51. package/project/.sdk/tm/go/feature/secrets/plugins/infisical/infisical.go +3 -4
  52. package/project/.sdk/tm/go/feature/secrets/plugins/onepassword/onepassword.go +2 -2
  53. package/project/.sdk/tm/go/feature/secrets/plugins/secretspec/secretspec.go +2 -2
  54. package/project/.sdk/tm/go/feature/secrets/sekreto/addr.go +2 -2
  55. package/project/.sdk/tm/go/feature/secrets/sekreto/providers.go +5 -2
  56. package/project/.sdk/tm/go/feature/secrets/sekreto/sekreto.go +31 -2
  57. package/project/.sdk/tm/go/test/omni/omni.go +8 -3
  58. package/project/.sdk/tm/go/test/omni/util.go +25 -4
  59. package/project/.sdk/tm/go/utility/struct/voxgigstruct.go +1 -1
  60. package/project/.sdk/tm/java/test/vendor/omni/Json.java +2 -2
  61. package/project/.sdk/tm/java/test/vendor/omni/Runner.java +2 -2
  62. package/project/.sdk/tm/java/test/vendor/omni/Util.java +2 -2
  63. package/project/.sdk/tm/java/utility/struct/Struct.java +1 -1
  64. package/project/.sdk/tm/js/src/utility/StructUtility.js +2 -2
  65. package/project/.sdk/tm/js/test/vendor/omni/index.js +1 -1
  66. package/project/.sdk/tm/js/test/vendor/omni/runner.js +18 -3
  67. package/project/.sdk/tm/js/test/vendor/omni/util.js +25 -8
  68. package/project/.sdk/tm/kotlin/test/vendor/omni/Json.kt +2 -2
  69. package/project/.sdk/tm/kotlin/test/vendor/omni/Runner.kt +2 -2
  70. package/project/.sdk/tm/kotlin/test/vendor/omni/Util.kt +2 -2
  71. package/project/.sdk/tm/kotlin/utility/struct/Struct.kt +1 -1
  72. package/project/.sdk/tm/lean/test/vendor/omni/Omni.lean +2 -2
  73. package/project/.sdk/tm/lua/test/vendor/omni/json.lua +2 -2
  74. package/project/.sdk/tm/lua/test/vendor/omni/regex.lua +2 -2
  75. package/project/.sdk/tm/lua/test/vendor/omni/runner.lua +2 -2
  76. package/project/.sdk/tm/lua/test/vendor/omni/util.lua +2 -2
  77. package/project/.sdk/tm/lua/utility/struct/regex.lua +1 -1
  78. package/project/.sdk/tm/lua/utility/struct/struct.lua +1 -1
  79. package/project/.sdk/tm/ocaml/test/vendor/omni/omni.ml +2 -2
  80. package/project/.sdk/tm/perl/lib/Voxgig/Struct.pm +1 -1
  81. package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Runner.pm +1 -1
  82. package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Util.pm +1 -1
  83. package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni.pm +1 -1
  84. package/project/.sdk/tm/php/test/vendor/omni/Runner.php +2 -2
  85. package/project/.sdk/tm/php/test/vendor/omni/Util.php +2 -2
  86. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/__init__.py +1 -1
  87. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/capability.py +1 -1
  88. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/catalog.py +1 -1
  89. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/config.py +1 -1
  90. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/depend.py +1 -1
  91. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/env.py +1 -1
  92. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/export.py +1 -1
  93. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/graph.py +1 -1
  94. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/host.py +1 -1
  95. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/order.py +1 -1
  96. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/point.py +1 -1
  97. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/ref.py +1 -1
  98. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/resolve.py +1 -1
  99. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/types.py +1 -1
  100. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/version.py +1 -1
  101. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/__init__.py +3 -1
  102. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/addr.py +1 -1
  103. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/aws.py +3 -3
  104. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/azuresecrets.py +1 -1
  105. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/boru.py +1 -1
  106. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/doppler.py +1 -1
  107. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/gcpsecrets.py +1 -1
  108. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/hashicorp.py +3 -4
  109. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/httpjson.py +1 -1
  110. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/infisical.py +4 -6
  111. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/onepassword.py +1 -1
  112. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/secretspec.py +1 -1
  113. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/sigv4.py +1 -1
  114. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/providers.py +1 -1
  115. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/sekreto.py +21 -1
  116. package/project/.sdk/tm/py/pkg/utility/voxgig_struct/voxgig_struct.py +1 -1
  117. package/project/.sdk/tm/py/test/voxgig_omni/__init__.py +1 -1
  118. package/project/.sdk/tm/py/test/voxgig_omni/runner.py +16 -2
  119. package/project/.sdk/tm/py/test/voxgig_omni/util.py +27 -12
  120. package/project/.sdk/tm/rb/test/vendor/omni/runner.rb +2 -2
  121. package/project/.sdk/tm/rb/test/vendor/omni/util.rb +2 -2
  122. package/project/.sdk/tm/rb/test/vendor/omni/voxgig_omni.rb +2 -2
  123. package/project/.sdk/tm/rust/tests/vendor/omni/json.rs +2 -2
  124. package/project/.sdk/tm/rust/tests/vendor/omni/mod.rs +2 -2
  125. package/project/.sdk/tm/rust/tests/vendor/omni/regex.rs +2 -2
  126. package/project/.sdk/tm/rust/tests/vendor/omni/runner.rs +2 -2
  127. package/project/.sdk/tm/rust/tests/vendor/omni/util.rs +2 -2
  128. package/project/.sdk/tm/scala/sdktest/vendor/omni/Json.scala +2 -2
  129. package/project/.sdk/tm/scala/sdktest/vendor/omni/Runner.scala +2 -2
  130. package/project/.sdk/tm/scala/sdktest/vendor/omni/Util.scala +2 -2
  131. package/project/.sdk/tm/swift/Tests/vendor/omni/Json.swift +2 -2
  132. package/project/.sdk/tm/swift/Tests/vendor/omni/Runner.swift +2 -2
  133. package/project/.sdk/tm/swift/Tests/vendor/omni/Util.swift +2 -2
  134. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Capability.ts +1 -1
  135. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Catalog.ts +1 -1
  136. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Config.ts +1 -1
  137. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Depend.ts +1 -1
  138. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Env.ts +1 -1
  139. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Export.ts +1 -1
  140. package/project/.sdk/tm/ts/src/feature/secrets/plugin/FeatureHost.ts +1 -1
  141. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Graph.ts +1 -1
  142. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Host.ts +1 -1
  143. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Order.ts +1 -1
  144. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Point.ts +1 -1
  145. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Ref.ts +1 -1
  146. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Resolve.ts +1 -1
  147. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Types.ts +1 -1
  148. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Version.ts +1 -1
  149. package/project/.sdk/tm/ts/src/feature/secrets/plugin/index.ts +1 -1
  150. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/Sekreto.ts +1 -1
  151. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/index.ts +1 -1
  152. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/aws.ts +1 -1
  153. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/azuresecrets.ts +1 -1
  154. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/boru.ts +1 -1
  155. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/doppler.ts +1 -1
  156. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/gcpsecrets.ts +1 -1
  157. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/hashicorp.ts +1 -1
  158. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/httpjson.ts +1 -1
  159. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/infisical.ts +1 -1
  160. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/onepassword.ts +1 -1
  161. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/secretspec.ts +1 -1
  162. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/sigv4.ts +1 -1
  163. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/addr.ts +1 -1
  164. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/builtin.ts +1 -1
  165. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/dotenv.ts +1 -1
  166. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/env.ts +1 -1
  167. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/file.ts +1 -1
  168. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/memory.ts +1 -1
  169. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/support.ts +1 -1
  170. package/project/.sdk/tm/ts/src/utility/StructUtility.ts +2 -2
  171. package/project/.sdk/tm/ts/test/vendor/omni/Runner.ts +1 -1
  172. package/project/.sdk/tm/ts/test/vendor/omni/Util.ts +1 -1
  173. package/project/.sdk/tm/ts/test/vendor/omni/index.ts +1 -1
  174. package/project/.sdk/tm/zig/Makefile +15 -1
  175. package/project/.sdk/tm/zig/build.zig +23 -5
  176. package/project/.sdk/tm/zig/core/helpers.zig +52 -11
  177. package/project/.sdk/tm/zig/core/mem.zig +17 -1
  178. package/project/.sdk/tm/zig/core/utility.zig +23 -19
  179. package/project/.sdk/tm/zig/feature/audit.zig +2 -2
  180. package/project/.sdk/tm/zig/feature/cache.zig +2 -2
  181. package/project/.sdk/tm/zig/feature/debug.zig +5 -5
  182. package/project/.sdk/tm/zig/feature/netsim.zig +2 -2
  183. package/project/.sdk/tm/zig/feature/paging.zig +2 -2
  184. package/project/.sdk/tm/zig/feature/proxy.zig +15 -8
  185. package/project/.sdk/tm/zig/feature/streaming.zig +5 -5
  186. package/project/.sdk/tm/zig/feature/support.zig +3 -3
  187. package/project/.sdk/tm/zig/feature/telemetry.zig +5 -5
  188. package/project/.sdk/tm/zig/feature/test.zig +10 -5
  189. package/project/.sdk/tm/zig/test/fh.zig +10 -10
  190. package/project/.sdk/tm/zig/test/gotcha_test.zig +5 -5
  191. package/project/.sdk/tm/zig/test/omniresolver.zig +515 -0
  192. package/project/.sdk/tm/zig/test/omnismoke_test.zig +284 -0
  193. package/project/.sdk/tm/zig/test/pipeline_test.zig +8 -8
  194. package/project/.sdk/tm/zig/test/primary_utility_test.zig +144 -154
  195. package/project/.sdk/tm/zig/test/struct_corpus.zig +264 -187
  196. package/project/.sdk/tm/zig/test/vendor/omni/omni.zig +1314 -0
  197. package/project/.sdk/tm/zig/test/vendor/omni/regex.zig +446 -0
  198. package/project/.sdk/tm/zig/utility/voxgigstruct/regex.zig +7 -4
  199. package/project/.sdk/tm/zig/utility/voxgigstruct/struct.zig +356 -157
  200. package/project/sdkgen-package.json +1 -1
  201. package/project/.sdk/tm/zig/test/struct_runner.zig +0 -465
@@ -0,0 +1,446 @@
1
+ // VENDORED: @voxgig/omni sdk-20260907-0029-0 (zig/src/regex.zig)
2
+ // Source: https://github.com/voxgig/omni @ 274708cc2d12b21707d975543953f845f8444be0 [tag: sdk-20260907-0029-0]
3
+ // License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
4
+ //! A small backtracking regex engine.
5
+ //!
6
+ //! Omni specs match error messages with `/pattern/` expectations, so every
7
+ //! port needs a regex. Zig has none in its standard library, and omni adds
8
+ //! no dependencies, so it carries this one - a direct port of the Rust
9
+ //! engine (rust/src/regex.zig's sibling, rust/src/regex.rs).
10
+ //!
11
+ //! Supported: literals, `.`, `^`, `$`, `|`, groups `(...)`, classes
12
+ //! `[a-z0-9_]` and `[^...]`, quantifiers `* + ? {m} {m,} {m,n}` (greedy,
13
+ //! and lazy with a trailing `?`), and the escapes `\d \D \w \W \s \S \n
14
+ //! \r \t` plus any escaped punctuation.
15
+
16
+ const std = @import("std");
17
+
18
+ const ItemKind = enum { char, range, digit, word, space };
19
+
20
+ const ClassItem = struct {
21
+ kind: ItemKind,
22
+ ch: u8 = 0,
23
+ from: u8 = 0,
24
+ to: u8 = 0,
25
+ invert: bool = false,
26
+ };
27
+
28
+ const NodeKind = enum { char, any, class, start, end, seq, alt, repeat };
29
+
30
+ const Node = struct {
31
+ kind: NodeKind,
32
+ ch: u8 = 0,
33
+ items: []ClassItem = &.{},
34
+ negated: bool = false,
35
+ kids: []*Node = &.{},
36
+ inner: ?*Node = null,
37
+ min: usize = 0,
38
+ max: ?usize = null,
39
+ greedy: bool = true,
40
+ };
41
+
42
+ const ParseError = error{ BadRegex, OutOfMemory };
43
+
44
+ const Parser = struct {
45
+ alloc: std.mem.Allocator,
46
+ pattern: []const u8,
47
+ pos: usize = 0,
48
+
49
+ fn node(self: *Parser, value: Node) ParseError!*Node {
50
+ const out = try self.alloc.create(Node);
51
+ out.* = value;
52
+ return out;
53
+ }
54
+
55
+ fn done(self: *Parser) bool {
56
+ return self.pos >= self.pattern.len;
57
+ }
58
+
59
+ fn peek(self: *Parser) u8 {
60
+ return if (self.done()) 0 else self.pattern[self.pos];
61
+ }
62
+
63
+ fn parseAlt(self: *Parser) ParseError!*Node {
64
+ var branches: std.ArrayList(*Node) = .empty;
65
+ try branches.append(self.alloc, try self.parseSeq());
66
+
67
+ while (!self.done() and '|' == self.peek()) {
68
+ self.pos += 1;
69
+ try branches.append(self.alloc, try self.parseSeq());
70
+ }
71
+
72
+ if (1 == branches.items.len) {
73
+ return branches.items[0];
74
+ }
75
+
76
+ return self.node(.{ .kind = .alt, .kids = branches.items });
77
+ }
78
+
79
+ fn parseSeq(self: *Parser) ParseError!*Node {
80
+ var nodes: std.ArrayList(*Node) = .empty;
81
+
82
+ while (!self.done() and '|' != self.peek() and ')' != self.peek()) {
83
+ const atom = try self.parseAtom();
84
+ try nodes.append(self.alloc, try self.parseRepeat(atom));
85
+ }
86
+
87
+ return self.node(.{ .kind = .seq, .kids = nodes.items });
88
+ }
89
+
90
+ fn parseRepeat(self: *Parser, atom: *Node) ParseError!*Node {
91
+ if (self.done()) {
92
+ return atom;
93
+ }
94
+
95
+ var min: usize = 0;
96
+ var max: ?usize = null;
97
+
98
+ switch (self.peek()) {
99
+ '*' => {
100
+ self.pos += 1;
101
+ min = 0;
102
+ max = null;
103
+ },
104
+ '+' => {
105
+ self.pos += 1;
106
+ min = 1;
107
+ max = null;
108
+ },
109
+ '?' => {
110
+ self.pos += 1;
111
+ min = 0;
112
+ max = 1;
113
+ },
114
+ '{' => {
115
+ const bounds = self.parseCount() orelse return atom;
116
+ min = bounds.min;
117
+ max = bounds.max;
118
+ },
119
+ else => return atom,
120
+ }
121
+
122
+ var greedy = true;
123
+ if (!self.done() and '?' == self.peek()) {
124
+ greedy = false;
125
+ self.pos += 1;
126
+ }
127
+
128
+ return self.node(.{ .kind = .repeat, .inner = atom, .min = min, .max = max, .greedy = greedy });
129
+ }
130
+
131
+ const Bounds = struct { min: usize, max: ?usize };
132
+
133
+ fn parseCount(self: *Parser) ?Bounds {
134
+ const start = self.pos;
135
+ var scan = self.pos + 1;
136
+ var min: usize = 0;
137
+ var digits: usize = 0;
138
+
139
+ while (scan < self.pattern.len and std.ascii.isDigit(self.pattern[scan])) {
140
+ // A count too large to represent is not a count: treat the
141
+ // whole `{...}` as literal text (as the Rust port's
142
+ // `.parse().ok()?` does) rather than overflowing.
143
+ min = adddigit(min, self.pattern[scan]) orelse {
144
+ self.pos = start;
145
+ return null;
146
+ };
147
+ digits += 1;
148
+ scan += 1;
149
+ }
150
+
151
+ if (0 == digits) {
152
+ self.pos = start;
153
+ return null;
154
+ }
155
+
156
+ if (scan < self.pattern.len and '}' == self.pattern[scan]) {
157
+ self.pos = scan + 1;
158
+ return .{ .min = min, .max = min };
159
+ }
160
+
161
+ if (scan >= self.pattern.len or ',' != self.pattern[scan]) {
162
+ self.pos = start;
163
+ return null;
164
+ }
165
+ scan += 1;
166
+
167
+ var max: usize = 0;
168
+ var maxdigits: usize = 0;
169
+ while (scan < self.pattern.len and std.ascii.isDigit(self.pattern[scan])) {
170
+ max = adddigit(max, self.pattern[scan]) orelse {
171
+ self.pos = start;
172
+ return null;
173
+ };
174
+ maxdigits += 1;
175
+ scan += 1;
176
+ }
177
+
178
+ if (scan >= self.pattern.len or '}' != self.pattern[scan]) {
179
+ self.pos = start;
180
+ return null;
181
+ }
182
+
183
+ self.pos = scan + 1;
184
+ return .{ .min = min, .max = if (0 == maxdigits) null else max };
185
+ }
186
+
187
+ // Append one decimal digit to a repeat count, or null on overflow.
188
+ fn adddigit(count: usize, ch: u8) ?usize {
189
+ const scaled = std.math.mul(usize, count, 10) catch return null;
190
+ return std.math.add(usize, scaled, @as(usize, ch - '0')) catch return null;
191
+ }
192
+
193
+ fn escapeNode(self: *Parser, escape: u8) ParseError!*Node {
194
+ const items = try self.alloc.alloc(ClassItem, 1);
195
+
196
+ switch (escape) {
197
+ 'd', 'D' => items[0] = .{ .kind = .digit },
198
+ 'w', 'W' => items[0] = .{ .kind = .word },
199
+ 's', 'S' => items[0] = .{ .kind = .space },
200
+ 'n' => return self.node(.{ .kind = .char, .ch = '\n' }),
201
+ 'r' => return self.node(.{ .kind = .char, .ch = '\r' }),
202
+ 't' => return self.node(.{ .kind = .char, .ch = '\t' }),
203
+ else => return self.node(.{ .kind = .char, .ch = escape }),
204
+ }
205
+
206
+ const negated = 'D' == escape or 'W' == escape or 'S' == escape;
207
+ return self.node(.{ .kind = .class, .items = items, .negated = negated });
208
+ }
209
+
210
+ fn parseClass(self: *Parser) ParseError!*Node {
211
+ self.pos += 1; // [
212
+
213
+ var negated = false;
214
+ if (!self.done() and '^' == self.peek()) {
215
+ negated = true;
216
+ self.pos += 1;
217
+ }
218
+
219
+ var items: std.ArrayList(ClassItem) = .empty;
220
+ var first = true;
221
+
222
+ while (!self.done()) {
223
+ const ch = self.peek();
224
+
225
+ if (']' == ch and !first) {
226
+ self.pos += 1;
227
+ return self.node(.{ .kind = .class, .items = items.items, .negated = negated });
228
+ }
229
+ first = false;
230
+
231
+ if ('\\' == ch and self.pos + 1 < self.pattern.len) {
232
+ const escape = self.pattern[self.pos + 1];
233
+ self.pos += 2;
234
+ try items.append(self.alloc, switch (escape) {
235
+ 'd' => ClassItem{ .kind = .digit },
236
+ 'w' => ClassItem{ .kind = .word },
237
+ 's' => ClassItem{ .kind = .space },
238
+ 'n' => ClassItem{ .kind = .char, .ch = '\n' },
239
+ 'r' => ClassItem{ .kind = .char, .ch = '\r' },
240
+ 't' => ClassItem{ .kind = .char, .ch = '\t' },
241
+ else => ClassItem{ .kind = .char, .ch = escape },
242
+ });
243
+ continue;
244
+ }
245
+
246
+ self.pos += 1;
247
+
248
+ if (self.pos + 1 < self.pattern.len and '-' == self.pattern[self.pos] and
249
+ ']' != self.pattern[self.pos + 1])
250
+ {
251
+ const upto = self.pattern[self.pos + 1];
252
+ self.pos += 2;
253
+ try items.append(self.alloc, .{ .kind = .range, .from = ch, .to = upto });
254
+ continue;
255
+ }
256
+
257
+ try items.append(self.alloc, .{ .kind = .char, .ch = ch });
258
+ }
259
+
260
+ return ParseError.BadRegex;
261
+ }
262
+
263
+ fn parseAtom(self: *Parser) ParseError!*Node {
264
+ const ch = self.peek();
265
+
266
+ if ('(' == ch) {
267
+ self.pos += 1;
268
+
269
+ // Non-capturing group syntax is accepted and ignored.
270
+ if (self.pos + 1 < self.pattern.len and '?' == self.pattern[self.pos] and
271
+ ':' == self.pattern[self.pos + 1])
272
+ {
273
+ self.pos += 2;
274
+ }
275
+
276
+ const inner = try self.parseAlt();
277
+
278
+ if (self.done() or ')' != self.peek()) {
279
+ return ParseError.BadRegex;
280
+ }
281
+ self.pos += 1;
282
+
283
+ return inner;
284
+ }
285
+
286
+ if ('[' == ch) {
287
+ return self.parseClass();
288
+ }
289
+
290
+ if ('.' == ch) {
291
+ self.pos += 1;
292
+ return self.node(.{ .kind = .any });
293
+ }
294
+
295
+ if ('^' == ch) {
296
+ self.pos += 1;
297
+ return self.node(.{ .kind = .start });
298
+ }
299
+
300
+ if ('$' == ch) {
301
+ self.pos += 1;
302
+ return self.node(.{ .kind = .end });
303
+ }
304
+
305
+ if ('\\' == ch) {
306
+ self.pos += 1;
307
+ if (self.done()) {
308
+ return ParseError.BadRegex;
309
+ }
310
+ const escape = self.peek();
311
+ self.pos += 1;
312
+ return self.escapeNode(escape);
313
+ }
314
+
315
+ self.pos += 1;
316
+ return self.node(.{ .kind = .char, .ch = ch });
317
+ }
318
+ };
319
+
320
+ // ---- matching --------------------------------------------------------
321
+
322
+ const FrameKind = enum { seq, repeat };
323
+
324
+ const Frame = struct {
325
+ kind: FrameKind,
326
+ nodes: []*Node = &.{},
327
+ index: usize = 0,
328
+ node: ?*const Node = null,
329
+ count: usize = 0,
330
+ prevpos: usize = 0,
331
+ next: ?*const Frame = null,
332
+ };
333
+
334
+ fn isWord(ch: u8) bool {
335
+ return std.ascii.isAlphanumeric(ch) or '_' == ch;
336
+ }
337
+
338
+ fn classMatch(items: []const ClassItem, negated: bool, ch: u8) bool {
339
+ var hit = false;
340
+
341
+ for (items) |item| {
342
+ const ok = switch (item.kind) {
343
+ .char => ch == item.ch,
344
+ .range => item.from <= ch and ch <= item.to,
345
+ .digit => std.ascii.isDigit(ch),
346
+ .word => isWord(ch),
347
+ .space => std.ascii.isWhitespace(ch),
348
+ };
349
+ if (ok) {
350
+ hit = true;
351
+ break;
352
+ }
353
+ }
354
+
355
+ return hit != negated;
356
+ }
357
+
358
+ fn runFrame(frame: ?*const Frame, text: []const u8, pos: usize) bool {
359
+ const active = frame orelse return true;
360
+
361
+ switch (active.kind) {
362
+ .seq => {
363
+ if (active.index >= active.nodes.len) {
364
+ return runFrame(active.next, text, pos);
365
+ }
366
+ const nextframe = Frame{
367
+ .kind = .seq,
368
+ .nodes = active.nodes,
369
+ .index = active.index + 1,
370
+ .next = active.next,
371
+ };
372
+ return matchNode(active.nodes[active.index], text, pos, &nextframe);
373
+ },
374
+ .repeat => {
375
+ const node = active.node.?;
376
+ // A zero-width repeat would loop forever.
377
+ if (pos == active.prevpos) {
378
+ return active.count >= node.min and runFrame(active.next, text, pos);
379
+ }
380
+ return repeatStep(node, active.count, text, pos, active.next);
381
+ },
382
+ }
383
+ }
384
+
385
+ fn repeatStep(node: *const Node, count: usize, text: []const u8, pos: usize, next: ?*const Frame) bool {
386
+ const canmore = if (node.max) |limit| count < limit else true;
387
+
388
+ const frame = Frame{
389
+ .kind = .repeat,
390
+ .node = node,
391
+ .count = count + 1,
392
+ .prevpos = pos,
393
+ .next = next,
394
+ };
395
+
396
+ const takemore = canmore and matchNode(node.inner.?, text, pos, &frame);
397
+ const stopnow = count >= node.min and runFrame(next, text, pos);
398
+
399
+ if (node.greedy) {
400
+ return takemore or stopnow;
401
+ }
402
+ return stopnow or takemore;
403
+ }
404
+
405
+ fn matchNode(node: *const Node, text: []const u8, pos: usize, cont: ?*const Frame) bool {
406
+ switch (node.kind) {
407
+ .char => return pos < text.len and text[pos] == node.ch and runFrame(cont, text, pos + 1),
408
+ .any => return pos < text.len and runFrame(cont, text, pos + 1),
409
+ .class => return pos < text.len and classMatch(node.items, node.negated, text[pos]) and
410
+ runFrame(cont, text, pos + 1),
411
+ .start => return 0 == pos and runFrame(cont, text, pos),
412
+ .end => return text.len == pos and runFrame(cont, text, pos),
413
+ .seq => {
414
+ const frame = Frame{ .kind = .seq, .nodes = node.kids, .index = 0, .next = cont };
415
+ return runFrame(&frame, text, pos);
416
+ },
417
+ .alt => {
418
+ for (node.kids) |branch| {
419
+ if (matchNode(branch, text, pos, cont)) {
420
+ return true;
421
+ }
422
+ }
423
+ return false;
424
+ },
425
+ .repeat => return repeatStep(node, 0, text, pos, cont),
426
+ }
427
+ }
428
+
429
+ /// Is the pattern found anywhere in the text?
430
+ pub fn find(alloc: std.mem.Allocator, pattern: []const u8, text: []const u8) bool {
431
+ var parser = Parser{ .alloc = alloc, .pattern = pattern };
432
+
433
+ const root = parser.parseAlt() catch return false;
434
+ if (!parser.done()) {
435
+ return false;
436
+ }
437
+
438
+ var start: usize = 0;
439
+ while (start <= text.len) : (start += 1) {
440
+ if (matchNode(root, text, start, null)) {
441
+ return true;
442
+ }
443
+ }
444
+
445
+ return false;
446
+ }
@@ -1,3 +1,6 @@
1
+ // VENDORED: @voxgig/struct sdk-20260907-0029-0 (zig/src/regex.zig)
2
+ // Source: https://github.com/voxgig/struct @ adda9521c828147573df5a8878408a3f2193ddf4 [tag: sdk-20260907-0029-0]
3
+ // License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
1
4
  // Copyright (c) 2025-2026 Voxgig Ltd. MIT LICENSE.
2
5
  //
3
6
  // Voxgig Struct — RE2-subset regex engine, pure Zig, no third-party deps.
@@ -225,7 +228,7 @@ const Thread = struct {
225
228
 
226
229
  const ThreadList = struct {
227
230
  allocator: std.mem.Allocator,
228
- threads: std.ArrayList(Thread),
231
+ threads: std.array_list.Managed(Thread),
229
232
  visited: []u32,
230
233
  gen: u32 = 0,
231
234
 
@@ -234,7 +237,7 @@ const ThreadList = struct {
234
237
  @memset(v, 0);
235
238
  return .{
236
239
  .allocator = allocator,
237
- .threads = std.ArrayList(Thread).init(allocator),
240
+ .threads = std.array_list.Managed(Thread).init(allocator),
238
241
  .visited = v,
239
242
  .gen = 0,
240
243
  };
@@ -313,14 +316,14 @@ const Parser = struct {
313
316
  src: []const u8,
314
317
  pos: usize = 0,
315
318
  next_group: usize = 1,
316
- code: std.ArrayList(Insn),
319
+ code: std.array_list.Managed(Insn),
317
320
  err: ?[]const u8 = null,
318
321
 
319
322
  fn init(allocator: std.mem.Allocator, src: []const u8) Parser {
320
323
  return .{
321
324
  .allocator = allocator,
322
325
  .src = src,
323
- .code = std.ArrayList(Insn).init(allocator),
326
+ .code = std.array_list.Managed(Insn).init(allocator),
324
327
  };
325
328
  }
326
329