Closed rudiejd closed 2 months ago
After redoing the srcML file with --position enabled, I got the right output;
==========================================================================
Name and type: tn3
Contains Declaration: 1 Containing class:
Dvars: {}
Aliases: {n1,}
Cfunctions: {}
Use: {10,}
Def: {7,}
Control Edges: {(7, 10),}
==========================================================================
==========================================================================
Name and type: tn2
Contains Declaration: 1 Containing class:
Dvars: {}
Aliases: {n3,}
Cfunctions: {}
Use: {12,}
Def: {7,}
Control Edges: {(7, 12),}
==========================================================================
==========================================================================
Name and type: tn1
Contains Declaration: 1 Containing class:
Dvars: {}
Aliases: {n2,}
Cfunctions: {}
Use: {11,}
Def: {7,}
Control Edges: {(7, 11),}
==========================================================================
==========================================================================
Name and type: n3
Contains Declaration: 1 Containing class:
Dvars: {tn3,}
Aliases: {n3,}
Cfunctions: {}
Use: {7,}
Def: {4,12,}
Control Edges: {(4, 7),(7, 12),}
==========================================================================
==========================================================================
Name and type: n2
Contains Declaration: 1 Containing class:
Dvars: {tn2,}
Aliases: {n2,}
Cfunctions: {}
Use: {7,}
Def: {4,11,}
Control Edges: {(4, 7),(7, 11),}
==========================================================================
==========================================================================
Name and type: n1
Contains Declaration: 1 Containing class:
Dvars: {tn1,}
Aliases: {n1,}
Cfunctions: {}
Use: {7,}
Def: {4,10,}
Control Edges: {(4, 7),(7, 10),}
==========================================================================
This is correct. There should probably be some documentation stating that only srcML outputs generated with position enabled will work correctly with srcSlice
Thanks for your share.This problem has bothered me for a long time.
I tried to use srcSlice against a basic example provided from the srcML website (https://www.srcml.org/tutorials/creating-srcml.html. The srcML XML output is as follows:
This is for the program:
This gives the following output
It seems like all the uses and definitions are on line zero, whereas the source code does not reflect that. Shouldn't this example work? Is there a specific version of srcML that is compatible with srcSlice?