diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-02-09 11:50:31 -0500 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-02-09 11:50:31 -0500 |
| commit | d2af58b0f68ebfbba2be7e7679efec6c8c0af12f (patch) | |
| tree | 2b16fbf014db350126e8c1b5f081312276f85f62 /BJC-Utils2/src/main/java/bjc/utils/parserutils/TreeConstructor.java | |
| parent | 187e1815488e3c1ed22e7592f304e632cffefb82 (diff) | |
Update
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/parserutils/TreeConstructor.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/parserutils/TreeConstructor.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/parserutils/TreeConstructor.java b/BJC-Utils2/src/main/java/bjc/utils/parserutils/TreeConstructor.java index 0b61363..7f933c0 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/parserutils/TreeConstructor.java +++ b/BJC-Utils2/src/main/java/bjc/utils/parserutils/TreeConstructor.java @@ -28,16 +28,16 @@ public class TreeConstructor { * The elements of the parse tree * @param tokens * The list of tokens to build a tree from - * @param operatorPredicate + * @param isOperator * The predicate to use to determine if something is a * operator * @return A AST from the expression */ public static <TokenType> ITree<TokenType> constructTree( IList<TokenType> tokens, - Predicate<TokenType> operatorPredicate) { + Predicate<TokenType> isOperator) { // Construct a tree with no special operators - return constructTree(tokens, operatorPredicate, (op) -> false, + return constructTree(tokens, isOperator, (op) -> false, null); } @@ -51,7 +51,7 @@ public class TreeConstructor { * The elements of the parse tree * @param tokens * The list of tokens to build a tree from - * @param operatorPredicate + * @param isOperator * The predicate to use to determine if something is a * operator * @param isSpecialOperator @@ -62,19 +62,19 @@ public class TreeConstructor { * @return A AST from the expression * * FIXME The handleSpecialOp function seems like an ugly - * interface. Maybe there's a better way to express how that - * works + * interface. Maybe there's a better way to express how + * that works. */ public static <TokenType> ITree<TokenType> constructTree( IList<TokenType> tokens, - Predicate<TokenType> operatorPredicate, + Predicate<TokenType> isOperator, Predicate<TokenType> isSpecialOperator, Function<TokenType, Function<Deque<ITree<TokenType>>, ITree<TokenType>>> handleSpecialOperator) { // Make sure our parameters are valid if (tokens == null) { throw new NullPointerException("Tokens must not be null"); - } else if (operatorPredicate == null) { + } else if (isOperator == null) { throw new NullPointerException( "Operator predicate must not be null"); } else if (isSpecialOperator == null) { @@ -89,7 +89,7 @@ public class TreeConstructor { // Transform each of the tokens tokens.forEach( - new TokenTransformer<>(initialState, operatorPredicate, + new TokenTransformer<>(initialState, isOperator, isSpecialOperator, handleSpecialOperator)); // Grab the tree from the state |
