Closed Gladskih closed 3 years ago
Hmmm, it's been quite a while since I've visited that pattern. It might very well be a poorly-formed regex :P
In any case, since negation of a value would be semantically significant, I'd try to handle it at the parser level, as opposed to tokenization (which would instead only capture a string containing !"my value"
).
I threw together a branch doing so — check out PR #2. The main change to the grammar is:
settings: string
| "!" string -> negated_settings
| LITERAL
Then, in the transformer, I convert those negated_settings
nodes to a special str
subclass; these negated settings strings have a property is_negated
, which is true. For compatibility, regular, non-negated settings strings now also have this property (where it's false).
Lemme know if that fits your needs.
Nice fix. Thanks. But then I fall into next issue.
I fixed this with #2, and version 0.2.1. By next issue, did you mean another ticket? Or something related to this one?
Another
How did you construct regex for setting values in _parser.py
? I'm trying to figure out how to fix it allowing negative patterns like in
content:!"unwanted"
and not to break something else. The most confusing part is(?!\\)\\
. Is not it self contradicting?