~bigbes/tarantool-protobuf: 0044b163

codegen: text-format printer (pb.text.encode + <Msg>_text wrappers)

Adds a descriptor-driven text-format encoder mirroring `protoc --decode`
output: one field per line, 2-space indent, octal byte escapes,
`nan`/`inf` floats, `opts.single_line=true` for compact one-liners.
WKT-aware — Timestamp/Duration accept datetime cdata or {seconds,nanos},
wrappers print their unwrapped scalar, Struct/Value/ListValue walk the
tagged-table form, FieldMask flattens to `paths:` lines, Any stays
opaque.

Both codegen modes emit `M.<Type>_text(t, opts)`, surfaced as `pb.text`
on the public table. Encode-only; matching parser deferred.

Tests cover scalars, repeated, maps, oneof, optional presence, all WKT
types, single-line mode, and the generated wrapper across both modes
(74 cases). 403/403 luatest green, 19/19 jit-trace gate green.

Eugene Blikh <bigbes@gmail.com> — 2026-05-15 18:41:24 UTC

Commit 0044b1632684703ed499d1d7d6742536ff09c18eview raw patch

Parent(s): b75b8791

12 changed file(s)

FileStatus+
cmd/protoc-gen-tarantool/internal/gen/emmylua.go M +5
cmd/protoc-gen-tarantool/internal/gen/gen.go M +2
cmd/protoc-gen-tarantool/internal/gen/inline.go M +2
examples/expected/full/conformance/conformance_pb.lua M +20
examples/expected/full/hello/hello_pb.lua M +24
examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua M +20
examples/expected/runtime/conformance/conformance_pb.lua M +20
examples/expected/runtime/hello/hello_pb.lua M +24
examples/expected/runtime/protobuf_test_messages/proto3/test_messages_proto3_pb.lua M +20
runtime/pb/init.lua M +5
runtime/pb/text.lua A +409
test/text_test.lua A +274