summaryrefslogtreecommitdiff
path: root/JPratt/src/main/java/bjc/pratt/commands/BinaryCommand.java
diff options
context:
space:
mode:
authorBen Culkin <scorpress@gmail.com>2020-10-06 19:16:12 -0400
committerBen Culkin <scorpress@gmail.com>2020-10-06 19:16:12 -0400
commit747bff446547120d3045685c0c1878251d24c382 (patch)
tree1c96d6047bb5fcf71e9d5f3de1034569f172a088 /JPratt/src/main/java/bjc/pratt/commands/BinaryCommand.java
parentf17d48c56ca631571f32a6e4e4436d244e976fdb (diff)
Info cleanup
Diffstat (limited to 'JPratt/src/main/java/bjc/pratt/commands/BinaryCommand.java')
-rw-r--r--JPratt/src/main/java/bjc/pratt/commands/BinaryCommand.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/JPratt/src/main/java/bjc/pratt/commands/BinaryCommand.java b/JPratt/src/main/java/bjc/pratt/commands/BinaryCommand.java
index 9cc4dc1..0b790ff 100644
--- a/JPratt/src/main/java/bjc/pratt/commands/BinaryCommand.java
+++ b/JPratt/src/main/java/bjc/pratt/commands/BinaryCommand.java
@@ -12,31 +12,38 @@ import bjc.utils.parserutils.ParserException;
* @author bjculkin
*
* @param <K>
- * The key type of the tokens.
+ * The key type of the tokens.
*
* @param <V>
- * The value type of the tokens.
+ * The value type of the tokens.
*
* @param <C>
- * The state type of the parser.
+ * The state type of the parser.
*/
public abstract class BinaryCommand<K, V, C> extends BinaryPostCommand<K, V, C> {
/**
* Create a new binary operator with the specified precedence.
*
* @param precedence
- * The precedence of the operator.
+ * The precedence of the operator.
*/
public BinaryCommand(final int precedence) {
super(precedence);
}
+ /**
+ * The right-binding power (right-precedence) of this command.
+ *
+ * @return The right binding power of this command.
+ */
protected abstract int rightBinding();
@Override
- public ITree<Token<K, V>> denote(final ITree<Token<K, V>> operand, final Token<K, V> operator,
- final ParserContext<K, V, C> ctx) throws ParserException {
- final ITree<Token<K, V>> opr = ctx.parse.parseExpression(rightBinding(), ctx.tokens, ctx.state, false);
+ public ITree<Token<K, V>> denote(final ITree<Token<K, V>> operand,
+ final Token<K, V> operator, final ParserContext<K, V, C> ctx)
+ throws ParserException {
+ final ITree<Token<K, V>> opr
+ = ctx.parse.parseExpression(rightBinding(), ctx.tokens, ctx.state, false);
return new Tree<>(operator, operand, opr);
}