Commit 7ace485e authored by Sarah Grebing's avatar Sarah Grebing

Bugfix concerning " for stringliterals

parent a730de1d
Pipeline #15284 failed with stages
in 1 minute and 14 seconds
...@@ -138,6 +138,23 @@ public class PrettyPrinter extends DefaultASTVisitor<Void> { ...@@ -138,6 +138,23 @@ public class PrettyPrinter extends DefaultASTVisitor<Void> {
return null; return null;
} }
@Override
public Void visit(StringLiteral stringLiteral) {
s.append(String.format("\'\'%s\'\'", stringLiteral.getText()));
return super.visit(stringLiteral);
}
/**
* clear line
*/
private void cl() {
int i = s.length() - 1;
while (Character.isWhitespace(s.charAt(i))) {
s.deleteCharAt(i--);
}
nl();
}
@Override @Override
public Void visit(CasesStatement casesStatement) { public Void visit(CasesStatement casesStatement) {
s.append("cases {"); s.append("cases {");
...@@ -154,10 +171,10 @@ public class PrettyPrinter extends DefaultASTVisitor<Void> { ...@@ -154,10 +171,10 @@ public class PrettyPrinter extends DefaultASTVisitor<Void> {
s.append("}"); s.append("}");
}*/ }*/
if (casesStatement.getDefCaseStmt() != null) { if (casesStatement.getDefCaseStmt() != null) {
s.append("default {"); s.append("default : ");
casesStatement.getDefCaseStmt().accept(this); casesStatement.getDefCaseStmt().accept(this);
cl(); cl();
s.append("}"); // s.append("}");
} }
decrementIndent(); decrementIndent();
...@@ -166,28 +183,6 @@ public class PrettyPrinter extends DefaultASTVisitor<Void> { ...@@ -166,28 +183,6 @@ public class PrettyPrinter extends DefaultASTVisitor<Void> {
return null; return null;
} }
/**
* clear line
*/
private void cl() {
int i = s.length() - 1;
while (Character.isWhitespace(s.charAt(i))) {
s.deleteCharAt(i--);
}
nl();
}
@Override
public Void visit(GuardedCaseStatement caseStatement) {
s.append("case ");
caseStatement.getGuard().accept(this);
s.append(" {");
caseStatement.getBody().accept(this);
nl();
s.append("}");
return super.visit(caseStatement);
}
@Override @Override
public Void visit(CallStatement call) { public Void visit(CallStatement call) {
s.append(call.getCommand()); s.append(call.getCommand());
...@@ -206,9 +201,14 @@ public class PrettyPrinter extends DefaultASTVisitor<Void> { ...@@ -206,9 +201,14 @@ public class PrettyPrinter extends DefaultASTVisitor<Void> {
} }
@Override @Override
public Void visit(StringLiteral stringLiteral) { public Void visit(GuardedCaseStatement caseStatement) {
s.append(String.format("\"%s\"", stringLiteral.getText())); s.append("case ");
return super.visit(stringLiteral); caseStatement.getGuard().accept(this);
s.append(": ");
caseStatement.getBody().accept(this);
nl();
// s.append("}");
return super.visit(caseStatement);
} }
@Override @Override
......
...@@ -53,7 +53,7 @@ public class LabelFactory { ...@@ -53,7 +53,7 @@ public class LabelFactory {
} }
cur = cur.parent(); cur = cur.parent();
} while (cur != null); } while (cur != null);
sb.append("$$"); sb.append("END");
return sb.toString(); return sb.toString();
} }
...@@ -70,7 +70,7 @@ public class LabelFactory { ...@@ -70,7 +70,7 @@ public class LabelFactory {
} }
node = p; node = p;
} }
sb.append("$$"); sb.append("END");
return sb.toString(); return sb.toString();
} }
......
package edu.kit.iti.formal.psdbg.gui.controls; package edu.kit.iti.formal.psdbg.gui.controls;
import com.google.common.eventbus.Subscribe;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView; import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView;
import de.uka.ilkd.key.logic.SequentFormula;
import edu.kit.iti.formal.psdbg.gui.controller.Events; import edu.kit.iti.formal.psdbg.gui.controller.Events;
import edu.kit.iti.formal.psdbg.gui.model.MainScriptIdentifier; import edu.kit.iti.formal.psdbg.gui.model.MainScriptIdentifier;
import edu.kit.iti.formal.psdbg.interpreter.dbg.Breakpoint; import edu.kit.iti.formal.psdbg.interpreter.dbg.Breakpoint;
...@@ -11,7 +9,7 @@ import edu.kit.iti.formal.psdbg.lint.LintProblem; ...@@ -11,7 +9,7 @@ import edu.kit.iti.formal.psdbg.lint.LintProblem;
import edu.kit.iti.formal.psdbg.lint.LinterStrategy; import edu.kit.iti.formal.psdbg.lint.LinterStrategy;
import edu.kit.iti.formal.psdbg.parser.Facade; import edu.kit.iti.formal.psdbg.parser.Facade;
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageLexer; import edu.kit.iti.formal.psdbg.parser.ScriptLanguageLexer;
import edu.kit.iti.formal.psdbg.parser.ast.*; import edu.kit.iti.formal.psdbg.parser.ast.ProofScript;
import javafx.beans.InvalidationListener; import javafx.beans.InvalidationListener;
import javafx.beans.Observable; import javafx.beans.Observable;
import javafx.beans.binding.BooleanBinding; import javafx.beans.binding.BooleanBinding;
...@@ -201,7 +199,9 @@ public class ScriptArea extends CodeArea { ...@@ -201,7 +199,9 @@ public class ScriptArea extends CodeArea {
String newValue = getText(); String newValue = getText();
if (newValue.length() != 0) { if (newValue.length() != 0) {
clearStyle(0, newValue.length()); clearStyle(0, newValue.length());
StyleSpans<? extends Collection<String>> spans = highlighter.highlight(newValue); StyleSpans<? extends Collection<String>> spans = highlighter.highlight(newValue);
if (spans != null) setStyleSpans(0, spans); if (spans != null) setStyleSpans(0, spans);
markedRegions.forEach(reg -> { markedRegions.forEach(reg -> {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment