Skip to content

Commit 63c0a27

Browse files
committed
Fix bug of gendot when there are " in the cql expression
Change-Id: I48886398fae000fc2aafc70565564589b66eb820 Signed-off-by: Kunlin Yu <yukunlin@syriusrobotics.com>
1 parent 82cdb3f commit 63c0a27

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

include/cql2cpp/tree_dot.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#pragma once
1212

1313
#include <ostream>
14+
#include <regex>
1415

1516
#include "ast_node.h"
1617

@@ -34,9 +35,11 @@ class Tree2Dot {
3435
return true;
3536
}
3637

37-
static bool GenerateDot(std::ostream& ous, const AstNodePtr node, const std::string& title) {
38+
static bool GenerateDot(std::ostream& ous, const AstNodePtr node,
39+
const std::string& title) {
3840
ous << "digraph G {" << std::endl;
39-
ous << "label=\"" << title << "\";";
41+
ous << "label=\"" << std::regex_replace(title, std::regex("\""), "\\\"")
42+
<< "\";";
4043
ous << "labelloc = top;";
4144
GenerateDotNode(ous, node);
4245
ous << std::endl;

0 commit comments

Comments
 (0)