diff options
Diffstat (limited to 'dice-lang/src/main/java/bjc/dicelang/ast/LiteralDiceNode.java')
| -rw-r--r-- | dice-lang/src/main/java/bjc/dicelang/ast/LiteralDiceNode.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/dice-lang/src/main/java/bjc/dicelang/ast/LiteralDiceNode.java b/dice-lang/src/main/java/bjc/dicelang/ast/LiteralDiceNode.java new file mode 100644 index 0000000..8157844 --- /dev/null +++ b/dice-lang/src/main/java/bjc/dicelang/ast/LiteralDiceNode.java @@ -0,0 +1,48 @@ +package bjc.dicelang.ast; + +/** + * A AST node that represents a literal value + * + * @author ben + * + */ +public class LiteralDiceNode implements IDiceASTNode { + /** + * The value contained by this node + */ + private String data; + + /** + * Create a new node with the given value + * + * @param data + * The value to be in this node + */ + public LiteralDiceNode(String data) { + this.data = data; + } + + @Override + public boolean isOperator() { + return false; + } + + /** + * Get the data stored in this AST node + * + * @return the data stored in this AST node + */ + public String getData() { + return data; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return data; + } +} |
