From 15a2b29e48f134bc93cfd0a3d8512001e9242f3d Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Mon, 3 Jun 2024 17:33:53 -0400 Subject: Rename package to new domain Rename the package to the new domain --- .../pratt/commands/impls/PreTernaryCommand.java | 83 ---------------------- 1 file changed, 83 deletions(-) delete mode 100644 JPratt/src/main/java/bjc/pratt/commands/impls/PreTernaryCommand.java (limited to 'JPratt/src/main/java/bjc/pratt/commands/impls/PreTernaryCommand.java') diff --git a/JPratt/src/main/java/bjc/pratt/commands/impls/PreTernaryCommand.java b/JPratt/src/main/java/bjc/pratt/commands/impls/PreTernaryCommand.java deleted file mode 100644 index 5d5cbe1..0000000 --- a/JPratt/src/main/java/bjc/pratt/commands/impls/PreTernaryCommand.java +++ /dev/null @@ -1,83 +0,0 @@ -package bjc.pratt.commands.impls; - -import bjc.pratt.ParserContext; -import bjc.pratt.blocks.ParseBlock; -import bjc.pratt.commands.AbstractInitialCommand; -import bjc.pratt.commands.CommandResult; -import bjc.pratt.commands.CommandResult.Status; -import bjc.pratt.tokens.Token; -import bjc.data.Tree; -import bjc.data.SimpleTree; -import bjc.utils.parserutils.ParserException; - -/** - * A prefix ternary operator, like an if/then/else group. - * - * @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 PreTernaryCommand extends AbstractInitialCommand { - private final Token trm; - - private final ParseBlock condBlock; - - private final ParseBlock opblock1; - private final ParseBlock opblock2; - - /** - * Create a new ternary statement. - * - * @param cond - * The block for handling the condition. - * - * @param op1 - * The block for handling the first operator. - * - * @param op2 - * The block for handling the second operator. - * - * @param term - * The token to use as the node for the AST. - */ - public PreTernaryCommand(final ParseBlock cond, final ParseBlock op1, - final ParseBlock op2, final Token term) { - super(); - - if(cond == null) - throw new NullPointerException("Cond block must not be null"); - else if(op1 == null) - throw new NullPointerException("Op block #1 must not be null"); - else if(op2 == null) throw new NullPointerException("Op block #2 must not be null"); - - condBlock = cond; - opblock1 = op1; - opblock2 = op2; - - trm = term; - } - - @Override - protected CommandResult intNullDenotation(final Token operator, final ParserContext ctx) - throws ParserException { - final CommandResult condRes = condBlock.parse(ctx); - if (condRes.status != Status.SUCCESS) return condRes; - Tree> cond = condRes.success(); - - final CommandResult op1Res = opblock1.parse(ctx); - if (op1Res.status != Status.SUCCESS) return op1Res; - Tree> op1 = op1Res.success(); - - final CommandResult op2Res = opblock2.parse(ctx); - if (op2Res.status != Status.SUCCESS) return op2Res; - Tree> op2 = op2Res.success(); - return CommandResult.success(new SimpleTree<>(trm, cond, op1, op2)); - } -} \ No newline at end of file -- cgit v1.2.3