-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Open
Labels
Description
In protobuf2, the syntax for proto
has syntax
as mandatory.
grammars-v4/protobuf/protobuf2/Protobuf2.g4
Lines 16 to 18 in 6b51773
proto | |
: syntax (importStatement | packageStatement | optionStatement | topLevelDef | emptyStatement_)* EOF | |
; |
This is wrong. The Protobuf2 spec says: proto = [syntax] { import | package | option | topLevelDef | emptyStatement }
(https://protobuf.dev/reference/protobuf/proto3-spec/#proto_file).
Consequently, it fails to parse the first example in the Extensions section in the programming guide (https://protobuf.dev/programming-guides/proto2/#ext-example).
// file kittens/video_ext.proto
import "kittens/video.proto";
import "media/user_content.proto";
package kittens;
// This extension allows kitten videos in a media.UserContent message.
extend media.UserContent {
// Video is a message imported from kittens/video.proto
repeated Video kitten_videos = 126;
}
I mentioned this problem in another comment, #4629 (comment), chasing down another problem.