protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

enumField grammar doesn't allow negative values

Open stepancheg opened this issue 7 years ago • 1 comments
trafficstars

Grammar of enumField:

enumField = ident "=" intLit [ "[" enumValueOption { ","  enumValueOption } "]" ]";"
intLit     = decimalLit | octalLit | hexLit
decimalLit = ( "1" … "9" ) { decimalDigit }
octalLit   = "0" { octalDigit }
hexLit     = "0" ( "x" | "X" ) hexDigit { hexDigit } 

So this should be invalid enum field declaration because negative values are not allowed.

SPARSE_D = -15;

However, this declaration exists in protobuf unittest.

stepancheg avatar Apr 26 '18 17:04 stepancheg

This appears to have been fixed. The grammars for both proto2 and proto3 both now have the following production, explicitly allowing a minus sign:

enumField = ident "=" [ "-" ] intLit [ "[" enumValueOption { ","  enumValueOption } "]" ]";"

jhump avatar Sep 07 '22 14:09 jhump

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

github-actions[bot] avatar Jun 02 '24 10:06 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar Jun 19 '24 10:06 github-actions[bot]