Skip to content

Allow whitespace and comments in identifiers when parsing #3281

Open
@paul35621

Description

@paul35621

It is allowed in Protocol Buffers to have whitespace and comments around the dots in identifiers. This is currently (version 5.2.1) not supported in the parser. It would be nice to have this.

As an example, consider the file google/ads/googleads/v18/common/user_lists.proto from the googleapis GitHub repository. Below the part of the file where it goes wrong. The identifier google.ads.googleads.v18.enums.LookalikeExpansionLevelEnum.LookalikeExpansionLevel is split over multiple lines.

message LookalikeUserListInfo {
  // Seed UserList ID from which this list is derived, provided by user.
  repeated int64 seed_user_list_ids = 1;

  // Expansion level, reflecting the size of the lookalike audience
  google.ads.googleads.v18.enums.LookalikeExpansionLevelEnum
      .LookalikeExpansionLevel expansion_level = 2;

  // Countries targeted by the Lookalike. Two-letter country code as defined by
  // ISO-3166
  repeated string country_codes = 3;
}

Parsing this file fails with error Syntax error in user_lists.proto:49:33: expected '=' but was 'e'. (line 49 is the line that starts with .LookalikeExpansionLevel)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions