toml-lang / toml

Tom's Obvious, Minimal Language
https://toml.io
MIT License
19.45k stars 847 forks source link

TABLE: Current and previous block pointer #930

Closed byehack closed 1 year ago

byehack commented 1 year ago

This is basic idea, need to have more discussion.

OLD

[[fruits]]
name = "apple"

[fruits.physical]  # subtable
color = "red"
shape = "round"

[[fruits.varieties]]  # nested array of tables
name = "red delicious"

[[fruits.varieties]]
name = "granny smith"

[[fruits]]
name = "banana"

[[fruits.varieties]]
name = "plantain"

NEW

[^.physical] # subtable color = "red" shape = "round"

[[^.varieties]] # nested array of tables name = "red delicious"

[[+]] name = "granny smith"

[[^]] name = "banana"

[[^.varieties]] name = "plantain"


## Json:
```json
{
  "fruits": [
    {
      "name": "apple",
      "physical": {
        "color": "red",
        "shape": "round"
      },
      "varieties": [
        { "name": "red delicious" },
        { "name": "granny smith" }
      ]
    },
    {
      "name": "banana",
      "varieties": [
        { "name": "plantain" }
      ]
    }
  ]
}
arp242 commented 1 year ago

Previous: #744, #781

byehack commented 1 year ago

Oh, right. Sorry for my duplicate request.

arp242 commented 1 year ago

No worries; can be difficult to find these things sometimes.