tags:

views:

135

answers:

1

Possible duplicate: do you know of any language-aware diffing tools?

(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? :-)

+2  A: 

See our SD Smart Differencer tools.

These are language aware, and report differences in terms of language elements (operands, expressions, statements, blocks,...) and abstract editing operations (insert, delete, replace, copy, move, rename) rather than the usual diff-style "this line changed".

Whitespace, as defined per language, is ignored, so layout doesn't change the essential difference information reported. The Smart Differencer would simply ignore the comments in the example you provided.

The Smart Differencer tools rely on language-precise parsers rather than weak parsers.

Ira Baxter
Not open-source and doesn't (yet) support Python, but I gotta admit it looks like it would do the job.
JS
Er, does support Python. Maybe not documented on the web site properly.
Ira Baxter
Keeps getting better. It's open-source license isn't documented well either, maybe? ;-)
JS
@JS: Its well documented that it isn't open-source license :-{ I don't recall that being part of the original question, through.
Ira Baxter