From 251419e1f0ab8eb04d21287b708b06a552f4c58a Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Mon, 10 Apr 2017 16:49:31 -0400 Subject: Warning resolution --- JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java') diff --git a/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java b/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java index c7a10b1..6ab126a 100644 --- a/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java +++ b/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java @@ -61,9 +61,9 @@ public class ChainCommand extends BinaryPostCommand { new ParserContext<>(ctx.tokens, ctx.parse, ctx.state)); return new Tree<>(chain, res, other); - } else { - return res; } + + return res; } @Override -- cgit v1.2.3 From 56f07e9a3aaa873fe385d224f088f048dbafa8f7 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Mon, 10 Apr 2017 16:49:54 -0400 Subject: Cleanup --- .../main/java/bjc/pratt/commands/ChainCommand.java | 35 +++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java') diff --git a/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java b/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java index 6ab126a..4e471d0 100644 --- a/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java +++ b/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java @@ -1,45 +1,45 @@ package bjc.pratt.commands; +import java.util.Set; + import bjc.pratt.ParserContext; import bjc.pratt.Token; import bjc.utils.data.ITree; import bjc.utils.data.Tree; import bjc.utils.parserutils.ParserException; -import java.util.Set; - /** * Create a new chained 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 class ChainCommand extends BinaryPostCommand { - private Set chainWith; + private final Set chainWith; - private Token chain; + private final Token chain; /** * Create a new chained operator. - * + * * @param precedence * The precedence of this operator. - * + * * @param chainSet * The operators to chain with. - * + * * @param chainMarker * The token to use as the node in the AST. */ - public ChainCommand(int precedence, Set chainSet, Token chainMarker) { + public ChainCommand(final int precedence, final Set chainSet, final Token chainMarker) { super(precedence); chainWith = chainSet; @@ -47,17 +47,18 @@ public class ChainCommand extends BinaryPostCommand { } @Override - public ITree> denote(ITree> operand, Token operator, ParserContext ctx) - throws ParserException { - ITree> tree = ctx.parse.parseExpression(1 + leftBinding(), ctx.tokens, ctx.state, false); + public ITree> denote(final ITree> operand, final Token operator, + final ParserContext ctx) throws ParserException { + final ITree> tree = ctx.parse.parseExpression(1 + leftBinding(), ctx.tokens, ctx.state, + false); - ITree> res = new Tree<>(operator, operand, tree); + final ITree> res = new Tree<>(operator, operand, tree); if (chainWith.contains(ctx.tokens.current().getKey())) { - Token tok = ctx.tokens.current(); + final Token tok = ctx.tokens.current(); ctx.tokens.next(); - ITree> other = denote(tree, tok, + final ITree> other = denote(tree, tok, new ParserContext<>(ctx.tokens, ctx.parse, ctx.state)); return new Tree<>(chain, res, other); -- cgit v1.2.3 From f394306a4b65a3328551f9f6b8d4abff8bfd5b27 Mon Sep 17 00:00:00 2001 From: bjculkin Date: Wed, 12 Apr 2017 10:46:51 -0400 Subject: Package reorganization --- .../main/java/bjc/pratt/commands/ChainCommand.java | 74 ---------------------- 1 file changed, 74 deletions(-) delete mode 100644 JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java (limited to 'JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java') diff --git a/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java b/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java deleted file mode 100644 index 4e471d0..0000000 --- a/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java +++ /dev/null @@ -1,74 +0,0 @@ -package bjc.pratt.commands; - -import java.util.Set; - -import bjc.pratt.ParserContext; -import bjc.pratt.Token; -import bjc.utils.data.ITree; -import bjc.utils.data.Tree; -import bjc.utils.parserutils.ParserException; - -/** - * Create a new chained 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 class ChainCommand extends BinaryPostCommand { - private final Set chainWith; - - private final Token chain; - - /** - * Create a new chained operator. - * - * @param precedence - * The precedence of this operator. - * - * @param chainSet - * The operators to chain with. - * - * @param chainMarker - * The token to use as the node in the AST. - */ - public ChainCommand(final int precedence, final Set chainSet, final Token chainMarker) { - super(precedence); - - chainWith = chainSet; - chain = chainMarker; - } - - @Override - public ITree> denote(final ITree> operand, final Token operator, - final ParserContext ctx) throws ParserException { - final ITree> tree = ctx.parse.parseExpression(1 + leftBinding(), ctx.tokens, ctx.state, - false); - - final ITree> res = new Tree<>(operator, operand, tree); - - if (chainWith.contains(ctx.tokens.current().getKey())) { - final Token tok = ctx.tokens.current(); - ctx.tokens.next(); - - final ITree> other = denote(tree, tok, - new ParserContext<>(ctx.tokens, ctx.parse, ctx.state)); - - return new Tree<>(chain, res, other); - } - - return res; - } - - @Override - public int nextBinding() { - return leftBinding() - 1; - } -} \ No newline at end of file -- cgit v1.2.3