purpleidea / mgmt

Next generation distributed, event-driven, parallel config management!
https://purpleidea.com/tags/mgmtconfig/
GNU General Public License v3.0
3.58k stars 311 forks source link

lang: interpolate: Fix string interpolation of dollar symbols #673

Closed frebib closed 2 years ago

frebib commented 2 years ago

Dollar symbols were failing to parse when not followed by a non-brace, non-dollar, non-EOF token and causing expected tests to fail. This simplifies the rules to allow the remaining tests to succeed.

Fix and reinstate the final few failing tests, and add another.

Allow any escape sequence to be matched so that invalid sequences produce a meaningful error message instead of a generic "cannot parse":

ast: interpolate: interpolating: V: \?
unhandled escape sequence token: \?

Tidy the related Makefile rule for generating the ragel parser.

Signed-off-by: Joe Groocock me@frebib.net

frebib commented 2 years ago

Hopefully CI passes this time now. As long as you're happy with my comments I think this is good to go

purpleidea commented 2 years ago

LGTM, great work!

purpleidea commented 2 years ago

Great patch is now merged. Thanks again. @roidelapluie AFAICT we now have 0 interpolation bugs. I dare you to find one. Thanks for finding the first one =D