summaryrefslogtreecommitdiff
path: root/dice-lang/src/main/java/bjc/dicelang/ast/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'dice-lang/src/main/java/bjc/dicelang/ast/nodes')
-rw-r--r--dice-lang/src/main/java/bjc/dicelang/ast/nodes/LiteralDiceNode.java13
-rw-r--r--dice-lang/src/main/java/bjc/dicelang/ast/nodes/OperatorDiceNode.java8
2 files changed, 17 insertions, 4 deletions
diff --git a/dice-lang/src/main/java/bjc/dicelang/ast/nodes/LiteralDiceNode.java b/dice-lang/src/main/java/bjc/dicelang/ast/nodes/LiteralDiceNode.java
index e689c7f..1a6d2bf 100644
--- a/dice-lang/src/main/java/bjc/dicelang/ast/nodes/LiteralDiceNode.java
+++ b/dice-lang/src/main/java/bjc/dicelang/ast/nodes/LiteralDiceNode.java
@@ -38,7 +38,9 @@ public class LiteralDiceNode implements IDiceASTNode {
/**
* Create a new node with the given value
- * @param val The value for this node
+ *
+ * @param val
+ * The value for this node
*/
public LiteralDiceNode(int val) {
this(Integer.toString(val));
@@ -126,8 +128,12 @@ public class LiteralDiceNode implements IDiceASTNode {
try {
return new ScalarDie(Integer.parseInt(literalData));
} catch (NumberFormatException nfex) {
- throw new UnsupportedOperationException(
+ UnsupportedOperationException usex = new UnsupportedOperationException(
"Found malformed leaf token " + this);
+
+ usex.initCause(nfex);
+
+ throw usex;
}
}
}
@@ -165,7 +171,8 @@ public class LiteralDiceNode implements IDiceASTNode {
try {
Integer.parseInt(value);
return true;
- } catch (NumberFormatException nfex) {
+ } catch (@SuppressWarnings("unused") NumberFormatException nfex) {
+ // We don't care about details
return false;
}
}
diff --git a/dice-lang/src/main/java/bjc/dicelang/ast/nodes/OperatorDiceNode.java b/dice-lang/src/main/java/bjc/dicelang/ast/nodes/OperatorDiceNode.java
index e1eb316..2820cfb 100644
--- a/dice-lang/src/main/java/bjc/dicelang/ast/nodes/OperatorDiceNode.java
+++ b/dice-lang/src/main/java/bjc/dicelang/ast/nodes/OperatorDiceNode.java
@@ -38,7 +38,11 @@ public enum OperatorDiceNode implements IDiceASTNode {
/**
* Represents subtracting two nodes
*/
- SUBTRACT;
+ SUBTRACT,
+ /**
+ * Represents executing one statement in the context of the other
+ */
+ LET;
/**
* Create a operator node from a string
@@ -63,6 +67,8 @@ public enum OperatorDiceNode implements IDiceASTNode {
return GROUP;
case "c":
return COMPOUND;
+ case "->":
+ return LET;
default:
throw new IllegalArgumentException(
s + " is not a valid operator node");