in lib/src/scanner.dart [706:746]
void _fetchValue() {
var simpleKey = _simpleKeys.last;
if (simpleKey != null) {
// Add a [TokenType.KEY] directive before the first token of the simple
// key so the parser knows that it's part of a key/value pair.
_tokens.insert(simpleKey.tokenNumber - _tokensParsed,
Token(TokenType.key, simpleKey.location.pointSpan() as FileSpan));
// In the block context, we may need to add the
// [TokenType.BLOCK_MAPPING_START] token.
_rollIndent(
simpleKey.column, TokenType.blockMappingStart, simpleKey.location,
tokenNumber: simpleKey.tokenNumber);
// Remove the simple key.
_simpleKeys[_simpleKeys.length - 1] = null;
// A simple key cannot follow another simple key.
_simpleKeyAllowed = false;
} else if (_inBlockContext) {
if (!_simpleKeyAllowed) {
throw YamlException(
'Mapping values are not allowed here. Did you miss a colon '
'earlier?',
_scanner.emptySpan);
}
// If we're here, we've found the ':' indicator following a complex key.
_rollIndent(
_scanner.column, TokenType.blockMappingStart, _scanner.location);
_simpleKeyAllowed = true;
} else if (_simpleKeyAllowed) {
// If we're here, we've found the ':' indicator with an empty key. This
// behavior differs from libyaml, which disallows empty implicit keys.
_simpleKeyAllowed = false;
_addCharToken(TokenType.key);
}
_addCharToken(TokenType.value);
}