summaryrefslogtreecommitdiff
path: root/dice-lang/src/main/java/bjc/dicelang/IDiceExpression.java
diff options
context:
space:
mode:
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;
}
}