projectsyn / reclass-rs

Reimplementation of https://github.com/kapicorp/reclass in Rust with Python bindings through PyO3.
BSD 3-Clause "New" or "Revised" License
8 stars 0 forks source link

Add support for escaped inventory query opening symbol #40

Closed simu closed 1 year ago

simu commented 1 year ago

Kapitan's fork of Python Reclass supports a second query type which is called "inventory queries", cf. https://github.com/kapicorp/reclass/blob/develop/README-extensions.rst#inventory-queries.

While we don't support inventory queries yet, this commit extends the reference parser to parse escaped inventory query opening symbols (\$[) the same way as the Python parser, by stripping the \ and producing a literal $[ token. This ensures that escaped inventory queries are parsed correctly by our parser.

Note that our parser doesn't actually parse inventory queries apart from escaped opening symbols. It still just produces a literal token for unescaped inventory queries. Additionally, a double-escaped inventory query is parsed as \ followed by an escaped opening symbol, resulting in a literal token \$[ in the output.

Checklist