语法意识的差异工具? [英] syntax aware diff tools?

查看:61
本文介绍了语法意识的差异工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何了解语法的(理想的GUI)差异工具?



作为我正在寻找的东西的一个示例,我一直在寻找

  Foo = {'hello':'world',| Foo = {‘hello’:‘world’,
’goodnight’:‘moon’| ‘晚安’:‘moon’
}<
<
Bar = {‘picture’:1000,<
} | }

我想要一个工具,该工具会尝试使一侧的匹配括号与匹配的括号对齐






编辑:我正在寻找一种工具,该工具可以自动发现该状况并纠正其对齐方式。

解决方案

不是基于GUI的,而是完全由语法驱动的:我公司的智能差异工具适用于多种语言(包括Java,C#,C ++,PHP,Python,JavaScript,HTML,XML,COBOL等)



智能差异器解析像编译器一样的源文本,因此它了解语言语法并构造编译器的方式。它比较这些结构(使用AST),以确定对这些结构的编辑操作(移动,复制,删除,替换,重命名块中的标识符),从而确定最小编辑距离。



在您的示例中,它将知道右边的花括号属于foo,而不是bar,并且会告诉您整个涉及bar的语句都被删除了。 / p>

如果要将结果提供给另一个工具,则输出样式类似于diff;如果要直接检查结果,则输出样式更易于阅读。


Are there any (ideally GUI) diff tools that are aware of syntax?

As an example of the kind of thing I'm looking for, I keep finding that my current tool miss aligns repetitive code:

Foo  = { 'hello': 'world',    |  Foo  = { 'hello': 'world',
         'goodnight': 'moon'  |           'goodnight': 'moon'  
       }                      <
                              <
Bar  = { 'picture': 1000,     <
       }                      |         }

I'd like a tool that would try and make matching braces on one side align with matching braces on the other.


Edit: I'm looking for a tool that can automatically spot that condition and correct it's alignment.

解决方案

Not GUI based, but completely syntax driven: my company's Smart Differencer tools for many langauges (incluiding Java, C#, C++, PHP, Python, JavaScript, HTML, XML, COBOL,...)

The Smart Differencer parses the source text like the compiler, so it understands that language syntax and structures the way the compiler does. It compares these structures (using ASTs) to determine the "least edit distance" in terms of edit actions (move, copy, delete, replace, rename-identifier-in-block) on these structures and report them.

In your example, it would know the curly brace on the right belongs to foo, not bar, and would tell you that the entire statement involving bar was simply deleted.

The output style is diff-like if you want to feed the result to another tool, or more human readable if you want to examine it directly.

这篇关于语法意识的差异工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆