78d234c1
runtime: pb.from_pb — build modules from a binary FileDescriptorSet
Complements pb.parse (which consumes .proto source) by accepting the
output of `protoc --descriptor_set_out=...`. Returns
{files={[name]=module}, order, lookup} where each per-file module has
the same shape as pb.parse() output.
Pipeline: hand-built descriptor.proto descriptors in descriptor_pb.lua
decode the wire bytes via pb.codec; fileset.lua translates each
FileDescriptorProto into the AST shape pb.parser emits;
pb.dynamic.build consumes the AST.
Handles map-entry reconstruction (synthetic entry messages skipped from
nested_messages, key/value lifted to the AST map field), proto3_optional
rehydrated as optional=true rather than a synthetic oneof, oneof
grouping, nested types, WKT references.
Tests parity against the statically-generated hello module — 17 cases
covering scalars/repeated/optional/oneof/maps/self-reference/enums/WKTs
plus a full round-trip. 403/403 luatest green.
Eugene Blikh <bigbes@gmail.com> — 2026-05-15 18:41:52 UTC
Commit 78d234c122d158e32b053dd179a92b12e1b06834 —
view raw patch
Parent(s):
0044b163
| File | Status | + | − |
|---|---|---|---|
runtime/pb/descriptor_pb.lua
|
A | +151 | |
runtime/pb/fileset.lua
|
A | +275 | |
runtime/pb/init.lua
|
M | +13 | |
test/fileset_test.lua
|
A | +168 |