summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-23 15:59:01 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-23 15:59:01 -0600
commit12520b3e79d1050f8dd7ada09a06d49f19bd5401 (patch)
tree5b6ba110da43ffcec5c8bcbe387ff5a5920cf59c
parent1cbc6acab2c1bd745649a639db023b0f6c87f821 (diff)
Fix first of a few new minor bugs introduced with rewrite
-rw-r--r--boil/library/BoilSimp.java12
-rw-r--r--boil/library/BoilVisitor.java30
-rw-r--r--misc/MinimalSimpleFormatter.java3
3 files changed, 26 insertions, 19 deletions
diff --git a/boil/library/BoilSimp.java b/boil/library/BoilSimp.java
index 25b27e0..4763834 100644
--- a/boil/library/BoilSimp.java
+++ b/boil/library/BoilSimp.java
@@ -62,6 +62,7 @@ public class BoilSimp extends GJDepthFirst<String,String> {
}
else
return "";
+
}
public String visit(NodeOptional n, String args) {
@@ -94,9 +95,11 @@ public class BoilSimp extends GJDepthFirst<String,String> {
*/
public String visit(Goal n, String args) {
String mod = "";
+ ///////////////////////////////////////////////////////////////
n.f0.accept(this, args);
n.f1.accept(this, args);
n.f2.accept(this, args);
+ ///////////////////////////////////////////////////////////////
return mod;
}
@@ -122,7 +125,7 @@ public class BoilSimp extends GJDepthFirst<String,String> {
*/
public String visit(MainClass n, String args) {
String id = n.f1.f0.tokenImage;
-
+ ///////////////////////////////////////////////////////////////
this.symt.setActive(TypeEnum.classname, id);
this.symt.setActive(TypeEnum.method, "main");
this.tf.reset();
@@ -153,6 +156,7 @@ public class BoilSimp extends GJDepthFirst<String,String> {
"exit:\n ret\n\n";
this.symt.removeActive(TypeEnum.method);
+ ///////////////////////////////////////////////////////////////
return mod;
}
@@ -162,7 +166,9 @@ public class BoilSimp extends GJDepthFirst<String,String> {
*/
public String visit(TypeDeclaration n, String args) {
String mod = "";
+ ///////////////////////////////////////////////////////////////
n.f0.accept(this, args);
+ ///////////////////////////////////////////////////////////////
return mod;
}
@@ -176,8 +182,10 @@ public class BoilSimp extends GJDepthFirst<String,String> {
*/
public String visit(ClassDeclaration n, String args) {
String id = n.f1.f0.tokenImage;
- this.symt.setActive(TypeEnum.classname, id);
String mod = "";
+ ///////////////////////////////////////////////////////////////
+ this.symt.setActive(TypeEnum.classname, id);
+
n.f0.accept(this, args);
n.f1.accept(this, args);
diff --git a/boil/library/BoilVisitor.java b/boil/library/BoilVisitor.java
index 7de9939..4149bd9 100644
--- a/boil/library/BoilVisitor.java
+++ b/boil/library/BoilVisitor.java
@@ -350,8 +350,8 @@ public class BoilVisitor extends GJDepthFirst<String,String> {
n.getClass().getSimpleName(),
id));
///////////////////////////////////////////////////////////////
- _ret += id + " ";
- n.f0.accept(this, argu);
+ // n.f0.accept(this, argu);
+ _ret += n.f1.accept(this,argu) + " ";
///////////////////////////////////////////////////////////////
MinimalLogger.info(String.format("<- %s (%s)",
n.getClass().getSimpleName(),
@@ -814,6 +814,7 @@ public class BoilVisitor extends GJDepthFirst<String,String> {
MinimalLogger.info(String.format("-> %s",
n.getClass().getSimpleName()));
///////////////////////////////////////////////////////////////
+ _ret += this.tf.alias(this.getUniqueID());
String mtd = n.f2.f0.tokenImage;
String rhs;
TypeInstance t;
@@ -827,17 +828,15 @@ public class BoilVisitor extends GJDepthFirst<String,String> {
// we'll do everything here and exit the function
MinimalLogger.info("Message send found THIS");
rhs = n.f0.accept(this, argu);
- String callID = this.tf.alias(this.getUniqueID());
this.addVapor(n.f4.accept(this, argu));
this.addVapor(String.format(" %s = call %s(this",
- callID,
- mtd));
+ _ret,
+ rhs));
this.addVapor(String.format(" %s)\n",
this.tf.retrieveRecentList(this.symt.getMethod(mtd)
.getArguments()
.size())));
- return callID;
-
+ return _ret;
case 6:
MinimalLogger.info("Message send found ANONYMOUS");
// expand the entire object out!
@@ -852,7 +851,7 @@ public class BoilVisitor extends GJDepthFirst<String,String> {
this.addVapor(String.format(" [%s+%d] = %s\n",
this.tf.alias(t.getName()),
0,
- id));
+ rhs));
break;
default:
MinimalLogger.severe("Message send found UNKNOWN");
@@ -879,14 +878,15 @@ public class BoilVisitor extends GJDepthFirst<String,String> {
this.addVapor(n.f4.accept(this, argu));
- _ret += String.format("call %s(%s",
- tp2,
- this.tf.alias(t.getName()));
+ this.addVapor(String.format(" %s = call %s(%s",
+ _ret,
+ tp2,
+ this.tf.alias(t.getName())));
- _ret += String.format(" %s)",
- this.tf.retrieveRecentList(this.symt.getMethod(mtd)
- .getArguments()
- .size()));
+ this.addVapor(String.format(" %s)\n",
+ this.tf.retrieveRecentList(this.symt.getMethod(mtd)
+ .getArguments()
+ .size())));
///////////////////////////////////////////////////////////////
MinimalLogger.info(String.format("<- %s",
n.getClass().getSimpleName()));
diff --git a/misc/MinimalSimpleFormatter.java b/misc/MinimalSimpleFormatter.java
index aa0efdf..3a42398 100644
--- a/misc/MinimalSimpleFormatter.java
+++ b/misc/MinimalSimpleFormatter.java
@@ -7,7 +7,6 @@ import java.util.logging.SimpleFormatter;
public class MinimalSimpleFormatter extends SimpleFormatter {
@Override
public String format(LogRecord record) {
- return "";
- //return record.getLevel() + ": " + formatMessage(record) + "\n";
+ return record.getLevel() + ": " + formatMessage(record) + "\n";
}
}