in lib/src/parser.dart [425:458]
Event _parseBlockMappingKey() {
var token = _scanner.peek()!;
if (token.type == TokenType.key) {
var start = token.span.start;
token = _scanner.advance()!;
if (token.type == TokenType.key ||
token.type == TokenType.value ||
token.type == TokenType.blockEnd) {
_state = _State.BLOCK_MAPPING_VALUE;
return _processEmptyScalar(start);
} else {
_states.add(_State.BLOCK_MAPPING_VALUE);
return _parseNode(block: true, indentlessSequence: true);
}
}
// libyaml doesn't allow empty keys without an explicit key indicator, but
// the spec does. See example 8.18:
// http://yaml.org/spec/1.2/spec.html#id2798896.
if (token.type == TokenType.value) {
_state = _State.BLOCK_MAPPING_VALUE;
return _processEmptyScalar(token.span.start);
}
if (token.type == TokenType.blockEnd) {
_scanner.scan();
_state = _states.removeLast();
return Event(EventType.mappingEnd, token.span);
}
throw YamlException('Expected a key while parsing a block mapping.',
token.span.start.pointSpan());
}