-
Notifications
You must be signed in to change notification settings - Fork 22
Constant does not support MessageValue #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
question
Further information is requested
Comments
Can you give me the specific error message? diff --git a/_example/dump/main.go b/_example/dump/main.go
index 59ae9a4..edbd5a4 100644
--- a/_example/dump/main.go
+++ b/_example/dump/main.go
@@ -12,7 +12,7 @@ import (
)
var (
- proto = flag.String("proto", "_testdata/simple.proto", "path to the Protocol Buffer file")
+ proto = flag.String("proto", "_testdata/messageValue.proto", "path to the Protocol Buffer file")
debug = flag.Bool("debug", false, "debug flag to output more parsing process detail")
permissive = flag.Bool("permissive", true, "permissive flag to allow the permissive parsing rather than the just documented spec")
unordered = flag.Bool("unordered", false, "unordered flag to output another one without interface{}") 11:51:56 ~/yoheimuta/go-protoparser $ cat _testdata/messageValue.proto git/master
edition = "2023";
package foo;
import "google/protobuf/descriptor.proto";
message MyFeatures {
enum FeatureValue {
FEATURE_VALUE_UNKNOWN = 0;
VALUE1 = 1;
VALUE2 = 2;
}
FeatureValue feature_value = 1 [
targets = TARGET_TYPE_FIELD,
targets = TARGET_TYPE_FILE,
feature_support = {
edition_introduced: EDITION_2023,
edition_deprecated: EDITION_2024,
deprecation_warning: "Feature will be removed in 2025",
edition_removed: EDITION_2025,
},
edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" },
edition_defaults = { edition: EDITION_2024, value: "VALUE2" }
];
}
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The language spec: https://protobuf.dev/reference/protobuf/edition-2023-spec/#constant
States the following:
However, at the moment
Lexer
does notMessageValue
when reading constants: https://github.com/yoheimuta/go-protoparser/blob/master/lexer/constant.go#L11Without this support it's impossible to parse all possible values for options. Example from the impleminting editions support page:
However, this issue is not limited to editions, because any custom option which value type is a message, will be impossible to parse.
I understand, it's quite a complex thing to support, because it pulls in complete support of protobuf text format language. It also possible that parsing message values properly will introduce the backward-incompatibility in
*Option
types.The text was updated successfully, but these errors were encountered: