GumTreeDiff / gumtree

An awesome code differencing tool
https://github.com/GumTreeDiff/gumtree/wiki
GNU Lesser General Public License v3.0
936 stars 174 forks source link

Backslash must be escaped for dotdiff #377

Open martinclauss opened 3 weeks ago

martinclauss commented 3 weeks ago

Hey :)

I have the following exemplary C file /tmp/a.c:

int main() {
    //12345678\foo
    return 0;
}

For simplicity I diff the file with itself:

gumtree dotdiff /tmp/a.c /tmp/a.c > /tmp/diff.dot

This generates a dot file with the following line:

...
        n_src_7 [label="comment: //12345678\", color=lightgrey];
...

Now the backslash being at this very specific place escapes the quote... which leads to an error:

dot -T png /tmp/diff.dot -o /tmp/diff.png
Error: /tmp/diff.dot: syntax error in line 25 near '['

Maybe this can be fixed somehow :)

Thanks!