diff options
Diffstat (limited to 'JPratt/src/main/java/com/ashardalon/pratt/commands/impls/LeftBinaryCommand.java')
| -rw-r--r-- | JPratt/src/main/java/com/ashardalon/pratt/commands/impls/LeftBinaryCommand.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/JPratt/src/main/java/com/ashardalon/pratt/commands/impls/LeftBinaryCommand.java b/JPratt/src/main/java/com/ashardalon/pratt/commands/impls/LeftBinaryCommand.java new file mode 100644 index 0000000..c5408d6 --- /dev/null +++ b/JPratt/src/main/java/com/ashardalon/pratt/commands/impls/LeftBinaryCommand.java @@ -0,0 +1,34 @@ +package com.ashardalon.pratt.commands.impls; + +import com.ashardalon.pratt.commands.BinaryCommand; + +/** + * A left-associative operator. + * + * @author bjculkin + * + * @param <K> + * The key type of the tokens. + * + * @param <V> + * The value type of the tokens. + * + * @param <C> + * The state type of the parser. + */ +public class LeftBinaryCommand<K, V, C> extends BinaryCommand<K, V, C> { + /** + * Create a new left-associative operator. + * + * @param precedence + * The precedence of the operator. + */ + public LeftBinaryCommand(final int precedence) { + super(precedence); + } + + @Override + protected int rightBinding() { + return 1 + leftBinding(); + } +}
\ No newline at end of file |
