Skip to content
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

Parse error on reserved keyword in enumerations #264

Open
riz0id opened this issue Jan 15, 2025 · 1 comment
Open

Parse error on reserved keyword in enumerations #264

riz0id opened this issue Jan 15, 2025 · 1 comment
Assignees
Labels

Comments

@riz0id
Copy link
Collaborator

riz0id commented Jan 15, 2025

The proto3-suite parser does not know how to interpret uses of the reserved keyword inside of enum statements. For example, the following protocol buffer:

syntax = "proto3";
package TestReservedEnum;

enum ReservedEnum {
  reserved 1, 2 to 8;
  UNSPECIFIED = 0;
}

will produce the following error when given as input to the compile-proto-file executable:

CompileParseError "/Users/jacob.leach/Documents/Haskell/proto3-suite/enum_test.proto" (line 7, column 12):
unexpected "1"
expecting "="

We should be able to parse reserved in enum statements according the proto2/proto3 "specification", see: https://protobuf.dev/programming-guides/proto3/#reserved.

@riz0id riz0id self-assigned this Jan 15, 2025
@riz0id
Copy link
Collaborator Author

riz0id commented Jan 15, 2025

@j6carey notes that it would be nice if a code generation error was issued whenever a reserved name or field number is used for something else.

@riz0id riz0id added the bug label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant