Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

Commit

Permalink
allow keywords in aggregate option values, issue emicklei#76
Browse files Browse the repository at this point in the history
  • Loading branch information
Ernest Micklei committed Apr 2, 2018
1 parent 5aae21d commit 80d3811
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion option.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
12 changes: 12 additions & 0 deletions option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit 80d3811

Please sign in to comment.