summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/parserutils/TokenTransformer.java
diff options
context:
space:
mode:
authorbjculkin <bjculkin@mix.wvu.edu>2018-02-12 22:45:04 -0500
committerbjculkin <bjculkin@mix.wvu.edu>2018-02-12 22:45:04 -0500
commitdf94066e3af02ff02d5ab4d033a3d603f743234c (patch)
tree168a1edaf58d386c175ffb601e9d4da8e13d31e2 /base/src/main/java/bjc/utils/parserutils/TokenTransformer.java
parentae51c587c53f7ca311e556e3cbd0c5566d6c2843 (diff)
Formatting pass
Diffstat (limited to 'base/src/main/java/bjc/utils/parserutils/TokenTransformer.java')
-rw-r--r--base/src/main/java/bjc/utils/parserutils/TokenTransformer.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/base/src/main/java/bjc/utils/parserutils/TokenTransformer.java b/base/src/main/java/bjc/utils/parserutils/TokenTransformer.java
index 30ccc5a..5a37596 100644
--- a/base/src/main/java/bjc/utils/parserutils/TokenTransformer.java
+++ b/base/src/main/java/bjc/utils/parserutils/TokenTransformer.java
@@ -30,7 +30,8 @@ final class TokenTransformer<TokenType> implements Consumer<TokenType> {
@Override
public ConstructorState<TokenType> apply(final ConstructorState<TokenType> pair) {
/*
- * Replace the current AST with the result of handling an operator
+ * Replace the current AST with the result of handling
+ * an operator
*/
return new ConstructorState<>(pair.bindLeft(queuedASTs -> {
return handleOperator(queuedASTs);
@@ -46,13 +47,14 @@ final class TokenTransformer<TokenType> implements Consumer<TokenType> {
/*
* Handle special operators
*/
- if (isSpecialOperator.test(element)) {
+ if(isSpecialOperator.test(element)) {
newAST = handleSpecialOperator.apply(element).apply(queuedASTs);
} else {
/*
- * Error if we don't have enough for a binary operator
+ * Error if we don't have enough for a binary
+ * operator
*/
- if (queuedASTs.size() < 2) {
+ if(queuedASTs.size() < 2) {
final String msg = String.format(
"Attempted to parse binary operator without enough operands\n\tProblem operator is: %s\n\tPossible operand is: %s",
element.toString(), queuedASTs.peek().toString());
@@ -108,7 +110,7 @@ final class TokenTransformer<TokenType> implements Consumer<TokenType> {
/*
* Handle operators
*/
- if (operatorPredicate.test(element)) {
+ if(operatorPredicate.test(element)) {
initialState.transform(new OperatorHandler(element));
} else {
final ITree<TokenType> newAST = new Tree<>(element);
@@ -118,7 +120,9 @@ final class TokenTransformer<TokenType> implements Consumer<TokenType> {
*/
initialState.transform(pair -> {
/*
- * Transform the pair, ignoring the current AST in favor of the one consisting of the current element
+ * Transform the pair, ignoring the current AST
+ * in favor of the one consisting of the current
+ * element
*/
return new ConstructorState<>(pair.bindLeft(queue -> {
queue.push(newAST);