yarpc / yarpc-go

A message passing platform for Go
MIT License
404 stars 102 forks source link

Unexpected interpolation output #1879

Closed purpleidea closed 4 years ago

purpleidea commented 4 years ago

Looking at this test:

https://github.com/yarpc/yarpc-go/blob/dc33049fffa36ab75c07d422544df1c7b0ce2bdd/internal/interpolate/parse_test.go#L76

I am surprised by two things:

1) That $foo by itself without the curly brackets isn't seen as a variable. Is there a reason for this?

2) The output contains two string literals right after each other: $f and oo. If you assume it's not a variable, I wouldn't expect to see them joined together as one. I'm curious if something strange is going on with the lexer/parser. I've not used rygel, is there a guide to building the grammar? I'd normally just join the two string literals, except it's a problem to do so because:

3) ... they're all private. literal( and variable should be public, and...

4) ... This is in an "internal" package. I'd like to use and contribute to this externally. Can it be split off into either a separate project, or at least put somewhere non-"internal"? Otherwise I'll just fork, but then you won't get improvements.

If you'd like any of these comments to be split into separate issues, please let me know!

Thanks!

purpleidea commented 4 years ago

NOTES: To build rygel: https://github.com/yarpc/yarpc-go/commit/9f8be5dbc113ba551c61aef4cec9104b84139a56#diff-7dfd41fda74557e74b129ac111f3c66bR87

peats-bond commented 4 years ago

Hey @purpleidea, here's more information on ragel: http://www.colm.net/open-source/ragel/

Unfortunately, we're not looking to modify or make this package public. Keeping it internal allows to iterate without worrying too much about API decisions – feel fee to fork as necessary!