Is there a "Language-Aware" diff?

Posted by JS on Stack Overflow See other posts from Stack Overflow or by JS
Published on 2010-05-13T17:13:53Z Indexed on 2010/05/13 17:34 UTC
Read the original article Hit count: 235

Filed under:

(Appologies for the poor title. I'm open to suggestions for a better one. "Language-gnostic", perhaps?)

Does there exist a diff utility (preferably *nix-based) that will diff files based on how a (selectable) language compiler would view the code?

For example, to a Python compiler, these two 'graphs are identical:

# The quick brown fox jumped

vs:

# The quick brown
# fox jumped

Telling most diffs (at least the one's I'm familiar with) to ignore spaces and linebreaks still causes them to flag a difference due to the extra '#'.

"Language-sensitivity" would sure help to cut down on the "noise".

Ideally, it would work in xemacs....(<-- probably pushing my luck? :-)

© Stack Overflow or respective owner

Related posts about diff