package bjc.pratt.commands; import bjc.pratt.InitialCommand; import bjc.pratt.ParserContext; import bjc.pratt.Token; import bjc.utils.data.ITree; import bjc.utils.parserutils.ParserException; /** * A command that denests a input tree. * * Useful for processing the result of passing a complex parse group to a * command. * * @author bjculkin * * @param * The key type of the tokens. * * @param * The value type of the tokens. * * @param * The state type of the parser. * */ public class DenestingCommand extends AbstractInitialCommand { private InitialCommand wrapped; /** * Create a new transforming initial command. * * @param internal * The initial command to delegate to. */ public DenestingCommand(InitialCommand internal) { wrapped = internal; } @Override protected ITree> intNullDenotation(Token operator, ParserContext ctx) throws ParserException { return wrapped.denote(operator, ctx).getChild(0); } }