Skip to content

Commit b919269

Browse files
Mass cleanup
1 parent 3201719 commit b919269

20 files changed

Lines changed: 176 additions & 254 deletions

.idea/misc.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/AssignmentNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// is to use “lhs” and “rhs” (left-hand side and right-hand side) for these members.
44
// This is not a good tradition. I used “target” and “expression”.
55
public class AssignmentNode extends StatementNode {
6-
76
private VariableReferenceNode target;
87
private Node expression;
98

@@ -21,7 +20,6 @@ public Node getExpression() {
2120
return expression;
2221
}
2322

24-
//tostring
2523
public String toString() {
2624
return (target != null ? target : "") + " = " + (expression != null ? expression : "") + " ";
2725
}

src/BooleanDataType.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public String toString(String input) throws Exception {
2121
return Boolean.toString(value);
2222
}
2323

24-
2524
public void fromString(String input) {
2625
this.value = Boolean.parseBoolean(input);
2726
}

src/BuiltInFunctionNode.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public BuiltInFunctionNode(String name, ArrayList<VariableNode> arguments, boole
1515
this.varadic = varadic;
1616
}
1717

18-
1918
//Execute will take a collection of InterpreterDataType objects. Why? Well, when the interpreter finds a call to “read”, for example,
2019
// it has to be able to call your Java code.
2120
public abstract void execute(ArrayList<InterpreterDataType> arguments) throws Exception;

src/CallableNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ public CallableNode(String name, ArrayList<VariableNode> arguments, Boolean vara
1919
public boolean isVaradic() {
2020
return varadic;
2121
}
22-
2322
public String getName() {
2423
return name;
2524
}
2625

2726
public ArrayList<VariableNode> getArguments() {
2827
return arguments;
2928
}
30-
3129
public String toString() {
3230
return name + "(" + arguments + ")";
3331
}

src/FunctionCallNode.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
public class FunctionCallNode extends StatementNode {
66
private String name;
77
private ArrayList<ParameterNode> parameters;
8-
98
private ArrayList<Node> paramNode;
109
private Boolean varadic;
1110

src/GetRandom.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public void execute(ArrayList<InterpreterDataType> arguments) throws Exception {
1212
for (InterpreterDataType idt : arguments) {
1313
try {
1414
value = (float) (Math.random() * Float.parseFloat(idt.toString()));
15-
} catch (Exception e) {
15+
} catch (NumberFormatException e) {
1616
throw new Exception("Cannot get random from input: " + value + "\n " + e + "\n");
1717
}
1818
}
@@ -22,7 +22,7 @@ public String toString(String input) throws Exception {
2222
// if cant parse then throw exception
2323
try {
2424
return Integer.toString((int) (Math.random() * Integer.parseInt(input)));
25-
} catch (Exception e) {
25+
} catch (NumberFormatException e) {
2626
throw new Exception("Cannot get random number from input:" + input + "\n " + e + "\n");
2727
}
2828
}

src/IntDataType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ public int getValue() {
2727
}
2828
}
2929

30-
// go to function hashmap and cast as a function node - get its name and parameters and if the amount of parameters in the functioncall match the function def then its okay
30+
// go to function hashmap and cast as a function node - get its name and parameters and if the amount of parameters in the functioncall match the function def then it's okay

src/IntegerToReal.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ public String toString(String input) throws Exception {
1212
// try to convert string to real if it can return else exception
1313
try {
1414
return Float.toString(Float.parseFloat(input));
15-
} catch (Exception e) {
15+
} catch (NumberFormatException e) {
1616
throw new Exception("Cannot convert to real from input: " + input + "\n " + e + "\n");
1717
}
1818
}
1919

2020
public void fromString(String input) throws Exception {
2121
try {
2222
this.value = Float.parseFloat(input);
23-
} catch (Exception e) {
23+
} catch (NumberFormatException e) {
2424
throw new Exception("Cannot convert to real from input: " + input + "\n " + e + "\n");
2525
}
2626
}

src/Interpreter.java

Lines changed: 136 additions & 194 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)