GumTreeDiff / gumtree

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

how to improve diff effect with key #193

Open wangxi761 opened 4 years ago

wangxi761 commented 4 years ago

can we mark some Syntax node as the key ,such as json key ,so we can match it more quickly

wangxi761 commented 4 years ago

image It doesn't look right

jrfaller commented 3 years ago

Hi!

Unfortunately our json parser is in fact the Mozilla rhino js parser. Therefore it might not be perfect for json files. I am not sure to understand well what is your proposal to improve the situation?

Cheers!

wangxi761 commented 3 years ago

I have read gumtree algorithm , and it seem compare for Keyless Data , In many cases,at parse phase ,we could mark some Syntax with key 。 such as json key, method name and so on
in match phase , it will be more Precise and more fast

jrfaller commented 3 years ago

In fact I think this is not really keyless since the key is contained in the subtree corresponding to the property declaration, somethig like:

ObjProp
  Key
    Name "foo"
  Value
    Value "bar"

Therefore it is taken into account at some point.

However you would prefer something more direct like:

ObjProp
  Key "foo"
  Value "bar"

(note that these are not the real names of ast nodes, just made up for the sake of the example).

Is it that?

jrfaller commented 3 years ago

Any follow-up on this issue ?