abhabongse / paxter

Document-first text pre-processing mini-language loosely inspired by @-expressions in Racket

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Break previous specification by making the key part of kv-pair optional (instead of the value part)

abhabongse opened this issue · comments

Warning: breaking change!

Previously, the options [k1,k2=v2,k3="v3",k4=4] will be parsed to:

[
    (Identifier("k1"), None),
    (Identifier("k2"), Identifier("v2")),
    (Identifier("k3"), Literal("v3")),
    (Identifier("k4"), Literal(4)),
]

Now, for each key-value pair, the key part will be optional instead of the value part.
Thus, the parsed option will be:

[
    (None, Identifier("k1")),
    (Identifier("k2"), Identifier("v2")),
    (Identifier("k3"), Literal("v3")),
    (Identifier("k4"), Literal(4)),
]

This allows for a bare literal as a valid key-value pair.
For example. the options [v1,"v2",3,k4=v4,k5="v5",k6=6] will be successfully parsed to:

[
    (None, Identifier("v1")),
    (None, Literal("v2")),
    (None, Literal(3)),
    (Identifier("k4"), Identifier("v4")),
    (Identifier("k5"), Literal("v5")),
    (Identifier("k6"), Literal(6)),
]

Would be a good idea to do this before continuing on #14