From 98cdf435d4974f4cca8f7b4eb4026da2c88cbc4c Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Sun, 26 Mar 2017 11:30:43 -0400 Subject: Update --- .../parserutils/pratt/commands/BinaryCommand.java | 28 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/parserutils/pratt/commands/BinaryCommand.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/parserutils/pratt/commands/BinaryCommand.java b/BJC-Utils2/src/main/java/bjc/utils/parserutils/pratt/commands/BinaryCommand.java index bf6786b..781309c 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/parserutils/pratt/commands/BinaryCommand.java +++ b/BJC-Utils2/src/main/java/bjc/utils/parserutils/pratt/commands/BinaryCommand.java @@ -6,16 +6,36 @@ import bjc.utils.parserutils.ParserException; import bjc.utils.parserutils.pratt.ParserContext; import bjc.utils.parserutils.pratt.Token; +/** + * A binary operator. + * + * @author bjculkin + * + * @param + * The key type of the tokens. + * + * @param + * The value type of the tokens. + * + * @param + * The state type of the parser. + */ public abstract class BinaryCommand extends BinaryPostCommand { - public BinaryCommand(int leftPower) { - super(leftPower); + /** + * Create a new binary operator with the specified precedence. + * + * @param precedence + * The precedence of the operator. + */ + public BinaryCommand(int precedence) { + super(precedence); } protected abstract int rightBinding(); @Override - public ITree> denote(ITree> operand, Token operator, - ParserContext ctx) throws ParserException { + public ITree> denote(ITree> operand, Token operator, ParserContext ctx) + throws ParserException { ITree> opr = ctx.parse.parseExpression(rightBinding(), ctx.tokens, ctx.state, false); return new Tree<>(operator, operand, opr); -- cgit v1.2.3