protected Node composeMappingNode(String anchor) {
    MappingStartEvent startEvent = (MappingStartEvent) parser.getEvent();
    String tag = startEvent.getTag();
    Tag nodeTag;
    boolean resolved = false;
    if (tag == null || tag.equals("!")) {
      nodeTag = resolver.resolve(NodeId.mapping, null, startEvent.getImplicit());
      resolved = true;
    } else {
      nodeTag = new Tag(tag);
    }

    final List<NodeTuple> children = new ArrayList<NodeTuple>();
    MappingNode node =
        new MappingNode(
            nodeTag,
            resolved,
            children,
            startEvent.getStartMark(),
            null,
            startEvent.getFlowStyle());
    if (anchor != null) {
      anchors.put(anchor, node);
    }
    while (!parser.checkEvent(Event.ID.MappingEnd)) {
      composeMappingChildren(children, node);
    }
    Event endEvent = parser.getEvent();
    node.setEndMark(endEvent.getEndMark());
    return node;
  }
 protected void composeMappingChildren(List<NodeTuple> children, MappingNode node) {
   Node itemKey = composeKeyNode(node);
   if (itemKey.getTag().equals(Tag.MERGE)) {
     node.setMerged(true);
   }
   Node itemValue = composeValueNode(node);
   children.add(new NodeTuple(itemKey, itemValue));
 }