tags:

views:

18

answers:

1

I wrote:

a:
-b
-c

Parser understood it as:

!!map {
  ? !!str "a"
  : !!seq [
      !!str "b",
      !!str "c"
    ]
}

But I meant:

!!map {
  ? !!str "a"
  : !!null ""
}
!!seq [
  !!str "b",
  !!str "c"
]

The specification says:

The “-”, “?” and “:” characters used to denote block collection entries are perceived by people to be part of the indentation. This is handled on a case-by-case basis by the relevant productions.

So both interpretations are permissible? If not, can you point out section in specification which prevents it?

Depending on "case-by-case basis by the relevant productions" ? What are "relevant productions"?

A: 

Try this:

- a: 
- b
- c
%YAML 1.1
---
!!seq [
    !!map {
        ? !!str "a"
        : !!null "null",
    },
    !!str "b",
    !!str "c",
]
...