Skip to content
Snippets Groups Projects
Commit 465b6c8c authored by Carlos Galindo's avatar Carlos Galindo
Browse files

Escape quotations in statements (fixes #4)

parent 4879ae97
No related branches found
No related tags found
1 merge request!5Escape quotations in statements (fixes #4)
......@@ -46,7 +46,7 @@ public class CFGGraph extends Graph {
String nodes = getNodes().stream()
.sorted(Comparator.comparingInt(GraphNode::getId))
.map(node -> String.format("%s [label=\"%s: %s\"]", node.getId(), node.getId(), node.getData()))
.map(GraphNode::toGraphvizRepresentation)
.collect(Collectors.joining(lineSep));
String arrows =
......
......@@ -145,7 +145,9 @@ public class GraphNode<N extends Node> extends Vertex<String, ArcData> {
}
public String toGraphvizRepresentation() {
return String.format("%s[label=\"%s: %s\"];", getId(), getId(), getData());
String text = getData().replace("\\", "\\\\")
.replace("\"", "\\\"");
return String.format("%s[label=\"%s: %s\"];", getId(), getId(), text);
}
public Set<String> getDeclaredVariables() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment