public INode Build(INodeFactory nodeFactory, PseudoList defblocks) { if (defblocks == null) { throw new ArgumentNullException(nameof(defblocks)); } _nodeFactory = nodeFactory ?? throw new ArgumentNullException(nameof(nodeFactory)); _defblocks = defblocks.ToDictionary( x => x.GetSingleKeywordArgument <Symbol>(":name").Name, x => x.AsPseudoList()); var topBlocks = _defblocks .Values .Where(x => x.GetSingleArgumentAsBool(":is-top") == true) .ToList(); if (topBlocks.Count == 0) { throw new BuildingException("No top defblocks defined."); } if (topBlocks.Count > 1) { throw new BuildingException("More than one top defblock defined."); } var topBlock = topBlocks[0]; var topBlockContent = topBlock.GetFreeArguments(); var result = this.BuildContent(topBlockContent); return(result.Head.GetNode()); }