Add quoted glob syntax for addressing wildcardless glob round-trip contract violation #50

Closed
opened 2026-08-02 09:24:36 +00:00 by UserCurt · 1 comment
Owner

Using DotGlob directly in constructing MPath pointers can violate the Pointer string round-trip contract because some dot globs cannot be represented in parsable form.

To address this bug, this issue proposes an enhancement feature where quoted strings can have a prefix to specify the string is parsed as a DotGlob:

  • /"hello world" stays as an exact member
  • /g"hello*world" is a regular glob but quoted
  • /g"hello world" represents a wildcard-free glob
  • /g"" would be an empty glob

In implementation, the tokenizer should allow a prefix of any length. The parser should accept no prefix for DotExact and g for DotGlob, where other prefixes should error. This allows for future prefix r for regular expressions #4.

Conversion of DotGlob to a string should omit the prefixed string representation when unnecessary but use g"..." when there is an absence of wildcards.

Character escaping is as expected:

  • * and ? are wildcards.
  • \* and \? are literal characters.
  • \" represents a quote.
  • \\ represents a backslash.
Using `DotGlob` directly in constructing MPath pointers can violate the Pointer string round-trip contract because some dot globs cannot be represented in parsable form. To address this bug, this issue proposes an enhancement feature where quoted strings can have a prefix to specify the string is parsed as a `DotGlob`: - `/"hello world"` stays as an exact member - `/g"hello*world"` is a regular glob but quoted - `/g"hello world"` represents a wildcard-free glob - `/g""` would be an empty glob In implementation, the tokenizer should allow a prefix of any length. The parser should accept no prefix for `DotExact` and `g` for `DotGlob`, where other prefixes should error. This allows for future prefix `r` for regular expressions #4. Conversion of `DotGlob` to a string should omit the prefixed string representation when unnecessary but use `g"..."` when there is an absence of wildcards. Character escaping is as expected: - `*` and `?` are wildcards. - `\*` and `\?` are literal characters. - `\"` represents a quote. - `\\` represents a backslash.
UserCurt added this to the Release v1 milestone 2026-08-02 09:24:36 +00:00
Author
Owner

Implemented in 9a56957 as described. It was implemented in such a way that other prefixes can be easily added, such as r for regular expressions in the future. Round-trip string tests were updated too.

Implemented in `9a56957` as described. It was implemented in such a way that other prefixes can be easily added, such as `r` for regular expressions in the future. Round-trip string tests were updated too.
Sign in to join this conversation.
No description provided.