Skip to content

Commit bf14e4c

Browse files
committed
cleanup code
1 parent c8fa6cb commit bf14e4c

15 files changed

+40
-42
lines changed

src/main/java/lexlang/ArrayValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
Maxwell Souza 201435009
33
Rodolpho Rossete 201435032
44
*/
@@ -45,7 +45,7 @@ public boolean add(Value value) {
4545
return values.add(value);
4646
}
4747

48-
private void checkIndexBounds(int i){
48+
private void checkIndexBounds(int i) {
4949
if (values.size() <= i)
5050
throw new LangException("Index " + i + " out of bounds for length " + values.size());
5151
}

src/main/java/lexlang/Data.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
Maxwell Souza 201435009
33
Rodolpho Rossete 201435032
44
*/

src/main/java/lexlang/FunctionScope.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
Maxwell Souza 201435009
33
Rodolpho Rossete 201435032
44
*/

src/main/java/lexlang/LangInterpreter.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/**
2-
* Maxwell Souza 201435009
3-
* Rodolpho Rossete 201435032
1+
/*
2+
Maxwell Souza 201435009
3+
Rodolpho Rossete 201435032
44
*/
55

66

@@ -36,9 +36,8 @@ public LangInterpreter(SemanticAnalyzer analyzer) {
3636
/**
3737
* Run a program
3838
*/
39-
public Value run() {
39+
public void run() {
4040
runFunction("main", null);
41-
return null;
4241
}
4342

4443
// Memory management
@@ -387,7 +386,7 @@ public Value visitReadCmd(LexLangParser.ReadCmdContext ctx) {
387386
String response = reader.nextLine();
388387
int val;
389388
try {
390-
val = Integer.valueOf(response);
389+
val = Integer.parseInt(response);
391390
} catch (Exception e) {
392391
throw new LangException("Read error: 'Int' expected, received '" + response + "'", ctx);
393392
}

src/main/java/lexlang/LangRunner.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/**
2-
* Maxwell Souza 201435009
3-
* Rodolpho Rossete 201435032
1+
/*
2+
Maxwell Souza 201435009
3+
Rodolpho Rossete 201435032
44
*/
55

66

src/main/java/lexlang/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
Maxwell Souza 201435009
33
Rodolpho Rossete 201435032
44
*/

src/main/java/lexlang/Scope.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
Maxwell Souza 201435009
33
Rodolpho Rossete 201435032
44
*/

src/main/java/lexlang/Value.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
/**
1+
/*
22
Maxwell Souza 201435009
33
Rodolpho Rossete 201435032
44
*/
55

66

7-
87
package lexlang;
98

109
public class Value {
1110
final Object primitive;
1211

1312
public static Value VOID = new Value(null);
14-
public static Value EMPTY_CHAR = new Value((Character)Character.MIN_VALUE);
13+
public static Value EMPTY_CHAR = new Value(Character.MIN_VALUE);
1514

1615
public Value(Object value) {
1716
this.primitive = value;
@@ -44,14 +43,15 @@ public Data getData() {
4443
return (Data) primitive;
4544
}
4645

47-
public ArrayValue getArray(){
46+
public ArrayValue getArray() {
4847
return (ArrayValue) primitive;
4948
}
5049

5150
@Override
5251
public boolean equals(Object o) {
5352
if (primitive == o) return true;
54-
// if (value == null || o == null || o.getClass() != value.getClass()) return false;
53+
// if (value == null || o == null || o.getClass() != value.getClass()) return false;
54+
if (!(o instanceof Value)) return false;
5555
Value comparedValue = (Value) o;
5656
if (comparedValue.getRawValue() instanceof Number && this.primitive instanceof Number)
5757
return this.getFloat().equals(comparedValue.getFloat());

src/main/java/semantics/DataDeclaration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/**
2-
* Maxwell Souza 201435009
3-
* Rodolpho Rossete 201435032
1+
/*
2+
Maxwell Souza 201435009
3+
Rodolpho Rossete 201435032
44
*/
55

66

src/main/java/semantics/DefaultTypes.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/**
2-
* Maxwell Souza 201435009
3-
* Rodolpho Rossete 201435032
1+
/*
2+
Maxwell Souza 201435009
3+
Rodolpho Rossete 201435032
44
*/
55

66
package semantics;

0 commit comments

Comments
 (0)