diff options
| author | bjculkin <bjculkin@mix.wvu.edu> | 2017-03-21 14:08:50 -0400 |
|---|---|---|
| committer | bjculkin <bjculkin@mix.wvu.edu> | 2017-03-21 14:08:50 -0400 |
| commit | a7e84eea087a35721a971e827149f0ca5fba4676 (patch) | |
| tree | fbb7b0e5e402fb2a4aae5614c51f1955640a09e8 /dice-lang/src/bjc/dicelang/v1/ast/nodes/ILiteralDiceNode.java | |
| parent | 94913a2fccff9e80f84ac477c2020bd7c7b1833a (diff) | |
Remove version 1 files
Remove the old, not used version 1 files from the repository. Check the
history if you care about them.
Diffstat (limited to 'dice-lang/src/bjc/dicelang/v1/ast/nodes/ILiteralDiceNode.java')
| -rw-r--r-- | dice-lang/src/bjc/dicelang/v1/ast/nodes/ILiteralDiceNode.java | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/dice-lang/src/bjc/dicelang/v1/ast/nodes/ILiteralDiceNode.java b/dice-lang/src/bjc/dicelang/v1/ast/nodes/ILiteralDiceNode.java deleted file mode 100644 index 5a3f5b3..0000000 --- a/dice-lang/src/bjc/dicelang/v1/ast/nodes/ILiteralDiceNode.java +++ /dev/null @@ -1,71 +0,0 @@ -package bjc.dicelang.v1.ast.nodes; - -/** - * Represents a literal of some type in the AST - * - * @author ben - * - */ -public interface ILiteralDiceNode extends IDiceASTNode { - /** - * Check if a token represents a literal, and if so, what type - * - * @param tok - * The token to check - * @return The type the literal would be if it is one, or null otherwise - */ - static DiceLiteralType getLiteralType(String tok) { - String diceGroup = "\\d*d\\d+\\"; - - String diceGroupOrNumber = "[(?:" + diceGroup + ")(?:\\d+)]"; - - if(tok.matches("\\A" + diceGroupOrNumber + "?" + "c" + diceGroupOrNumber + "\\Z")) - return DiceLiteralType.DICE; - - if(tok.matches("\\A" + diceGroup + "Z")) return DiceLiteralType.DICE; - - try { - Integer.parseInt(tok); - return DiceLiteralType.INTEGER; - } catch(NumberFormatException nfex) { - // We don't care about details - // This probably shouldn't return null, but I believe it - // does so - // because where its called checks that. @FIXME - return null; - } - } - - /** - * Check if this node can be optimized to a constant - * - * @return Whether or not this node can be optimized to a constant - * @see bjc.dicelang.v1.IDiceExpression#canOptimize() - */ - boolean canOptimize(); - - /** - * Get the type of literal this node represents - * - * @return The type of literal this node represents - */ - DiceLiteralType getLiteralType(); - - @Override - default DiceASTType getType() { - return DiceASTType.LITERAL; - } - - @Override - default boolean isOperator() { - return false; - } - - /** - * Optimize this node to a constant if possible - * - * @return This node in constant form if possible - * @see bjc.dicelang.v1.IDiceExpression#optimize() - */ - int optimize(); -} |
