summaryrefslogtreecommitdiff
path: root/dice-lang/src/bjc/dicelang/Node.java
diff options
context:
space:
mode:
authorBenjamin J. Culkin <bjculkin@mix.wvu.edu>2017-10-25 12:10:14 -0300
committerBenjamin J. Culkin <bjculkin@mix.wvu.edu>2017-10-25 12:10:14 -0300
commit7bda9de511a5642efb297eae98c6ea7c42b27754 (patch)
treedff1aa772b9ac088c5bd07b8d10d944cbff89f96 /dice-lang/src/bjc/dicelang/Node.java
parentf028ea6dc555fc5192a96b00b8e96e90dbf6de55 (diff)
Start switch to maven modules
Diffstat (limited to 'dice-lang/src/bjc/dicelang/Node.java')
-rw-r--r--dice-lang/src/bjc/dicelang/Node.java105
1 files changed, 0 insertions, 105 deletions
diff --git a/dice-lang/src/bjc/dicelang/Node.java b/dice-lang/src/bjc/dicelang/Node.java
deleted file mode 100644
index 4238cfc..0000000
--- a/dice-lang/src/bjc/dicelang/Node.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package bjc.dicelang;
-
-/*
- * @TODO 10/09/17 Ben Culkin :NodeReorg
- * Same thing, different class. Split into subclasses based off of the type
- * values.
- */
-/**
- * Represents a node in the AST.
- *
- * @author Ben Culkin
- */
-public class Node {
- public static enum Type {
- ROOT, TOKREF, UNARYOP, BINOP, GROUP, OGROUP, RESULT
- }
-
- public static enum GroupType {
- ARRAY, CODE
- }
-
- public final Type type;
-
- // These can have or not have values based of the node type
- public Token tokenVal;
- public Token.Type operatorType;
- public GroupType groupType;
- public EvaluatorResult resultVal;
-
- public Node(final Type typ) {
- type = typ;
- }
-
- public Node(final Type typ, final Token tokenVl) {
- this(typ);
-
- tokenVal = tokenVl;
- }
-
- public Node(final Type typ, final Token.Type opType) {
- this(typ);
-
- operatorType = opType;
- }
-
- public Node(final Type typ, final GroupType grupType) {
- this(typ);
-
- groupType = grupType;
- }
-
- public Node(final Type typ, final EvaluatorResult res) {
- this(typ);
-
- resultVal = res;
- }
-
- @Override
- public String toString() {
- switch (type) {
- case UNARYOP:
- case BINOP:
- return "(" + type.name() + " : " + operatorType + ")";
-
- case OGROUP:
- case TOKREF:
- return "(" + type.name() + " : " + tokenVal + ")";
-
- case GROUP:
- return "(" + type.name() + " : " + groupType + ")";
-
- case RESULT:
- return "(" + type.name() + " : " + resultVal + ")";
-
- default:
- return "Unknown node type " + type;
- }
- }
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof Node)) {
- return false;
- }
-
- final Node otk = (Node) other;
-
- if (otk.type != type) {
- return false;
- }
-
- switch (type) {
- case OGROUP:
- return tokenVal.equals(otk.tokenVal);
-
- default:
- return true;
- }
- }
-
- @Override
- public int hashCode() {
- return super.hashCode();
- }
-}