Language-aware diff tools?
Are you aware of any GUI diff tools that are smart enough to consider syntactical features of the language when determining differences? Something that can recognize that a call to a many-parameter method with one parameter on each line is the same as when all parameters were stretched across one long line? Something that would ignore comments if you asked it to? Something that would be case-insensitive for keywords and identifiers (if you were using a case-insensitive language), but maintained case-sensitivity for string literals?
That would be an extremely specialized tool to have. Even the best diff program I've seen so far (ExamDiff Pro), uses a simple technique at it's core. (The guy at PrestoSoft is someone who can build an app "Soup to Nuts".)
I think that Beyond Compare will do some of what you're looking for (but probably not all). Nevertheless, it's an awesome product, has configurable language support, and is well worth a download to try it out.
Beyond Compare (www.scootersoftware.com) has some of these abilities. Ignoring comments at least. Not sure about anything else.
Agh, John types faster...
OMFG, where are the "nice advertisement" trolls at?
I don't know of any tools that perform such a function. However I don't see many problems writing a tool to do this. First determine what language the file is and run it through a yacc or javacc based parser for that language. Then compare the parse tree.
Run, don't walk to Beyond Compare. It's the best diff program I ever saw.
'diff -uw' does whitespace-insensitive comparisons in a nice format.
Phillip J. Eby
T. Norman, what you need is something that makes comparison between Abstract Syntax Tress, not text files. You may try an IDE with refactoring capabilities - many of them have a "Rewrite engine" that allows you to create, compare and manipulate AST as you like.
I don't need something that incredibly intelligent... basically, just something that knows how to ignore comments, case, and can recognize that
On my Linux machine, here's what I do:
What Giovanni said. Essentially any refactoring tool has to be able to do this, so why not look at some of them? Eclipse has it and it is open source, so in principle you could cadge the source you need and wrap it into your own tool for your own use.
Eclipse has refactoring options but the diff capability apparently is text-based. Do you know how can I make a language-aware diff inside Eclipse?
BeyondCompare can do all the things you listed. It can ignore comments, upper/lower case, strings, etc.
> It gets very frustrating sometimes when a whole bunch of differences get highlighted just because you or somebody else ran the code through a formatting tool.
Just like Kobi said.....
BeyondCompare give me three extra inches!
Beyond Compare certainly understands C++. I think it uses a relatively simplistic algorithm for deciding which parts match which other parts, and sometimes doesn't quite see which two lines are really supposed to line up. But it can tell comments from non comments, and understands that whitespace differences are unimportant (though maybe not when it comes to newlines, can't remember).
Fog Creek Home