Expand description
Field-path helpers shared by the parser, evaluator, and converters.
Array selectors ([any], [all], [N], …) are written in brackets on a
field path. To keep a literal bracket expressible in a field name, a literal
[ or ] is escaped as \[ / \] (mirroring Sigma’s \* / \? wildcard
escaping). Only an unescaped bracket opens a selector; an escaped one is a
literal part of the field name and is unescaped before the field is resolved.
Functions§
- ends_
with_ unescaped - Whether
sends with the ASCII bytechand that byte is not escaped. - escape_
brackets - Escape every unescaped
[and]as\[/\], leaving already-escaped brackets and every other character untouched. The inverse ofunescape_brackets. Used to render a field name whose brackets must be read literally (for example below the array-matching spec version), so the escape-aware field resolver does not treat a trailing[...]as a selector. Returns a borrow when there is nothing to escape (the common case). - first_
unescaped - Index of the first occurrence of the ASCII byte
chthat is not escaped by an immediately preceding backslash.chmust be ASCII ([or]here); scanning bytes is safe because those never appear inside a UTF-8 multibyte sequence. - unescape_
brackets - Unescape
\[and\]into literal[and]. Any other backslash is left untouched. Returns a borrow when there is nothing to unescape (the common case), so non-escaped field names never allocate.