all groups > c# > april 2004 >
You're in the

c#

group:

CodeParser


CodeParser Jeti
4/19/2004 11:44:17 PM
c#:
is there any class that can parse the source code? I tried with ICodeParser,
but I can't make it...

Whats the best way to parse source?
example: the user of my application enters his source into textbox, and i
want to parse it and display summary... how to do that?

any hints?

thx
--
Jeti@programeri.org @ www.programeri.org

Re: CodeParser Jeti
4/20/2004 12:50:25 AM
[quoted text, click to view]

Sharon, thanx for reply, but I want to extract detailed data from source
(metadata attributes, mathod params, class & struct definitions, etc...) and
i doubt it i can do it this way... I thin that generated xml doc contains
only relevant and short data...

anyway, thanx for the idea, i'll try to do it that way, maybe it will do...

Re: CodeParser Sharon
4/20/2004 1:19:01 AM
Hi Jeti.
I haven't done this, but here are some suggestions.
You can compile the source using Microsoft.CSharp.Compiler.
Compiler wrappers for VB and JScript are also provided.
Once you have compiled the source to a file, you can use System.Reflection,
to extract the data you need from the assembly.
Or better yet, when compiling, generate xml doc for the assembly and use it.
Hope this gives you some direction.
Sharon.

[quoted text, click to view]

Re: CodeParser Sharon
4/20/2004 3:57:34 AM
[quoted text, click to view]

I think you can do all that using Reflection.
Xml doc also should contain all this data.
But maybe you'll find some lite code parser that works better.
Try this one:
http://www.codeproject.com/csharp/codedomparser.asp


[quoted text, click to view]

Re: CodeParser Dmitriy Lapshin [C# / .NET MVP]
4/20/2004 10:33:07 AM
Hi,

There's a free (AFAIR) parser library called GoldParser written in C# which
should have rule sets for C# and VB .NET. You indeed cannot use ICodeParser
since its implementation is not exposed to the general public.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

[quoted text, click to view]
AddThis Social Bookmark Button