diff options
Diffstat (limited to 'JPratt/src/main/java/bjc/pratt/commands/PostCircumfixCommand.java')
| -rw-r--r-- | JPratt/src/main/java/bjc/pratt/commands/PostCircumfixCommand.java | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/JPratt/src/main/java/bjc/pratt/commands/PostCircumfixCommand.java b/JPratt/src/main/java/bjc/pratt/commands/PostCircumfixCommand.java index 6bed0ff..e7d2eea 100644 --- a/JPratt/src/main/java/bjc/pratt/commands/PostCircumfixCommand.java +++ b/JPratt/src/main/java/bjc/pratt/commands/PostCircumfixCommand.java @@ -9,41 +9,39 @@ import bjc.utils.parserutils.ParserException; /** * A post-circumfix operator, like array indexing. - * + * * @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 PostCircumfixCommand<K, V, C> extends BinaryPostCommand<K, V, C> { - private ParseBlock<K, V, C> innerBlock; + private final ParseBlock<K, V, C> innerBlock; - private Token<K, V> mark; + private final Token<K, V> mark; /** * Create a new post-circumfix operator. - * + * * @param precedence * The precedence of the operator. - * + * * @param inner * The block inside the expression. - * + * * @param marker * The token to use as the node for the AST. */ - public PostCircumfixCommand(int precedence, ParseBlock<K, V, C> inner, Token<K, V> marker) { + public PostCircumfixCommand(final int precedence, final ParseBlock<K, V, C> inner, final Token<K, V> marker) { super(precedence); - if (inner == null) { - throw new NullPointerException("Inner block must not be null"); - } + if (inner == null) throw new NullPointerException("Inner block must not be null"); innerBlock = inner; @@ -51,9 +49,9 @@ public class PostCircumfixCommand<K, V, C> extends BinaryPostCommand<K, V, C> { } @Override - public ITree<Token<K, V>> denote(ITree<Token<K, V>> operand, Token<K, V> operator, ParserContext<K, V, C> ctx) - throws ParserException { - ITree<Token<K, V>> inside = innerBlock.parse(ctx); + 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>> inside = innerBlock.parse(ctx); return new Tree<>(mark, operand, inside); } |
