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 represents a specific tree. * * @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 ConstantCommand implements InitialCommand { private ITree> val; /** * Create a new constant. * * @param con * The tree this constant represents. */ public ConstantCommand(ITree> con) { val = con; } @Override public ITree> denote(Token operator, ParserContext ctx) throws ParserException { return val; } }