// If this key starts a new block mapping, we need to add
// BLOCK-MAPPING-START.
if (this.flowLevel == 0) {
if (addIndent(key.getColumn())) {
this.tokens.add(key.getTokenNumber() - this.tokensTaken,
new BlockMappingStartToken(key.getMark(), key.getMark()));
}
}
// There cannot be two simple keys one after another.
this.allowSimpleKey = false;
} else {// It must be a part of a complex key.
// Block context needs additional checks.Do we really need them?
// They
// will be catched by the parser anyway.)
if (this.flowLevel == 0) {
// We are allowed to start a complex value if and only if we can
// start a simple key.
if (!this.allowSimpleKey) {
throw new ScannerException(null, null, "mapping values are not allowed here",
reader.getMark());
}
}
// If this value starts a new block mapping, we need to add
// BLOCK-MAPPING-START. It will be detected as an error later by
// the parser.
if (flowLevel == 0) {
if (addIndent(reader.getColumn())) {
Mark mark = reader.getMark();
this.tokens.add(new BlockMappingStartToken(mark, mark));
}
}
// Simple keys are allowed after ':' in the block context.
allowSimpleKey = (flowLevel == 0);