diff --git a/option.go b/option.go index d455238..ec85f59 100644 --- a/option.go +++ b/option.go @@ -197,7 +197,7 @@ func parseAggregateConstants(p *Parser, container interface{}) (list []*NamedLit } continue } - if tIDENT != tok { + if tIDENT != tok && !isKeyword(tok) { err = p.unexpected(lit, "option aggregate key", container) return } diff --git a/option_test.go b/option_test.go index c26900a..7ac9ba7 100644 --- a/option_test.go +++ b/option_test.go @@ -372,3 +372,15 @@ func TestMultiLineOptionAggregateValue(t *testing.T) { t.Errorf("got [%v] want [%v]", got, want) } } + +// issue #76 +func TestOptionAggregateCanUseKeyword(t *testing.T) { + src := `message User { + string email = 3 [(validate.field) = {required: true}]; + }` + p := newParserOn(src) + _, err := p.Parse() + if err != nil { + t.Error(err) + } +}