Reputation: 21
What I need is a tools (a library if possible) that allow me to parse C# source code in a solution and detect each single object (declared in the solution's classes) and each single static class for future manipulation.
I need that because I would programmatically insert some method calls (for logging purpose) but for doing that right (and automatically) I need to know the structure of each object (because I would also include a description of the object state...)
At the moment I've considered that solution: http://csparser.codeplex.com/
But I am not sure it's best for my purpose (seem abandoned). I hope somebody here know a better solution (free if possible).
Upvotes: 2
Views: 796
Reputation: 95306
Our DMS Software Reengineering Toolkit can carry out arbitrary "programmatic" manipulations on source code, using language-accurate parsers. Internally it operates like a compiler (parsing, tree building, analyzing), but one can control what it does, and make changes to the ASTs, as well as regenerate valid source text from those changed trees.
It has C# and VB.dot front ends available.
It is commercial.
Upvotes: 0
Reputation: 498904
I'd check out the Rosyln CTP from Microsoft:
Traditionally, compilers are black boxes – source code goes in one end and object files or assemblies come out the other end. The Roslyn project changes that model by opening up the Visual Basic and C# compilers as APIs.
Upvotes: 1