Not sure if the title explains it correctly.
不确定标题是否正确。
Anyways, I'm building a .NET WPF application which should go through the JavaScript and identify issues such as
无论如何,我正在构建一个。net WPF应用程序,它应该经过JavaScript并识别诸如此类的问题
- If the variables defined are being nullified at the end
- 如果定义的变量在最后被取消
- If try/catch/finally blocks are being used.
- 如果try/catch/finally块被使用。
- Function calls
- 函数调用
I went through the questions over here which were all revolving around c/c++. Now I regret bunking my compilers classes.
这里的问题都是围绕c/c++展开的。现在,我后悔没有使用编译器类。
I wanted to know how to verify points 1-3 in C#. Any library out there which does this?
我想知道如何验证c#中的1-3点。有图书馆吗?
2 个解决方案
#1
3
Check out IronJS I know they have a pretty good JavaScript library for .Net
看看IronJS,我知道他们有一个非常好的。net JavaScript库
IronJS
#2
2
What you're looking for is an abstract syntax tree parser for Javascript written in C#.
您要寻找的是用c#编写的用于Javascript的抽象语法树解析器。
There are a few choices I know of:
我知道有几个选择:
Microsoft's Ajax Minifier library comes with its own AST parser (used to minify / optimize Javascript files). You can find the source code for that on Codeplex.
微软的Ajax缩小程序库有自己的AST解析器(用于缩小/优化Javascript文件)。你可以在Codeplex上找到它的源代码。
Esprima.net is another option. It's a port of the popular Javascript library Esprima.
Esprima.net是另一种选择。它是流行的Javascript库Esprima的一个端口。
The good thing about Esprima is it outputs the AST in a common format (defined by Mozilla here) that's used across a few parsers, making it really easy to port utilities for walking the tree, etc. since they all use the same underlying data structure.
Esprima的好处是,它以通用格式(这里由Mozilla定义)输出AST,这些格式在一些解析器中使用,这使得移植工具在树中行走非常容易,等等,因为它们都使用相同的底层数据结构。
#1
3
Check out IronJS I know they have a pretty good JavaScript library for .Net
看看IronJS,我知道他们有一个非常好的。net JavaScript库
IronJS
#2
2
What you're looking for is an abstract syntax tree parser for Javascript written in C#.
您要寻找的是用c#编写的用于Javascript的抽象语法树解析器。
There are a few choices I know of:
我知道有几个选择:
Microsoft's Ajax Minifier library comes with its own AST parser (used to minify / optimize Javascript files). You can find the source code for that on Codeplex.
微软的Ajax缩小程序库有自己的AST解析器(用于缩小/优化Javascript文件)。你可以在Codeplex上找到它的源代码。
Esprima.net is another option. It's a port of the popular Javascript library Esprima.
Esprima.net是另一种选择。它是流行的Javascript库Esprima的一个端口。
The good thing about Esprima is it outputs the AST in a common format (defined by Mozilla here) that's used across a few parsers, making it really easy to port utilities for walking the tree, etc. since they all use the same underlying data structure.
Esprima的好处是,它以通用格式(这里由Mozilla定义)输出AST,这些格式在一些解析器中使用,这使得移植工具在树中行走非常容易,等等,因为它们都使用相同的底层数据结构。