Review `enum`-s implementation
https://protobuf.dev/programming-guides/enum/
I guess the current implementation doesn't work well with unexpected enum values. Probably we should change mapping enum to Ada enumeration types and use integer types instead. This way we could have unknown enums that allow us to use extending enum declarations. With Ada 2022 Static predicate we can define enum values as static function that in its turn allows use them in case alternatives, etc.
enum Enum {
A = 0;
B = 1;
}
Should maps to
type Enum is new Integer;
subtype Enum_Known_Range is Enum 0 .. 1;
function A return Enum is (0);
function B return Enum is (1);
function To_String (Value : Enum_Known_Range) return String is
(case Value is
when A => "A",
when B => 'B');
-- What else?
Could it be optional or activated only if the enum values are not 0, 1, 2, ... ? I would like to keep the simple Ada enumeration types whenever possible. Are custom switches possible with protoc ? Alternatively we could have a config file for the Ada plug-in.