Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

i.e.:

1) convert code sample 1 to AST 2) convert code sample 2 to AST 3) do text-based diffs while paying attention to the ASTs

A closing brace is really part of the function started by the function definition and opening brace. As such, a closing brace from function X should never "match" an opening brace from function Y.

I imagine that simple chopping code into multiple text blocks, one for each function, before passing it to a "diff" routine would accomplish most of that. After all, we already chop code into text blocks by filename...



Chopping up the code by function is not enough. The same problem exists for blocks within functions, like with a sequence of if statements.


Yes... that should go without saying.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: