Use a proper parser for the path template syntax #121
Labels
generator
Issues related to the code generator
priority: p3
Desirable enhancement or fix. May not be included in next release.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
We are using a regular expression to parse the path templates:
google-cloud-rust/generator/internal/genclient/model.go
Line 22 in 61b9d3b
However, path templates cannot be parsed by regular expressions. Their grammar uses recursion:
google-cloud-rust/generator/testdata/googleapis/google/api/http.proto
Lines 229 to 234 in 61b9d3b
And therefore they form a non-regular language and require more than regular expressions to parse them correctly. Regular expressions will serve us well for a while, as very few services use the more complex forms of this grammar.
A small recursive descent parser can take care of this:
https://github.com/googleapis/google-cloud-cpp/blob/4174d656136f4b849c8a3d327237f3a96be3e003/generator/internal/http_annotation_parser.cc#L230-L250
The text was updated successfully, but these errors were encountered: