Skip to content

[protobuf2] The applied occurrence of syntax should not be mandatory. #4635

@kaby76

Description

@kaby76

In protobuf2, the syntax for proto has syntax as mandatory.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions