package bjc.pratt.commands.impls; import bjc.pratt.ParserContext; import bjc.pratt.commands.CommandResult; import bjc.pratt.commands.InitialCommand; import bjc.pratt.tokens.Token; import bjc.data.Tree; 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 final Tree> val; /** * Create a new constant. * * @param con * The tree this constant represents. */ public ConstantCommand(final Tree> con) { val = con; } @Override public CommandResult denote(final Token operator, final ParserContext ctx) throws ParserException { return CommandResult.success(val); } }