Skip to content

Commit

Permalink
Merge pull request #112 from jhump/jh/fix-grammar-trailing-commas
Browse files Browse the repository at this point in the history
update grammar to allow trailing commas
  • Loading branch information
jhump authored Mar 2, 2018
2 parents cc4400e + f00f541 commit 19350c2
Show file tree
Hide file tree
Showing 11 changed files with 1,135 additions and 599 deletions.
12 changes: 7 additions & 5 deletions desc/protoparse/proto.y
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import (
%type <ui> intLit
%type <f> floatLit
%type <sl> constantList
%type <agg> aggFields aggField
%type <agg> aggFields aggField aggFieldEntry
%type <fld> field oneofField
%type <oo> oneof
%type <grp> group
Expand Down Expand Up @@ -306,14 +306,16 @@ aggFields : aggField
| aggFields aggField {
$$ = append($1, $2...)
}
| aggFields ',' aggField {
$$ = append($1, $3...)
}
| {
$$ = nil
}

aggField : aggName ':' scalarConstant {
aggField : aggFieldEntry
| aggFieldEntry ',' {
$$ = $1
}

aggFieldEntry : aggName ':' scalarConstant {
a := &aggregateEntryNode{name: $1, val: $3}
a.setRange($1, $3)
$$ = []*aggregateEntryNode{a}
Expand Down
Loading

0 comments on commit 19350c2

Please sign in to comment.