From 8094fc813a29d447555863b6c32816229ff01958 Mon Sep 17 00:00:00 2001 From: student Date: Mon, 12 Feb 2018 12:59:01 -0500 Subject: Formatting pass --- base/src/bjc/dicelang/Parser.java | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'base/src/bjc/dicelang/Parser.java') diff --git a/base/src/bjc/dicelang/Parser.java b/base/src/bjc/dicelang/Parser.java index 0861e96..76730b9 100644 --- a/base/src/bjc/dicelang/Parser.java +++ b/base/src/bjc/dicelang/Parser.java @@ -36,15 +36,14 @@ public class Parser { * Parse a series of tokens to a forest of ASTs. * * @param tokens - * The list of tokens to parse. + * The list of tokens to parse. * * @param results - * The place to set results. + * The place to set results. * * @return Whether or not the parse was successful. */ - public static boolean parseTokens(final IList tokens, - final IList> results) { + public static boolean parseTokens(final IList tokens, final IList> results) { final Deque> working = new LinkedList<>(); for (final Token tk : tokens) { @@ -91,7 +90,7 @@ public class Parser { return false; } else if (working.size() == 1) { final ITree operand = working.pop(); - final ITree opNode = new Tree<>(new Node(UNARYOP, tk.type)); + final ITree opNode = new Tree<>(new Node(UNARYOP, tk.type)); opNode.addChild(operand); @@ -109,7 +108,7 @@ public class Parser { Errors.inst.printError(EK_PARSE_UNOPERAND, tk.toString()); } else { final ITree operand = working.pop(); - final ITree opNode = new Tree<>(new Node(UNARYOP, tk.type)); + final ITree opNode = new Tree<>(new Node(UNARYOP, tk.type)); opNode.addChild(operand); @@ -131,9 +130,8 @@ public class Parser { } } - /* - * Collect the remaining nodes as the roots of the trees in the - * AST forest. + /* + * Collect the remaining nodes as the roots of the trees in the AST forest. */ for (final ITree ast : working) { results.add(ast); @@ -145,7 +143,7 @@ public class Parser { /* Handle a binary operator. */ private static void handleBinaryNode(final Deque> working, final Token tk) { final ITree right = working.pop(); - final ITree left = working.pop(); + final ITree left = working.pop(); final ITree opNode = new Tree<>(new Node(BINOP, tk.type)); @@ -156,8 +154,7 @@ public class Parser { } /* Parse a closing delimiter. */ - private static boolean parseClosingGrouper(final Deque> working, - final Token tk) { + private static boolean parseClosingGrouper(final Deque> working, final Token tk) { if (working.size() == 0) { Errors.inst.printError(EK_PARSE_NOCLOSE); return false; -- cgit v1.2.3