From 8212af7c70d1603013da32e0501969ed98431caf Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Wed, 11 May 2016 21:10:53 -0400 Subject: Adapt to upstream changes --- .../main/java/bjc/dicelang/ast/DiceASTParser.java | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'dice-lang/src/main/java/bjc/dicelang/ast/DiceASTParser.java') diff --git a/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTParser.java b/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTParser.java index f14df74..c149c0a 100644 --- a/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTParser.java +++ b/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTParser.java @@ -7,8 +7,8 @@ import java.util.function.Predicate; import bjc.utils.funcdata.FunctionalList; import bjc.utils.funcdata.FunctionalMap; -import bjc.utils.funcdata.IFunctionalList; -import bjc.utils.funcdata.IFunctionalMap; +import bjc.utils.funcdata.IList; +import bjc.utils.funcdata.IMap; import bjc.utils.funcdata.ITree; import bjc.utils.funcdata.Tree; import bjc.utils.funcutils.StringUtils; @@ -31,8 +31,8 @@ import bjc.dicelang.ast.nodes.VariableDiceNode; */ public class DiceASTParser { private static IDiceASTNode convertLeafNode(String leafNode) { - DiceLiteralType literalType = ILiteralDiceNode - .getLiteralType(leafNode); + DiceLiteralType literalType = + ILiteralDiceNode.getLiteralType(leafNode); if (literalType != null) { switch (literalType) { @@ -73,7 +73,7 @@ public class DiceASTParser { * @return An AST built from the tokens */ public static ITree createFromString( - IFunctionalList tokens) { + IList tokens) { Predicate specialPicker = (operator) -> { if (StringUtils.containsOnly(operator, "\\[")) { return true; @@ -84,7 +84,8 @@ public class DiceASTParser { return false; }; - IFunctionalMap>, ITree>> operators = new FunctionalMap<>(); + IMap>, ITree>> operators = + new FunctionalMap<>(); operators.put("[", (queuedTrees) -> { Tree openTree = new Tree<>("["); @@ -96,14 +97,14 @@ public class DiceASTParser { return parseCloseArray(queuedTrees); }); - ITree rawTokens = TreeConstructor.constructTree(tokens, - (token) -> { + ITree rawTokens = + TreeConstructor.constructTree(tokens, (token) -> { return isOperatorNode(token); }, specialPicker, operators::get); - ITree tokenizedTree = rawTokens.rebuildTree( - DiceASTParser::convertLeafNode, - DiceASTParser::convertOperatorNode); + ITree tokenizedTree = + rawTokens.rebuildTree(DiceASTParser::convertLeafNode, + DiceASTParser::convertOperatorNode); return tokenizedTree; } @@ -131,7 +132,7 @@ public class DiceASTParser { private static ITree parseCloseArray( Deque> queuedTrees) { - IFunctionalList> children = new FunctionalList<>(); + IList> children = new FunctionalList<>(); while (shouldContinuePopping(queuedTrees)) { children.add(queuedTrees.pop()); -- cgit v1.2.3