summaryrefslogtreecommitdiff
path: root/dice-lang/src/main/java/bjc/dicelang/IDiceExpression.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2016-04-17 15:57:20 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2016-04-17 15:57:20 -0400
commitd9437c1d328ccc2b26bd0aae19c2aff7140e466b (patch)
treea2292224ba16766fe3dc99140e90089e24aea9c7 /dice-lang/src/main/java/bjc/dicelang/IDiceExpression.java
parent4fcefd106eb23295592e9cc23a0c5d63a28f9e76 (diff)
Minor cleanups
Diffstat (limited to 'dice-lang/src/main/java/bjc/dicelang/IDiceExpression.java')
-rw-r--r--dice-lang/src/main/java/bjc/dicelang/IDiceExpression.java27
1 files changed, 15 insertions, 12 deletions
diff --git a/dice-lang/src/main/java/bjc/dicelang/IDiceExpression.java b/dice-lang/src/main/java/bjc/dicelang/IDiceExpression.java
index 16e1761..013d69d 100644
--- a/dice-lang/src/main/java/bjc/dicelang/IDiceExpression.java
+++ b/dice-lang/src/main/java/bjc/dicelang/IDiceExpression.java
@@ -42,19 +42,20 @@ public interface IDiceExpression {
/**
* Parse this node into an expression
- * @param exp The string to convert to an expression
*
- * @return The node in expression form
+ * @param expression
+ * The string to convert to an expression
+ *
+ * @return The string in expression form
*/
- static IDiceExpression toExpression(String exp) {
- String literalData = exp;
-
+ static IDiceExpression toExpression(String expression) {
+ String literalData = expression;
+
if (StringUtils.containsInfixOperator(literalData, "c")) {
String[] strangs = literalData.split("c");
-
+
return new CompoundDice(strangs);
- } else if (StringUtils.containsInfixOperator(literalData,
- "d")) {
+ } else if (StringUtils.containsInfixOperator(literalData, "d")) {
/*
* Handle dice groups
*/
@@ -63,11 +64,13 @@ public interface IDiceExpression {
try {
return new ScalarDie(Integer.parseInt(literalData));
} catch (NumberFormatException nfex) {
- UnsupportedOperationException usex = new UnsupportedOperationException(
- "Found malformed leaf token " + exp);
-
+ UnsupportedOperationException usex =
+ new UnsupportedOperationException(
+ "Found malformed leaf token "
+ + expression);
+
usex.initCause(nfex);
-
+
throw usex;
}
}