Emit `{}` around custom names followed by a regexp group. (#145) (#152)
* Emit `{}` around custom names followed by a regexp group. (#145)
This change fixes another case from #145. Here we need protect a `:foo`
group with `{}` braces if its followed by a matching group that may be
expressed as `(bar)`. Without this protection the second group may be
interpreted as a custom regexp for the first group. We want to generate
`{:foo}(bar)` and not `:foo(bar)`.
For the most part this change corresponds to this chromium commit:
https://chromium-review.googlesource.com/c/chromium/src/+/3315419
Note, however, this spec change includes an additional fix to check for
the next part being a segment wildcard. That additional check will need
to be added to the implementation in another change.
* Apply suggestions from code review
Co-authored-by: Domenic Denicola <d@domenic.me>